Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Oct 2005 21:33:19 -0700
From:      Brooks Davis <brooks@one-eyed-alien.net>
To:        Reid Linnemann <lreid@a.cs.okstate.edu>
Cc:        freebsd-current@freebsd.org
Subject:   Re: dhclient chokes on dhclient-exit-hooks
Message-ID:  <20051018043319.GA9748@odin.ac.hmc.edu>
In-Reply-To: <20051018023825.7806EA0633@csa.cs.okstate.edu>
References:  <20051018023825.7806EA0633@csa.cs.okstate.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--AhhlLboLdkugWU4S
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Oct 17, 2005 at 09:38:25PM -0500, Reid Linnemann wrote:
>=20
> Running current as of 10/14, the dhclient-exit-hooks at the end of this
> message causes dhclient to hang for a few seconds and terminate without
> configuring its interface.
>=20
> One interface, rl0, is configured with dhclient. In recent
> history(current as of <3 weeks ago), the script would initialize the
> interface, and after dhclient acquired an address would reverse lookup
> the lease address and set the hostname to the result.
>=20
> Currently, on the console, only one line of output comes from the script:
> `reason is PREINIT and ip is `
>=20
> The last output from dhclient is:
> `DHCPACK from <ip>`
>=20
> At this point, whatever is executing (dhclient? dhclient-exit-hooks?)
> hangs for a second, and then the boot continues - no 'bound to w.x.y.z`
> message is displayed, and the interface is not assigned an address.
>=20
> If I remove dhclient-exit-hooks, the lease is acquired and the interface
> is brought up normally.
>=20
> My first intuition is - maybe the script is trying to to a host resolve
> before the interface address and routes are added - but that doesn't
> seem possible since dhclient-exit-hoks is only invoked by
> dhclient-script after the configuration is completed - and the code n
> dhclient-exit-hooks only executes on a condition that is guaranteed to
> have set up the interface, added a route, and updated resolv.conf. Since
> I see no output from the script as it is run when the interface comes
> up, I can't be sure if that block of code is ever executed.
>=20
> Ideas? Suggestions?
>=20
> For context, the hooks are necessary to set the machine's hostname to a
> valid string for the ip - my isp (cox cable) does not do ddns with a
> sent host-name, nor does its dhcp server provide a host-name or fqdn on
> request.
>=20
>=20
> -Reid
>=20
> dhclient-exit-hooks
> --------------------------------------------
> #!/bin/sh
> PATH=3D/bin:/sbin:/usr/bin
> AWK=3D/usr/bin/awk
> HOST=3D/usr/bin/host
> echo "reason is $reason and ip is $new_ip_address"
> case $reason in
> BOUND|RENEW|REBIND|REBOOT)
>  if [ x$new_host_name !=3D x ]; then
>   if [ x$new_domain_name !=3D x ]; then
>     hostname $new_host_name.$new_domain_name
>     echo New Hostname: $new_host_name.$new_domain_name
>   else
>     hostname $new_host_name
>     echo New Hostname: $new_host_name
>   fi
>  else
>   hostname=3D`$HOST $new_ip_address | $AWK '{print $5}'`
>   hostname $hostname
>   echo New Hostname: $hostname
>  fi
> ;;
> esac
> exit $1

Why on earth are you exiting with $1 as the status?  This is almost
certainly the problem.  You should not exit from dhclient-exit-hooks
at all since it occurs in the context of dhclient-script and this exit
values is entirely bogus.

-- Brooks

--=20
Any statement of the form "X is the one, true Y" is FALSE.
PGP fingerprint 655D 519C 26A7 82E7 2529  9BF0 5D8E 8BE9 F238 1AD4

--AhhlLboLdkugWU4S
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDVHsOXY6L6fI4GtQRAibtAKC7hRC7YbejKs+LtRyOLba4Nw8gyACgj+PF
mDi1UWaJhvJhychlRSrhYRk=
=Xgqt
-----END PGP SIGNATURE-----

--AhhlLboLdkugWU4S--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051018043319.GA9748>