Annoying ERROR: 'wlan0' is not a DHCP-enabled interface

Doug Barton dougb at FreeBSD.org
Tue Dec 27 02:58:16 UTC 2011


On 11/06/2011 03:02, Xin LI wrote:
> Hi,
> 
> It seems that 226879 have introduced an error indication where if an
> interface is up and is not set to DHCP, the devd invoked
> /etc/rc.d/dhclient wlan0 call would generate an annoying message.
> 
> I think this message is not necessary at all -- normally
> /etc/rc.d/dhclient is used by the system and it's just legitimate that
> a network interface comes up and have not assigned as DHCP.
> 
> I'd like to propose the attached change, which turns this message into
> debug message but keep the exit intact.

The discussion about changing the error message in rc.d/dhclient is
applying the fix to the wrong location. Thanks to Eygene's help in
understanding the history of where the error message came from I have
what I believe to be a better suggestion.

History:

Prior to, and after, des' changes in r226345 and r226464 if
rc.d/dhclient was called for a non-DHCP interface it returned with exit
code 1, but without an error. What des added was an additional test for
whether or not rc_force is set. This is a feature, because it allows one
to do 'service dhclient forcestart em0' and have DHCP configuration
attempted even if it's not configured in rc.conf.

In r226879 rea astutely observed that rc_force is only visible in
certain contexts, and added a better check for that. He also added an
error message that did not previously exist.

The Problem:

/etc/rc.d/dhclient is called unconditionally from devd.conf every time
the interface comes up. If the interface is not configured to use DHCP,
this generates an error in the logs that did not exist prior to r226879.

My proposed solution:

Make devd.conf smarter about how it tries to bring the interface up.
This is accomplished rather easily in the attached patch, which uses
netif instead of dhclient. The virtue of this solution is that it will
use whatever configuration exists for the interface, and will not call
rc.d/dhclient spuriously.

Brooks added the dhclient invocation to devd.conf in r147088 back in
2005-06-06. I've cc'ed him to ask if there is any obvious reason why
using netif instead wouldn't be a good idea.


hth,

Doug

-- 

		[^L]

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/

-------------- next part --------------
Index: devd.conf
===================================================================
--- devd.conf	(revision 228906)
+++ devd.conf	(working copy)
@@ -44,16 +44,14 @@
 };
 
 #
-# 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 automatically exits
-# when the link goes down.
+# Try to start the network on Ethernet-like interfaces when the link comes
+# up.
 #
 notify 0 {
 	match "system"		"IFNET";
 	match "type"		"LINK_UP";
 	media-type		"ethernet";
-	action "/etc/rc.d/dhclient quietstart $subsystem";
+	action "/etc/rc.d/netif quietstart $subsystem";
 };
 
 #
@@ -73,7 +71,7 @@
 	match "system"		"IFNET";
 	match "type"		"LINK_UP";
 	media-type		"802.11";
-	action "/etc/rc.d/dhclient quietstart $subsystem";
+	action "/etc/rc.d/netif quietstart $subsystem";
 };
 
 # An entry like this might be in a different file, but is included here


More information about the freebsd-rc mailing list