This commit is contained in:
Ori Bernstein 2019-09-06 11:57:08 -07:00
commit d1204d9b80
2 changed files with 17 additions and 4 deletions

View file

@ -155,11 +155,25 @@ dhcpinit(void)
memcpy(requested, defrequested, nrequested); 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 void
dhcpquery(int needconfig, int startstate) dhcpquery(int needconfig, int startstate)
{ {
if(needconfig) if(needconfig)
fprint(conf.cfd, "add %I %M", IPnoaddr, IPnoaddr); addnulladdr();
conf.fd = openlisten(); conf.fd = openlisten();
if(conf.fd < 0){ if(conf.fd < 0){
@ -192,8 +206,7 @@ dhcpquery(int needconfig, int startstate)
close(conf.fd); close(conf.fd);
if(needconfig) if(needconfig)
fprint(conf.cfd, "remove %I %M", IPnoaddr, IPnoaddr); removenulladdr();
} }
enum { enum {

View file

@ -806,7 +806,7 @@ catch(void*, char *msg)
{ {
if(strstr(msg, "alarm")) if(strstr(msg, "alarm"))
noted(NCONT); noted(NCONT);
noted(NDFLT); exits(msg);
} }
/* return pseudo-random integer in range low...(hi-1) */ /* return pseudo-random integer in range low...(hi-1) */