ipconfig: send host-name in DHCP requests
authorWu Fengguang <fengguang.wu@intel.com>
Sun, 30 May 2010 17:19:53 +0000 (17:19 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Jun 2010 14:05:03 +0000 (07:05 -0700)
Normally dhclient can be configured to send the "host-name" option
in DHCP requests to update the client's DNS record. However for an
NFSROOT system, dhclient shall never be called (which may change the
IP addr and therefore lose your root NFS mount connection).

So enable updating the DNS record with kernel parameter

ip=::::$HOST_NAME::dhcp

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipconfig.c

index b9d84e800cf4385b9d0bf51fe8aae78989d295b4..3a6e1ec5e9ae61f31d8ce77b14335bf5f56aae31 100644 (file)
@@ -665,6 +665,13 @@ ic_dhcp_init_options(u8 *options)
                memcpy(e, ic_req_params, sizeof(ic_req_params));
                e += sizeof(ic_req_params);
 
+               if (ic_host_name_set) {
+                       *e++ = 12;      /* host-name */
+                       len = strlen(utsname()->nodename);
+                       *e++ = len;
+                       memcpy(e, utsname()->nodename, len);
+                       e += len;
+               }
                if (*vendor_class_identifier) {
                        printk(KERN_INFO "DHCP: sending class identifier \"%s\"\n",
                               vendor_class_identifier);