From owner-freebsd-questions@FreeBSD.ORG Thu May 4 13:11:00 2006 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 800CB16A415 for ; Thu, 4 May 2006 13:11:00 +0000 (UTC) (envelope-from danielby@slightlystrange.org) Received: from catflap.slightlystrange.org (cpc6-cmbg1-0-0-cust82.cmbg.cable.ntl.com [82.10.236.83]) by mx1.FreeBSD.org (Postfix) with ESMTP id A30ED43D46 for ; Thu, 4 May 2006 13:10:48 +0000 (GMT) (envelope-from danielby@slightlystrange.org) Received: from danielby by catflap.slightlystrange.org with local (Exim 4.61 #1) id 1FbdbT-000G2D-5c by authid for ; Thu, 04 May 2006 14:10:47 +0100 Date: Thu, 4 May 2006 14:10:47 +0100 From: Daniel Bye To: freebsd-questions@freebsd.org Message-ID: <20060504131039.GD99544@catflap.slightlystrange.org> Mail-Followup-To: freebsd-questions@freebsd.org References: <20060503204159.GB79222@catflap.slightlystrange.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="WK3l2KTTmXPVedZ6" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: danielby@slightlystrange.org X-SA-Exim-Scanned: No (on catflap.slightlystrange.org); SAEximRunCond expanded to false Subject: Re: dhclient-exit-hooks X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Daniel Bye List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 May 2006 13:11:01 -0000 --WK3l2KTTmXPVedZ6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable (Apologies for the rather fragmentary nature of this post - I've been typing and reading the scripts and man pages, trying to get my head round what's going on...) On Wed, May 03, 2006 at 05:43:48PM -0400, fbsd wrote: > I figured the "Shared object not found" error is another sign > of what is wrong in general so I commented out the mail command > to concentrate on just the logger problem.=20 Fair enough - we'll come back to this later! > During testing the > logger problem I determined the script "if" statement is not > working. It ought to - the test is structured correctly, so I can't see any reason it would not behave in any way other than you would expect. > Problem seems more like bug in how and or when during the boot > process the script is getting executed. Yeah, it's beginning to look like it, isn't it? Did you try running it with xtrace turned on? Perhaps you could even try running rc under xtrace? (I have done this in the past, it spews forth a great deal of noise, but among the noise you may find what you are looking for.) > This has nothing to do with my script code. > This is how FreeBSD is handling the default dhclient-script that > comes pre installed on the system. >=20 > The recorder directives have made no difference. Yep, that makes sense - now I understand where your code is being called from. > Please note I am not using the isc-dhcp port dhclient. > I am running the dhclient that comes as part of the base > install of FreeBSD. Noted. > I have ifconfig_dc0=3D"DHCP" in rc.conf to launch > /sbin/dhclient-script. > dhclient-script calls dhclient-exit-hooks > I don't think the recorder directives get into play because > dhclient does not use the rc.d environment. No, not the ones you added to the dhclient-exit-hooks, but dhclient is started by this block of code in /etc/network.subr: if dhcpif $1; then if [ $_cfg -ne 0 ] ; then ifconfig $1 up fi /etc/rc.d/dhclient start $1 _cfg=3D0 fi (dhcpif() tests the value of $1, returning true if it is DHCP or dhcp or any combination in mixed case) /etc/network.subr gets called from /etc/rc.d/netif (among others, but it is netif that is called earliest, I believe). /etc/rc.d/dhclient does use rcorder, although you are right in that /sbin/dhclient doesn't know anything about it. As far as I can tell, the sequence of events is something like this: rc builds a list of files to run, using rcorder(8) These scripts run, occasionally calling in other helper scripts (such as /etc/network.subr). When netif is called, it calls network.subr, which calls /etc/rc.d/dhclient as necessary. /etc/rc.d/dhclient starts /sbin/dhclient, which in turn calls /sbin/dhclient-script at various points in its execution. /sbin/dhclient-script then calls the enter and exit hooks at the appropriate times. > I know the dhclient-exit-hooks script is executing because of the > echo commands I put in it before and after the IF statement. Yep, that's fair comment. > I also know the dhclient variables are being loaded in the > /etc/dhcpd.name-servers file because I empty it before rebooting > system, and after words I edit it and it contains the correct > values. Which suggests that your code is indeed Doing the Right Thing. > I am beginning to think that something changed between 4.x and 6.0 > in > the way the dhclient-script get processed during boot. > It's acting like it gets executed to early in the boot process. > Do I have enough evidence on this to submit a bug report??? I reckon it's worth trying under xtrace to see if that provides any clue. You could also try adding -s to the logger call, so it prints its messages to STDERR as well as to the nominated log file. Dan --=20 Daniel Bye PGP Key: ftp://ftp.slightlystrange.org/pgpkey/dan.asc PGP Key fingerprint: D349 B109 0EB8 2554 4D75 B79A 8B17 F97C 1622 166A _ ASCII ribbon campaign ( ) - against HTML, vCards and X - proprietary attachments in e-mail / \ --WK3l2KTTmXPVedZ6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFEWf1Pixf5fBYiFmoRAh5fAJ9XTXrYLmtkQqfTO7VWnjov6Jf2ewCeIi2U T+CQJHq3UfgNKzTxMxXmerI= =gzW+ -----END PGP SIGNATURE----- --WK3l2KTTmXPVedZ6--