Bug#544513: Acknowledgement (dhcp returned hostname take precedence on netcfg/get_hostname)
bad cut and past, the full patch :
diff -Nru ./dhcp.c ../netcfg-1.47ep1/dhcp.c
--- ./dhcp.c 2008-09-16 10:57:59.000000000 +0000
+++ ../netcfg-1.47ep1/dhcp.c 2009-05-05 14:20:56.000000000 +0000
@@ -304,6 +304,8 @@
int netcfg_activate_dhcp (struct debconfclient *client)
{
char* dhostname = NULL;
+ netcfg_get_hostname (client, "netcfg/get_hostname", &dhostname, 0);
+
enum { START, POLL, ASK_OPTIONS, DHCP_HOSTNAME, HOSTNAME, DOMAIN,
HOSTNAME_SANS_NETWORK } state = START;
kill_dhcp_client();
@@ -388,21 +390,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 };
Reply to: