Dimitri John Ledkov
2019-Jun-13 09:21 UTC
[klibc] [PATCH] 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 at ubuntu.com> --- usr/kinit/ipconfig/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/usr/kinit/ipconfig/main.c b/usr/kinit/ipconfig/main.c index a454022e..2c905986 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; } } } -- 2.20.1
Apparently Analagous Threads
- [klibc:master] ipconfig: Implement support -d ...:dns0:dns1 options
- [klibc:master] ipconfig: Ignore NTP server address and any additional fields
- [klibc:master] ipconfig: Implement classless static routes
- [PATCH v3 1/2] Implement classless static routes
- [PATCH] ipconfig: Implement support -d ...:dns0:dns1 options