Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jul 2000 12:12:41 -0400 (EDT)
From:      adrian@ubergeeks.com
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   misc/19673: dhclient-script not setting hostname after a reboot bug (w/patch)
Message-ID:  <200007031612.MAA00552@cluebie.esolstice.int>

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

>Number:         19673
>Category:       misc
>Synopsis:       dhclient-script will not always set the hostname after a reboot
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 03 09:10:01 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Adrian Filipi-Martin
>Release:        FreeBSD 4.0-STABLE i386
>Organization:
Ubergeeks Consulting
>Environment:

	4-STABLE from 06/29/00.

>Description:

	The first time a system is booted using dhclient, the
	acquired lease information is written to /var/db/dhclient.leases.
	The next time the system is rebooted, dhclient will use
	these values to initialized the old_* variables when running
	the dhclient-script.  If the hostname does not change
	bewteen reboots, the lease file is not removed or the lease
	does not expire, there is a logic bug that will cause
	dhclient to not set the hostname at all.

>How-To-Repeat:

	Do not set hostname in /etc/rc.conf, then boot using DHCP with a
	statically configured hostname/MAC/IP set up on the DHCP server.
	Reboot again and make sure your system recieved the same hostname
	info from the lease as before.  The hostname will not be set even
	though the IP and other info was.

>Fix:

	Apply the the included patch for dhclient-script as follows:

	cd /src/contrib/isc-dhcp/client/scripts
	patch freebsd < /tmp/dhcp-script.diff

	N.B.  Since dhclient is built from contributed sources, I
	am sending the patch to ISC as well so that they can include
	it in the base distribution.

--- dhclient-script.orig	Thu Jun 29 11:45:43 2000
+++ dhclient-script	Mon Jul  3 11:53:19 2000
@@ -78,7 +78,8 @@
   current_hostname=`/bin/hostname`
   if [ x$current_hostname = x ] || \
      [ x$current_hostname = x$old_host_name ]; then
-    if [ x$new_host_name != x$old_host_name ]; then
+    if [ x$new_host_name != x$old_host_name ] || \
+       [ x$new_host_name != x$current_hostname ]; then
       $LOGGER "New Hostname: $new_host_name"
       hostname $new_host_name
     fi


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




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