diff options
author | Dimitri John Ledkov <xnox@ubuntu.com> | 2019-07-17 22:18:23 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2019-07-28 20:12:38 +0100 |
commit | b86cd0ef3f225b0e68a7c49de2460829f6bfe2be (patch) | |
tree | 98f187c935e62434553110acff2f251e5603b299 | |
parent | 603f1bb024a03d9c50a89e7256ae7814292baf06 (diff) | |
download | klibc-b86cd0ef3f225b0e68a7c49de2460829f6bfe2be.tar.gz |
[klibc] ipconfig: Implement support -d ...:dns0:dns1 options
Whilst ip= command is documented to support dns0:dns1 options as
arguments 7 and 8, the -d parser in ipconfig does not. This breaks
bringing up static ip configuration with dns nameservers set in the
ip= command.
Testcase:
$ ip link add name dummy0 type dummy
$ sudo /usr/lib/klibc/bin/ipconfig -d 10.245.237.7::10.245.237.1:255.255.255.0:ottawa:dummy0:none:8.8.8.8:8.8.4.4
IP-Config: dummy0 hardware address 76:39:ca:27:9b:90 mtu 1500
IP-Config: dummy0 guessed broadcast address 10.245.237.255
IP-Config: dummy0 complete:
address: 10.245.237.7 broadcast: 10.245.237.255 netmask: 255.255.255.0
gateway: 10.245.237.1 dns0 : 8.8.8.8 dns1 : 8.8.4.4
host : ottawa
rootserver: 0.0.0.0 rootpath:
filename :
Signed-off-by: Dimitri John Ledkov <xnox@ubuntu.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | usr/kinit/ipconfig/main.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index a454022e10251..2c90598696df5 100644 --- a/usr/kinit/ipconfig/main.c +++ b/usr/kinit/ipconfig/main.c @@ -611,7 +611,7 @@ static int parse_device(struct netdev *dev, char *ip) if ((cp = strchr(ip, ':'))) { *cp++ = '\0'; } - if (opt > 6) { + if (opt > 8) { fprintf(stderr, "%s: too many options for %s\n", progname, dev->name); @@ -647,6 +647,12 @@ static int parse_device(struct netdev *dev, char *ip) case 6: dev->caps = parse_proto(ip); break; + case 7: + parse_addr(&dev->ip_nameserver[0], ip); + break; + case 8: + parse_addr(&dev->ip_nameserver[1], ip); + break; } } } |