All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipconfig: send host-name in DHCP requests
@ 2010-05-31  3:19 Wu Fengguang
  2010-06-02 14:05 ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Wu Fengguang @ 2010-05-31  3:19 UTC (permalink / raw)
  To: David S. Miller, netdev; +Cc: LKML, Andi Kleen

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>
---
 net/ipv4/ipconfig.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 067ce9e..db54343 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -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);
-- 
1.6.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipconfig: send host-name in DHCP requests
  2010-05-31  3:19 [PATCH] ipconfig: send host-name in DHCP requests Wu Fengguang
@ 2010-06-02 14:05 ` David Miller
  2010-06-02 18:56   ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2010-06-02 14:05 UTC (permalink / raw)
  To: fengguang.wu; +Cc: netdev, linux-kernel, andi

From: Wu Fengguang <fengguang.wu@intel.com>
Date: Mon, 31 May 2010 11:19:53 +0800

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipconfig: send host-name in DHCP requests
  2010-06-02 14:05 ` David Miller
@ 2010-06-02 18:56   ` Andi Kleen
  2010-06-03  2:02     ` [PATCH] ipconfig: document DHCP hostname and DNS record Wu Fengguang
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2010-06-02 18:56 UTC (permalink / raw)
  To: David Miller; +Cc: fengguang.wu, netdev, linux-kernel, andi

On Wed, Jun 02, 2010 at 07:05:31AM -0700, David Miller wrote:
> From: Wu Fengguang <fengguang.wu@intel.com>
> Date: Mon, 31 May 2010 11:19:53 +0800
> 
> > 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>
> 
> Applied, thanks.

Small nit: Fengguang, please document the new option in 
Documentation/kernel-parameters.txt That could be done in a follow-on patch.

-Andi
> 

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] ipconfig: document DHCP hostname and DNS record
  2010-06-02 18:56   ` Andi Kleen
@ 2010-06-03  2:02     ` Wu Fengguang
  2010-06-03 10:20       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Wu Fengguang @ 2010-06-03  2:02 UTC (permalink / raw)
  To: Andi Kleen; +Cc: David Miller, netdev, linux-kernel

On Thu, Jun 03, 2010 at 02:56:01AM +0800, Andi Kleen wrote:
> On Wed, Jun 02, 2010 at 07:05:31AM -0700, David Miller wrote:
> > From: Wu Fengguang <fengguang.wu@intel.com>
> > Date: Mon, 31 May 2010 11:19:53 +0800
> > 
> > > 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>
> > 
> > Applied, thanks.
> 
> Small nit: Fengguang, please document the new option in 
> Documentation/kernel-parameters.txt That could be done in a follow-on patch.

Good suggestion! Here is the document update.

Thanks,
Fengguang
---
ipconfig: document DHCP hostname and DNS record

Now it's possible to update the DNS record for $HOST_NAME with

	ip=::::$HOST_NAME::dhcp

CC: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 Documentation/filesystems/nfs/nfsroot.txt |    2 ++
 1 file changed, 2 insertions(+)

--- linux.orig/Documentation/filesystems/nfs/nfsroot.txt	2010-06-03 09:52:17.000000000 +0800
+++ linux/Documentation/filesystems/nfs/nfsroot.txt	2010-06-03 09:52:19.000000000 +0800
@@ -124,6 +124,8 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netm
 
   <hostname>	Name of the client. May be supplied by autoconfiguration,
   		but its absence will not trigger autoconfiguration.
+		If specified and DHCP is used, the user provided hostname will
+		be carried in the DHCP request to hopefully update DNS record.
 
   		Default: Client IP address is used in ASCII notation.
 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipconfig: document DHCP hostname and DNS record
  2010-06-03  2:02     ` [PATCH] ipconfig: document DHCP hostname and DNS record Wu Fengguang
@ 2010-06-03 10:20       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-06-03 10:20 UTC (permalink / raw)
  To: fengguang.wu; +Cc: andi, netdev, linux-kernel

From: Wu Fengguang <fengguang.wu@intel.com>
Date: Thu, 3 Jun 2010 10:02:44 +0800

> ipconfig: document DHCP hostname and DNS record
> 
> Now it's possible to update the DNS record for $HOST_NAME with
> 
> 	ip=::::$HOST_NAME::dhcp
> 
> CC: Andi Kleen <ak@linux.intel.com>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-03 10:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-31  3:19 [PATCH] ipconfig: send host-name in DHCP requests Wu Fengguang
2010-06-02 14:05 ` David Miller
2010-06-02 18:56   ` Andi Kleen
2010-06-03  2:02     ` [PATCH] ipconfig: document DHCP hostname and DNS record Wu Fengguang
2010-06-03 10:20       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.