Bug 158734 - netif stop don't destroy cloned_interfaces
Summary: netif stop don't destroy cloned_interfaces
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: Cy Schubert
URL:
Keywords:
: 109980 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-07-08 13:40 UTC by Antonio Huete Jimenez
Modified: 2020-12-04 19:36 UTC (History)
2 users (show)

See Also:


Attachments
Shut down cloned interfaces at shutdown (267 bytes, patch)
2020-10-12 05:06 UTC, Cy Schubert
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antonio Huete Jimenez 2011-07-08 13:40:03 UTC
Hi,

I'm not sure if this is a bug or it is intentional, but when you try to
restart netif service, it spits an error because cloned_interfaces are
not destroyed upon netif stop.

fbsd# grep cloned /etc/rc.conf
cloned_interfaces="bridge0"


fbsd# /etc/rc.d/netif restart
Stopping Network: lo0 em0 plip0 bridge0.
lo0: flags=8048<LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
em0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:0c:29:69:54:73
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
plip0: flags=8810<POINTOPOINT,SIMPLEX,MULTICAST> metric 0 mtu 1500
bridge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 3a:51:06:6b:4d:87
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200
        root id 00:00:00:00:00:00 priority 0 ifcost 0 port 0
ifconfig: create: bad value
Starting Network: lo0 em0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        nd6 options=3<PERFORMNUD,ACCEPT_RTADV>
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
        ether 00:0c:29:69:54:73
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active


It spits "ifconfig: create: bad value" because in /etc/network.subr in
clone_up function line 502, it tries to create the clone without checking
if it exist first. I wonder also if it would be fine just to send stderr
to /dev/null or if it would be worthy to create a function to check the
existence of the clone and skip its creation in that case.

Cheers,
Antonio Huete
Comment 1 Antonio Huete Jimenez 2011-07-08 13:53:48 UTC
This is the same as for PR 109980, although it contains additional
information.
I can see that 109980 was assigned to freebsd-rc but no response was given.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2011-07-11 04:34:01 UTC
Responsible Changed
From-To: freebsd-i386->freebsd-bugs

reclassify.
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:10 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 4 Cy Schubert freebsd_committer 2020-10-08 03:44:08 UTC
Is this still a problem? If yes, I'll take this bug and work on it.
Comment 5 Cy Schubert freebsd_committer 2020-10-12 05:06:51 UTC
Created attachment 218677 [details]
Shut down cloned interfaces at shutdown

I tested this with my lagg0 interfaces. It resolves the WOL issue with ports of the aggregation interface. Try it, please.
Comment 6 Cy Schubert freebsd_committer 2020-10-12 05:12:20 UTC
*** Bug 109980 has been marked as a duplicate of this bug. ***
Comment 7 commit-hook freebsd_committer 2020-10-19 20:38:34 UTC
A commit references this bug:

Author: cy
Date: Mon Oct 19 20:37:38 UTC 2020
New revision: 366857
URL: https://svnweb.freebsd.org/changeset/base/366857

Log:
  Destroy cloned interfaces at netif stop, netif restart and shutdown.
  This is especially important during shutdown because a child interface
  of lagg with WOL enabled will not enable WOL at interface shutdown and
  thus no WOL to wake up the device (and machine).

  PR:		158734, 109980
  Reported by:	Antonio Huete Jimenez <tuxillo at quantumachine.net>
  		Marat N.Afanasyev <marat at zealot.ksu.ru>
  reviewed by:	kp
  MFC after:	1 week
  Differential Revision:	https://reviews.freebsd.org/D26797

Changes:
  head/libexec/rc/rc.d/netif
Comment 8 commit-hook freebsd_committer 2020-10-26 01:18:26 UTC
A commit references this bug:

Author: cy
Date: Mon Oct 26 01:18:16 UTC 2020
New revision: 367049
URL: https://svnweb.freebsd.org/changeset/base/367049

Log:
  MFC r366857:
  Destroy cloned interfaces at netif stop, netif restart and shutdown.
  This is especially important during shutdown because a child interface
  of lagg with WOL enabled will not enable WOL at interface shutdown and
  thus no WOL to wake up the device (and machine).

  PR:		158734, 109980
  Reported by:	Antonio Huete Jimenez <tuxillo at quantumachine.net>
  		Marat N.Afanasyev <marat at zealot.ksu.ru>
  reviewed by:	kp

Changes:
_U  stable/12/
  stable/12/libexec/rc/rc.d/netif
Comment 9 commit-hook freebsd_committer 2020-10-26 01:23:31 UTC
A commit references this bug:

Author: cy
Date: Mon Oct 26 01:23:14 UTC 2020
New revision: 367050
URL: https://svnweb.freebsd.org/changeset/base/367050

Log:
  This is a direct commit to stable/11 however it performs MFC r366857
  applied to stable/12 with r367049. This is due to src/etc/rc.d/netif
  having been previously moved to src/libexec/rc.d/netif.

  Destroy cloned interfaces at netif stop, netif restart and shutdown.
  This is especially important during shutdown because a child interface
  of lagg with WOL enabled will not enable WOL at interface shutdown and
  thus no WOL to wake up the device (and machine).

  PR:		158734, 109980
  Reported by:	Antonio Huete Jimenez <tuxillo at quantumachine.net>
  		Marat N.Afanasyev <marat at zealot.ksu.ru>
  reviewed by:    kp

Changes:
  stable/11/etc/rc.d/netif
Comment 10 Cy Schubert freebsd_committer 2020-11-13 18:01:39 UTC
Comitted.
Comment 11 commit-hook freebsd_committer 2020-12-04 19:31:21 UTC
A commit references this bug:

Author: cy
Date: Fri Dec  4 19:31:16 UTC 2020
New revision: 368345
URL: https://svnweb.freebsd.org/changeset/base/368345

Log:
  Revert r366857.

  r366857 created a number of problems, tearing down interfaces too
  early in shutdown. This resulted in:

  - hung ssh sessions when shutting down or rebooting remotely using
    shutdown (I've used exec shutdown, for years, as apposed to simply
    shutdown).

  - NFS mounted filesystems "disappear" prior to unmount.

  - dhclient attached to a VLAN on an interface who's parent interface
    has already shut down prints errors.

  The path forward is to teach lagg(4) and vlan(4) about WOL.

  PR:		251531, 251540
  PR:		158734, 109980 are broken again
  Reported by:	jhb, emaste, jtl, Helge Oldach<freebsd_oldach.net>
  		Martin Birgmeier <d8zNeCFG_aon.at>
  MFC after:      Immediately
  Discussion at:	https://reviews.freebsd.org/D27459

Changes:
  head/libexec/rc/rc.d/netif
Comment 12 commit-hook freebsd_committer 2020-12-04 19:36:30 UTC
A commit references this bug:

Author: cy
Date: Fri Dec  4 19:35:44 UTC 2020
New revision: 368346
URL: https://svnweb.freebsd.org/changeset/base/368346

Log:
  Revert r366857.

  r366857 created a number of problems, tearing down interfaces too
  early in shutdown. This resulted in:

  - hung ssh sessions when shutting down or rebooting remotely using
    shutdown (I've used exec shutdown, for years, as apposed to simply
    shutdown).

  - NFS mounted filesystems "disappear" prior to unmount.

  - dhclient attached to a VLAN on an interface who's parent interface
    has already shut down prints errors.

  The path forward is to teach lagg(4) and vlan(4) about WOL.

  PR:		251531, 251540
  PR:		158734, 109980 are broken again
  Reported by:	jhb, emaste, jtl, Helge Oldach<freebsd_oldach.net>
  		Martin Birgmeier <d8zNeCFG_aon.at>
  Discussion at:	https://reviews.freebsd.org/D27459

Changes:
_U  stable/12/
  stable/12/libexec/rc/rc.d/netif