From owner-freebsd-rc@FreeBSD.ORG Tue Dec 27 02:58:16 2011 Return-Path: Delivered-To: freebsd-rc@FreeBSD.ORG Received: from mx2.freebsd.org (mx2.freebsd.org [IPv6:2001:4f8:fff6::35]) by hub.freebsd.org (Postfix) with ESMTP id 2F507106566B; Tue, 27 Dec 2011 02:58:16 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from 172-17-198-245.globalsuite.net (hub.freebsd.org [IPv6:2001:4f8:fff6::36]) by mx2.freebsd.org (Postfix) with ESMTP id 2B33514D902; Tue, 27 Dec 2011 02:57:46 +0000 (UTC) Message-ID: <4EF93429.4020404@FreeBSD.org> Date: Mon, 26 Dec 2011 18:57:45 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: d@delphij.net References: <4EB6693F.2020102@delphij.net> In-Reply-To: <4EB6693F.2020102@delphij.net> X-Enigmail-Version: undefined OpenPGP: id=1A1ABC84 Content-Type: multipart/mixed; boundary="------------070009070701000905080005" Cc: freebsd-rc@FreeBSD.ORG, Brooks Davis , Xin LI , Eygene Ryabinkin , Dag-Erling Smorgrav Subject: Re: Annoying ERROR: 'wlan0' is not a DHCP-enabled interface X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2011 02:58:16 -0000 This is a multi-part message in MIME format. --------------070009070701000905080005 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/ --------------070009070701000905080005 Content-Type: text/plain; name="devd.conf.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="devd.conf.diff" 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 --------------070009070701000905080005--