From 36d0fad797f1b9763901819091af63ec788ce421 Mon Sep 17 00:00:00 2001 From: Amos Waterland Date: Sat, 5 Jan 2008 23:23:06 -0800 Subject: [PATCH] --- yaml --- r: 75318 b: refs/heads/master c: 92ffb85dd33d62ac1dad8b44da62365f2aad413d h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/Documentation/nfsroot.txt | 1 + trunk/net/ipv4/ipconfig.c | 22 ++++++++++++++++++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index da72fad667a8..41fa10737b62 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f844c74fe07321953e2dd227fe35280075f18f60 +refs/heads/master: 92ffb85dd33d62ac1dad8b44da62365f2aad413d diff --git a/trunk/Documentation/nfsroot.txt b/trunk/Documentation/nfsroot.txt index c86dd38e2281..31b329172343 100644 --- a/trunk/Documentation/nfsroot.txt +++ b/trunk/Documentation/nfsroot.txt @@ -145,6 +145,7 @@ ip=:::::: 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/trunk/net/ipv4/ipconfig.c b/trunk/net/ipv4/ipconfig.c index 56a675734ea5..b8f7763b2261 100644 --- a/trunk/net/ipv4/ipconfig.c +++ b/trunk/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; } }