aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ipconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ipconfig.c')
-rw-r--r--net/ipv4/ipconfig.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 96400b0bd08a..b8f7763b2261 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -1403,6 +1403,9 @@ static int __init ic_proto_name(char *name)
1403 if (!strcmp(name, "on") || !strcmp(name, "any")) { 1403 if (!strcmp(name, "on") || !strcmp(name, "any")) {
1404 return 1; 1404 return 1;
1405 } 1405 }
1406 if (!strcmp(name, "off") || !strcmp(name, "none")) {
1407 return 0;
1408 }
1406#ifdef CONFIG_IP_PNP_DHCP 1409#ifdef CONFIG_IP_PNP_DHCP
1407 else if (!strcmp(name, "dhcp")) { 1410 else if (!strcmp(name, "dhcp")) {
1408 ic_proto_enabled &= ~IC_RARP; 1411 ic_proto_enabled &= ~IC_RARP;
@@ -1436,17 +1439,24 @@ static int __init ip_auto_config_setup(char *addrs)
1436 int num = 0; 1439 int num = 0;
1437 1440
1438 ic_set_manually = 1; 1441 ic_set_manually = 1;
1442 ic_enable = 1;
1439 1443
1440 ic_enable = (*addrs && 1444 /*
1441 (strcmp(addrs, "off") != 0) && 1445 * If any dhcp, bootp etc options are set, leave autoconfig on
1442 (strcmp(addrs, "none") != 0)); 1446 * and skip the below static IP processing.
1443 if (!ic_enable) 1447 */
1448 if (ic_proto_name(addrs))
1444 return 1; 1449 return 1;
1445 1450
1446 if (ic_proto_name(addrs)) 1451 /* If no static IP is given, turn off autoconfig and bail. */
1452 if (*addrs == 0 ||
1453 strcmp(addrs, "off") == 0 ||
1454 strcmp(addrs, "none") == 0) {
1455 ic_enable = 0;
1447 return 1; 1456 return 1;
1457 }
1448 1458
1449 /* Parse the whole string */ 1459 /* Parse string for static IP assignment. */
1450 ip = addrs; 1460 ip = addrs;
1451 while (ip && *ip) { 1461 while (ip && *ip) {
1452 if ((cp = strchr(ip, ':'))) 1462 if ((cp = strchr(ip, ':')))
@@ -1484,7 +1494,10 @@ static int __init ip_auto_config_setup(char *addrs)
1484 strlcpy(user_dev_name, ip, sizeof(user_dev_name)); 1494 strlcpy(user_dev_name, ip, sizeof(user_dev_name));
1485 break; 1495 break;
1486 case 6: 1496 case 6:
1487 ic_proto_name(ip); 1497 if (ic_proto_name(ip) == 0 &&
1498 ic_myaddr == NONE) {
1499 ic_enable = 0;
1500 }
1488 break; 1501 break;
1489 } 1502 }
1490 } 1503 }