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

Garrett Cooper yanegomi at gmail.com
Tue Dec 27 06:32:14 UTC 2011


On Dec 26, 2011, at 6:57 PM, Doug Barton wrote:

> 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.

	The only misgiving that I have about this is that it deletes the default route and might cause issues with firewalls, natd, more complicated interface types like laggs, vlans, etc. It annoys me that torquing the network via rc.d ties FreeBSD into knots still today :(.
	I'll gladly test this out when I get a chance though sometime this week.
Thanks,
-Garrett


More information about the freebsd-rc mailing list