dhclient chokes on dhclient-exit-hooks
Brooks Davis
brooks at one-eyed-alien.net
Mon Oct 17 21:33:21 PDT 2005
On Mon, Oct 17, 2005 at 09:38:25PM -0500, Reid Linnemann wrote:
>
> 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.
>
> 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.
>
> Currently, on the console, only one line of output comes from the script:
> `reason is PREINIT and ip is `
>
> The last output from dhclient is:
> `DHCPACK from <ip>`
>
> 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.
>
> If I remove dhclient-exit-hooks, the lease is acquired and the interface
> is brought up normally.
>
> 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.
>
> Ideas? Suggestions?
>
> 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.
>
>
> -Reid
>
> dhclient-exit-hooks
> --------------------------------------------
> #!/bin/sh
> PATH=/bin:/sbin:/usr/bin
> AWK=/usr/bin/awk
> HOST=/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 != x ]; then
> if [ x$new_domain_name != 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=`$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
--
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20051017/fe56280a/attachment.bin
More information about the freebsd-current
mailing list