Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=92ffb85dd33d62ac1dad8b44da62365f2aad413d
Commit:     92ffb85dd33d62ac1dad8b44da62365f2aad413d
Parent:     f844c74fe07321953e2dd227fe35280075f18f60
Author:     Amos Waterland <[EMAIL PROTECTED]>
AuthorDate: Sat Jan 5 23:23:06 2008 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Tue Jan 8 23:29:58 2008 -0800

    [IPV4] ipconfig: Fix regression in ip command line processing
    
    The recent changes for ip command line processing fixed some problems
    but unfortunately broke some common usage scenarios.  In current
    2.6.24-rc6 the following command line results in no IP address
    assignment, which is surely a regression:
    
     ip=10.0.2.15::10.0.2.2:255.255.255.0::eth0:off
    
    Please find below a patch that works for all cases I can find.
    
    Signed-off-by: Amos Waterland <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 Documentation/nfsroot.txt |    1 +
 net/ipv4/ipconfig.c       |   22 ++++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/Documentation/nfsroot.txt b/Documentation/nfsroot.txt
index c86dd38..31b3291 100644
--- a/Documentation/nfsroot.txt
+++ b/Documentation/nfsroot.txt
@@ -145,6 +145,7 @@ 
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
                this option.
 
                   off or none: don't use autoconfiguration
+                               (do static IP assignment instead)
                  on or any:   use any protocol available in the kernel
                               (default)
                  dhcp:        use DHCP
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 56a6757..b8f7763 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1404,8 +1404,7 @@ static int __init ic_proto_name(char *name)
                return 1;
        }
        if (!strcmp(name, "off") || !strcmp(name, "none")) {
-               ic_enable = 0;
-               return 1;
+               return 0;
        }
 #ifdef CONFIG_IP_PNP_DHCP
        else if (!strcmp(name, "dhcp")) {
@@ -1442,10 +1441,22 @@ static int __init ip_auto_config_setup(char *addrs)
        ic_set_manually = 1;
        ic_enable = 1;
 
+       /*
+        * If any dhcp, bootp etc options are set, leave autoconfig on
+        * and skip the below static IP processing.
+        */
        if (ic_proto_name(addrs))
                return 1;
 
-       /* Parse the whole string */
+       /* If no static IP is given, turn off autoconfig and bail.  */
+       if (*addrs == 0 ||
+           strcmp(addrs, "off") == 0 ||
+           strcmp(addrs, "none") == 0) {
+               ic_enable = 0;
+               return 1;
+       }
+
+       /* Parse string for static IP assignment.  */
        ip = addrs;
        while (ip && *ip) {
                if ((cp = strchr(ip, ':')))
@@ -1483,7 +1494,10 @@ static int __init ip_auto_config_setup(char *addrs)
                                strlcpy(user_dev_name, ip, 
sizeof(user_dev_name));
                                break;
                        case 6:
-                               ic_proto_name(ip);
+                               if (ic_proto_name(ip) == 0 &&
+                                   ic_myaddr == NONE) {
+                                       ic_enable = 0;
+                               }
                                break;
                        }
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to