Comment 61 for bug 10239

Revision history for this message
Brent Roman (brent-mbari) wrote :

Dec. 2010; bug is still present in Mint Linux Debian Edition.
A nice way to fix this would be to modify dhclient, adding a function to its Data Expression parser called, something like, hostname that would simply return the client's hostname. Or, solve this and the whole class of related problems in one blow by adding a more generic function called shell, which would take a shell command string as its argument and return the string output to stdout as its result. With such a "shell" function, one could simply add the following to the dhclient.conf file:

send host-name = shell "hostname -s" #the -s suppresses any domain name

Such functions would be straightforward extensions. See man page dhcp-eval.5 for details on "Data Expressions". I don't understand the earlier comment that "the program doesn't work this way"

But, given that the upstream maintainers do not seem to be readily accepting patches, I have resorted to the simple hack of rewriting the dhclient.conf file just before dhclient starts.

# mv /etc/dhcp/dhclient.conf /etc/dhcp/dhclient.base
# mv /sbin/dhclient /sbin/dhclient.original
# save the attached script to /sbin/dhclient
# chmod +x /sbin/dhclient

After you do this, just remember that dhclient.conf will be rewritten. Make any configuration changes in dhclient.base instead.

If the upstream devs indicate that they are interested in accepting the Data Function patches described above, I would be willing to submit them. However, I won't investigate further until the basic idea is discussed and accepted. Otherwise, the effort is just wasting everyone's time. (mostly mine :-)