ref: d1204d9b8085634241bf5655279e54a606406cb1
parent: 27824a6c0b805cf5bd819d904d8eba186b489012
parent: 98e2ea45fb498274b4ea2af48db5c500d7614f7b
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Sep 6 07:57:08 EDT 2019
merge
--- a/sys/src/cmd/ip/ipconfig/dhcp.c
+++ b/sys/src/cmd/ip/ipconfig/dhcp.c
@@ -155,11 +155,25 @@
memcpy(requested, defrequested, nrequested);
}
+static void
+removenulladdr(void)
+{
+ fprint(conf.cfd, "remove %I %M", IPnoaddr, IPnoaddr);
+ atexitdont(removenulladdr);
+}
+
+static void
+addnulladdr(void)
+{
+ atexit(removenulladdr);
+ fprint(conf.cfd, "add %I %M", IPnoaddr, IPnoaddr);
+}
+
void
dhcpquery(int needconfig, int startstate)
{
if(needconfig)
- fprint(conf.cfd, "add %I %M", IPnoaddr, IPnoaddr);
+ addnulladdr();
conf.fd = openlisten();
if(conf.fd < 0){
@@ -192,8 +206,7 @@
close(conf.fd);
if(needconfig)
- fprint(conf.cfd, "remove %I %M", IPnoaddr, IPnoaddr);
-
+ removenulladdr();
}
enum {
--- a/sys/src/cmd/ip/ipconfig/main.c
+++ b/sys/src/cmd/ip/ipconfig/main.c
@@ -806,7 +806,7 @@
{
if(strstr(msg, "alarm"))
noted(NCONT);
- noted(NDFLT);
+ exits(msg);
}
/* return pseudo-random integer in range low...(hi-1) */