#667647 isc-dhcp-client: man dhcp-options is wrong about the client behaviour on option host-name

Package:
isc-dhcp-client
Source:
isc-dhcp
Description:
DHCP client for automatically obtaining an IP address
Submitter:
Helmut Grohne
Date:
2026-08-05 17:33:46 UTC
Severity:
normal
#667647#5
Date:
2012-04-05 16:14:10 UTC
From:
To:
The following is a quote from man dhcp-options.

| option host-name string;
|
| This option specifies the name of the client.  The name may or may not
| be qualified with the local domain name (it is preferable to use the
| domain-name option to specify the domain name).  See RFC 1035 for
| character set restrictions.  This option is only honored by
| dhclient-script(8) if the hostname for the client machine is not set.

Unfortunately the last sentence is subtly wrong. To see why we need to
look at /sbin/dhclient-script.

| set_hostname() {
|     local current_hostname
|
|     if [ -n "$new_host_name" ]; then
|         current_hostname=$(hostname)
|
|         # current host name is empty, '(none)' or 'localhost' or differs from new one from DHCP
|         if [ -z "$current_hostname" ] ||
|            [ "$current_hostname" = '(none)' ] ||
|            [ "$current_hostname" = 'localhost' ] ||
|            [ "$current_hostname" = "$old_host_name" ]; then
|            if [ "$new_host_name" != "$old_host_name" ]; then
|                hostname "$new_host_name"
|            fi
|         fi
|     fi
| }

So old_host_name and new_host_name are controlled by the atta^Wdhcp
server. To reproduce set up a client machine running isc-dhcp-client
named foo and a server running isc-dhcp-server. The server configuration
should contain the following lines.

| host foo {
| 	hardware ethernet 11:22:33:44:55:66; # replace with foo's mac address
| 	option host-name "foo";
| }

Now machine foo runs dhclient and obtains a lease. It then releases the
lease. Now change the option host-name to "bar". The client machine now
runs dhclient again. In this second run old_host_name matches
current_hostname, so it really updates the system hostname. And this is
where the documentation is wrong.

I suggest extending the last sentence to the following sentence.

| This option is only honored by dhclient-script(8) if the hostname for
| the client machine is not set or the dhcp server has previously sent
| the hostname of the client machine and now sends a different name.

If on the other hand the current behaviour is not desired, I suggest
changing the dhclient-script to remove the || [ "$current_hostname" =
"$old_host_name" ] check to match the description of the documentation.

Thanks

Helmut

#667647#10
Date:
2020-07-01 14:26:36 UTC
From:
To:
Dear,

Did you receive the message i sent to you?

Regards,
Peter Joe

#667647#15
Date:
2026-08-05 17:31:09 UTC
From:
To:
Dear submitter,

as the package isc-dhcp has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/1143544

The version of this package that was in Debian prior to this removal
can still be found using https://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Thorsten Alteholz (the ftpmaster behind the curtain)