[klibc] [klibc:master] ipconfig: Ignore NTP server address and any additional fields

klibc-bot for Ben Hutchings ben at decadent.org.uk
Wed Dec 11 10:00:06 PST 2019


Commit-ID:  56dcdac0ffc1d86d196a1d04933288b0c0ef8417
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=56dcdac0ffc1d86d196a1d04933288b0c0ef8417
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Wed, 11 Dec 2019 17:38:21 +0000
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Wed, 11 Dec 2019 17:48:47 +0000

[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 at decadent.org.uk>

---
 usr/kinit/ipconfig/README.ipconfig |  9 +++++++--
 usr/kinit/ipconfig/main.c          | 10 +++-------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/usr/kinit/ipconfig/README.ipconfig b/usr/kinit/ipconfig/README.ipconfig
index 10405d3e..5ee87e56 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 2c905986..5472d0f0 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;
 			}
 		}
 	}


More information about the klibc mailing list