--- netcfg-1.46ubuntu1/dhcp.c 2008-09-16 10:57:59.000000000 +0000 +++ netcfg-1.46ep1/dhcp.c 2009-04-29 14:02:27.000000000 +0000 @@ -388,21 +388,21 @@ } /* - * Default to the hostname returned via DHCP, if any, - * otherwise to the requested DHCP hostname - * otherwise to the hostname found in DNS for the IP address + * Default to the the requested DHCP hostname, if any, + * otherwise to the hostname returned via DHCP + * otherwise to the hostname found in DNS for the IP address * of the interface */ - if (gethostname(buf, sizeof(buf)) == 0 + if (dhostname) { + debconf_set(client, "netcfg/get_hostname", dhostname); + } + else if (gethostname(buf, sizeof(buf)) == 0 && !empty_str(buf) && strcmp(buf, "(none)") && verify_hostname(buf) == 0 ) { di_info("DHCP hostname: \"%s\"", buf); debconf_set(client, "netcfg/get_hostname", buf); - } - else if (dhostname) { - debconf_set(client, "netcfg/get_hostname", dhostname); } else { struct ifreq ifr; struct in_addr d_ipaddr = { 0 };