Skip site navigation (1)Skip section navigation (2)
Date:      Thu,  9 Jun 2011 11:55:59 +0200 (CEST)
From:      Nick Hibma <nick@anywi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   kern/157725: devd does not stop dhclient on removing cable from vr ethernet port
Message-ID:  <20110609095559.AD8DFAC815@uitsmijter.van-laarhoven.org>
Resent-Message-ID: <201106091010.p59AABou061858@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         157725
>Category:       kern
>Synopsis:       devd does not stop dhclient on removing cable from vr ethernet port
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 09 10:10:11 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Nick Hibma
>Release:        FreeBSD 8.2-STABLE i386
>Organization:
AnyWi Technologies
>Environment:
FreeBSD AWSniffer 8.0-STABLE FreeBSD 8.0-STABLE #2: Tue Feb 22 13:49:20 CET 2011     root@billary.localdomain:/usr/obj/nanobsd.8/usr/src/sys/SOEKRIS8  i386

>Description:
In /etc/devd.conf it says:

  # Try to start dhclient on Ethernet like interfaces when the link comes
  # up.  Only devices that are configured to support DHCP will actually
  # run it.  No link down rule exists because dhclient automaticly exits
  # when the link goes down.

but this is not true. dhclient does not exit.
>How-To-Repeat:
On a SOEKRIS board (hm, they use vr chips now as well ...):

  # ifconfig vr2
  vr2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	  options=8280b<RXCSUM,TXCSUM,VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
	  ether 00:00:24:cd:95:2a
	  inet 192.168.1.92 netmask 0xffffff00 broadcast 192.168.1.255
	  inet 172.17.17.17 netmask 0xfffffff0 broadcast 172.17.17.31
	  media: Ethernet autoselect (100baseTX <full-duplex>)
	  status: active
  # ps ax|grep dhclient
   1661  ??  Ss     0:00.00 dhclient: vr2 [priv] (dhclient)
   1679  ??  Ss     0:00.00 dhclient: vr2 (dhclient)
  # ifconfig vr2
  vr2: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	  options=8280b<RXCSUM,TXCSUM,VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
	  ether 00:00:24:cd:95:2a
	  inet 192.168.1.92 netmask 0xffffff00 broadcast 192.168.1.255
	  inet 172.17.17.17 netmask 0xfffffff0 broadcast 172.17.17.31
	  media: Ethernet autoselect (none)
	  status: no carrier
  # ps ax | grep dhclient
   1661  ??  Ss     0:00.00 dhclient: vr2 [priv] (dhclient)
   1679  ??  Ss     0:00.00 dhclient: vr2 (dhclient)

On an ALIX board:

  # ifconfig vr0
  vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	  options=8280b<RXCSUM,TXCSUM,VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
	  ether 00:0d:b9:1b:57:28
	  inet 192.168.1.94 netmask 0xffffff00 broadcast 192.168.1.255
	  inet 192.168.1.2 netmask 0xfffffffc broadcast 192.168.1.3
	  media: Ethernet autoselect (100baseTX <full-duplex>)
	  status: active
  # ps ax|grep dhclient
   3633  ??  Ss     0:00.00 dhclient: vr0 [priv] (dhclient)
   3652  ??  Ss     0:00.00 dhclient: vr0 (dhclient)
  # ifconfig vr0
  vr0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	  options=8280b<RXCSUM,TXCSUM,VLAN_MTU,WOL_UCAST,WOL_MAGIC,LINKSTATE>
	  ether 00:0d:b9:1b:57:28
	  inet 192.168.1.94 netmask 0xffffff00 broadcast 192.168.1.255
	  inet 192.168.1.2 netmask 0xfffffffc broadcast 192.168.1.3
	  media: Ethernet autoselect (none)
	  status: no carrier
  # ps ax | grep dhclient
   3633  ??  Is     0:00.00 dhclient: vr0 [priv] (dhclient)
   3652  ??  Ss     0:00.00 dhclient: vr0 (dhclient)
>Fix:

Adding the following additional configuration fixes this:

  notify 10 {
	  match "system"          "IFNET";
	  match "type"            "LINK_DOWN";
	  media-type              "ethernet";
	  action "/etc/rc.d/dhclient quietstop $subsystem";
  };

Notes:
- I have not tested this with other priority values.
- I have not tested this in a setup with interfaces with no DHCP in their
config lines.

Output of devd and console:

  Processing event '!system=IFNET subsystem=vr2 type=LINK_DOWN'
  Pushing table
  setting system=IFNET
  setting subsystem=vr2
  setting type=LINK_DOWN
  Processing notify event
  Testing system=IFNET against ^IFNET
  Testing type=LINK_DOWN against ^LINK_UP
  Testing system=IFNET against ^IFNET
  Testing type=LINK_DOWN against ^LINK_DOWN
  Testing media type of vr2 against 0x20
  vr2 has media type 0x20
  Executing '/etc/rc.d/dhclient quietstop vr2'
  Jun  1 12:13:12 AWSniffer dhclient[1661]: connection closed
  Jun  1 12:13:12 AWSniffer dhclient[1661]: exiting.
  Popping table
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20110609095559.AD8DFAC815>