Skip to content

Commit a6c05c3

Browse files
hormsdavem330
authored andcommitted
[IPV4]: Fix ip command line processing.
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. Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent ecef969 commit a6c05c3

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎Documentation/nfsroot.txt‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
9797
autoconfiguration will take place. The most common way to use this
9898
is "ip=dhcp".
9999

100-
Note that "ip=off" is not the same thing as "ip=::::::off", because in
101-
the latter autoconfiguration will take place if any of DHCP, BOOTP or RARP
102-
are compiled in the kernel.
103-
104100
<client-ip> IP address of the client.
105101

106102
Default: Determined using autoconfiguration.
@@ -150,6 +146,7 @@ ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
150146

151147
off or none: don't use autoconfiguration
152148
on or any: use any protocol available in the kernel
149+
(default)
153150
dhcp: use DHCP
154151
bootp: use BOOTP
155152
rarp: use RARP

‎net/ipv4/ipconfig.c‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,6 +1403,10 @@ static int __init ic_proto_name(char *name)
14031403
if (!strcmp(name, "on") || !strcmp(name, "any")) {
14041404
return 1;
14051405
}
1406+
if (!strcmp(name, "off") || !strcmp(name, "none")) {
1407+
ic_enable = 0;
1408+
return 1;
1409+
}
14061410
#ifdef CONFIG_IP_PNP_DHCP
14071411
else if (!strcmp(name, "dhcp")) {
14081412
ic_proto_enabled &= ~IC_RARP;
@@ -1437,12 +1441,6 @@ static int __init ip_auto_config_setup(char *addrs)
14371441

14381442
ic_set_manually = 1;
14391443

1440-
ic_enable = (*addrs &&
1441-
(strcmp(addrs, "off") != 0) &&
1442-
(strcmp(addrs, "none") != 0));
1443-
if (!ic_enable)
1444-
return 1;
1445-
14461444
if (ic_proto_name(addrs))
14471445
return 1;
14481446

0 commit comments

Comments
 (0)