aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2019-12-11 17:38:21 +0000
committerBen Hutchings <ben@decadent.org.uk>2019-12-11 17:48:47 +0000
commit56dcdac0ffc1d86d196a1d04933288b0c0ef8417 (patch)
tree71587e95fcb15cd6eb7937e9d450caeb34cf3540
parent607dae881e39572e0a0aa6a55a8b750a0b89165f (diff)
downloadklibc-56dcdac0ffc1d86d196a1d04933288b0c0ef8417.tar.gz
[klibc] ipconfig: Ignore NTP server address and any additional fields
ipconfig should accept any ip=/nfsaddrs= parameter that the kernel accepts. The kernel now supports a 10th field for an NTP server address, but only copies it into procfs. We must accept but ignore it. The kernel also ignores additional fields, and might define meanings to them in future. We must accept and ignore them. References: https://bugs.debian.org/931416 References: https://bugzilla.kernel.org/show_bug.cgi?id=205805 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--usr/kinit/ipconfig/README.ipconfig9
-rw-r--r--usr/kinit/ipconfig/main.c10
2 files changed, 10 insertions, 9 deletions
diff --git a/usr/kinit/ipconfig/README.ipconfig b/usr/kinit/ipconfig/README.ipconfig
index 10405d3e10b2f..5ee87e563b075 100644
--- a/usr/kinit/ipconfig/README.ipconfig
+++ b/usr/kinit/ipconfig/README.ipconfig
@@ -33,10 +33,10 @@ none no autoconfiguration - either static config, or none at all
An interface spec can be either short form, which is just the name of
an interface (eth0 or whatever), or long form. The long form consists
-of up to nine elements, separated by colons:
+of two or more fields, separated by colons:
<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>:
- <dns0-ip>:<dns1-ip>
+ <dns0-ip>:<dns1-ip>:<ntp0-ip>:...
<client-ip> IP address of the client. If empty, the address will
either be determined by RARP/BOOTP/DHCP. What protocol
@@ -85,6 +85,11 @@ of up to nine elements, separated by colons:
<dns1-ip> IP address of secondary nameserver.
See <dns0-ip>.
+ <ntp0-ip> IP address of a Network Time Protocol (NTP) server.
+ Currently ignored.
+
+ ... Additional fields will be ignored.
+
IP addresses and netmasks must be either absent (defaulting to zero)
or presented in dotted-quad notation.
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c
index 2c90598696df5..5472d0f015adb 100644
--- a/usr/kinit/ipconfig/main.c
+++ b/usr/kinit/ipconfig/main.c
@@ -611,13 +611,6 @@ static int parse_device(struct netdev *dev, char *ip)
if ((cp = strchr(ip, ':'))) {
*cp++ = '\0';
}
- if (opt > 8) {
- fprintf(stderr,
- "%s: too many options for %s\n",
- progname, dev->name);
- longjmp(abort_buf, 1);
- }
-
if (*ip == '\0')
continue;
dprintf("IP-Config: opt #%d: '%s'\n", opt, ip);
@@ -653,6 +646,9 @@ static int parse_device(struct netdev *dev, char *ip)
case 8:
parse_addr(&dev->ip_nameserver[1], ip);
break;
+ case 9:
+ /* NTP server - ignore */
+ break;
}
}
}