From owner-freebsd-rc@FreeBSD.ORG Wed Sep 29 10:01:02 2010 Return-Path: Delivered-To: freebsd-rc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9AE1F1065673 for ; Wed, 29 Sep 2010 10:01:02 +0000 (UTC) (envelope-from jdc@koitsu.dyndns.org) Received: from qmta10.westchester.pa.mail.comcast.net (qmta10.westchester.pa.mail.comcast.net [76.96.62.17]) by mx1.freebsd.org (Postfix) with ESMTP id 47A308FC16 for ; Wed, 29 Sep 2010 10:01:01 +0000 (UTC) Received: from omta20.westchester.pa.mail.comcast.net ([76.96.62.71]) by qmta10.westchester.pa.mail.comcast.net with comcast id CZSB1f0041YDfWL5Aa12UG; Wed, 29 Sep 2010 10:01:02 +0000 Received: from koitsu.dyndns.org ([98.248.41.155]) by omta20.westchester.pa.mail.comcast.net with comcast id Ca111f0093LrwQ23ga128B; Wed, 29 Sep 2010 10:01:02 +0000 Received: by icarus.home.lan (Postfix, from userid 1000) id 4E7E09B418; Wed, 29 Sep 2010 03:01:00 -0700 (PDT) Date: Wed, 29 Sep 2010 03:01:00 -0700 From: Jeremy Chadwick To: Doug Barton Message-ID: <20100929100100.GA83642@icarus.home.lan> References: <20100925000435.GA62501@sandvine.com> <4CA15FC8.8010106@FreeBSD.org> <20100929074628.GA83194@icarus.home.lan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100929074628.GA83194@icarus.home.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-rc@freebsd.org Subject: Re: Wait for carrier in /etc/rc.d/defaultroute 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: Wed, 29 Sep 2010 10:01:02 -0000 On Wed, Sep 29, 2010 at 12:46:28AM -0700, Jeremy Chadwick wrote: > On Mon, Sep 27, 2010 at 08:23:52PM -0700, Doug Barton wrote: > > On 9/24/2010 5:04 PM, Ed Maste wrote: > > >/etc/rc.d/defaultroute currently bails immediately if all interfaces > > >set to use DHCP have no carrier. This caused grief at work as it takes > > >some time for link to be established, and defaultroute ran before this > > >happened. The rest of rc.d/ ran then before DHCP could assign an > > >address and route. > > > > > >The attached patch introduces a defaultroute_carrier_delay variable > > >and a change to /etc/rc.d/defaultroute to wait that long before bailing > > >out if there are no interfaces with carrier. With the default settings > > >defaultroute will wait for five seconds to see if any interface gets > > >carrier. The original 30 second wait for a default route to appear is > > >unchanged. > > > > > >Any comments? I'll commit it sometime next week if there's no concern. > > > > There was a more generic solution floating around fairly recently, > > from Jeremy Chadwick. The thread on this list starts back in april, > > but the latest version of the script appeared in june, so you might > > want to start there. I used versions of that script for most of this > > calendar year, and offered to commit it if the rc.conf.5 update was > > written. > > > > Jeremy, if you've done that bit and I lost track, apologies, my > > FreeBSD time has been super limited lately, but it's on the upswing > > at the moment, so maybe you could update us? > > Ack, I forgot all about this (and despite recommending the script to > someone on the lists a couple weeks ago)! The script Doug's referring > to is available below, and should be placed into /usr/local/etc/rc.d (be > sure to chmod 755/555 it as well): > > http://jdc.parodius.com/freebsd/netwait > > Example usage in /etc/rc.conf: > > netwait_enable="yes" > netwait_ip="4.2.2.1 4.2.2.2" > netwait_if="em0" > netwait_timeout="15" > > This version lacks some of Doug's recommended changes (some minor syntax > changes and a more realtime indicator of what's going on by printing > dots/periods) -- I'll dig up Doug's Email from a while back and make > some time to implement his recommendations. I misread Doug's proposed changes -- it's not to print dots/periods to indicate status, I misread the patch. :-) I've implemented his changes and the above script has been updated to include them. We should be good to go, aside from removal of a couple commented out default variables near the top of the script. > The idea in the long-run is to get this script committed to the base > system (e.g. /etc/rc.d), have rc.conf(5) updated to mention the > variables, in addition to src/etc/defaults/rc.conf. > > Furthermore, I should probably file a PR for all of this... I just spent the past couple hours doing the rc.conf.5 and defaults/rc.conf modifications. These, as well as the netwait script itself, should be reviewed by those more familiar with the base system rc(8) stuff (hi Doug. :-) ). Meaning: I'm not sure where the default values should be set. The official PR, which contains URLs to the patches and the script itself. Not showing up on the web yet, but I got the GNATS response. http://www.freebsd.org/cgi/query-pr.cgi?pr=151063 -- | Jeremy Chadwick jdc@parodius.com | | Parodius Networking http://www.parodius.com/ | | UNIX Systems Administrator Mountain View, CA, USA | | Making life hard for others since 1977. PGP: 4BD6C0CB |