mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Update ip command line processing
@ 2007-12-18  8:57 Simon Horman
  2007-12-20 23:21 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Horman @ 2007-12-18  8:57 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: Amos Waterland, David Miller

Recently the documentation in Documentation/nfsroot.txt was
update to note that in fact ip=off and ip=::::::off as the
latter is ignored and the default (on) is used.

This was certainly a step in the direction of reducing confusion.
But it seems to me that the code ought to be fixed up so that
ip=::::::off actually turns off ip autoconfiguration.

This patch also notes more specifically that ip=on (aka ip=::::::on)
is the default.

Cc: Amos Waterland <apw@us.ibm.com>
Signed-off-by: Simon Horman <horms@verge.net.au>

Index: net-2.6.25/net/ipv4/ipconfig.c
===================================================================
--- net-2.6.25.orig/net/ipv4/ipconfig.c	2007-12-18 17:45:07.000000000 +0900
+++ net-2.6.25/net/ipv4/ipconfig.c	2007-12-18 17:45:52.000000000 +0900
@@ -1414,9 +1414,16 @@ late_initcall(ip_auto_config);
  */
 static int __init ic_proto_name(char *name)
 {
+	if (!name) {
+		return 1;
+	}
 	if (!strcmp(name, "on") || !strcmp(name, "any")) {
 		return 1;
 	}
+	if (!strcmp(name, "off") || !strcmp(name, "none")) {
+		ic_enable = 0;
+		return 1;
+	}
 #ifdef CONFIG_IP_PNP_DHCP
 	else if (!strcmp(name, "dhcp")) {
 		ic_proto_enabled &= ~IC_RARP;
@@ -1451,12 +1458,6 @@ static int __init ip_auto_config_setup(c
 
 	ic_set_manually = 1;
 
-	ic_enable = (*addrs &&
-		(strcmp(addrs, "off") != 0) &&
-		(strcmp(addrs, "none") != 0));
-	if (!ic_enable)
-		return 1;
-
 	if (ic_proto_name(addrs))
 		return 1;
 
Index: net-2.6.25/Documentation/nfsroot.txt
===================================================================
--- net-2.6.25.orig/Documentation/nfsroot.txt	2007-12-18 17:46:47.000000000 +0900
+++ net-2.6.25/Documentation/nfsroot.txt	2007-12-18 17:48:51.000000000 +0900
@@ -97,10 +97,6 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netm
   autoconfiguration will take place.  The most common way to use this
   is "ip=dhcp".
 
-  Note that "ip=off" is not the same thing as "ip=::::::off", because in
-  the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
-  are compiled in the kernel.
-
   <client-ip>	IP address of the client.
 
   		Default:  Determined using autoconfiguration.
@@ -150,6 +146,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netm
 
                   off or none: don't use autoconfiguration
 		  on or any:   use any protocol available in the kernel
+			       (default)
 		  dhcp:        use DHCP
 		  bootp:       use BOOTP
 		  rarp:        use RARP

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

* Re: Update ip command line processing
  2007-12-18  8:57 Update ip command line processing Simon Horman
@ 2007-12-20 23:21 ` David Miller
  2007-12-21  1:32   ` Simon Horman
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2007-12-20 23:21 UTC (permalink / raw)
  To: horms; +Cc: linux-kernel, netdev, apw

From: Simon Horman <horms@verge.net.au>
Date: Tue, 18 Dec 2007 17:57:32 +0900

> @@ -1414,9 +1414,16 @@ late_initcall(ip_auto_config);
>   */
>  static int __init ic_proto_name(char *name)
>  {
> +	if (!name) {
> +		return 1;
> +	}

I do not see any circumstance under which this pointer can
be NULL.  Judging by your other changes, I think you mean
to use "!*name" here.

Maybe:

	if (*name == '\0')

would make it clearer what you're checking for, an
empty string.

Otherwise I'm fine with your change.

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

* Re: Update ip command line processing
  2007-12-20 23:21 ` David Miller
@ 2007-12-21  1:32   ` Simon Horman
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Horman @ 2007-12-21  1:32 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, netdev, apw

On Thu, Dec 20, 2007 at 03:21:21PM -0800, David Miller wrote:
> From: Simon Horman <horms@verge.net.au>
> Date: Tue, 18 Dec 2007 17:57:32 +0900
> 
> > @@ -1414,9 +1414,16 @@ late_initcall(ip_auto_config);
> >   */
> >  static int __init ic_proto_name(char *name)
> >  {
> > +	if (!name) {
> > +		return 1;
> > +	}
> 
> I do not see any circumstance under which this pointer can
> be NULL.  Judging by your other changes, I think you mean
> to use "!*name" here.
> 
> Maybe:
> 
> 	if (*name == '\0')
> 
> would make it clearer what you're checking for, an
> empty string.
> 
> Otherwise I'm fine with your change.

Sorry, I meant if (*name == '\0') as you suggest to replace the first
portion of:

-	ic_enable = (*addrs &&
-		(strcmp(addrs, "off") != 0) &&
-		(strcmp(addrs, "none") != 0));

I'll send an updated patch shortly.

-- 
Horms


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

end of thread, other threads:[~2007-12-21  1:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-18  8:57 Update ip command line processing Simon Horman
2007-12-20 23:21 ` David Miller
2007-12-21  1:32   ` Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®