-/* $OpenBSD: dhclient.c,v 1.445 2017/06/23 19:51:07 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.446 2017/06/24 10:09:26 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
struct pollfd pfd[1];
struct imsgbuf *priv_ibuf;
ssize_t n;
- int nfds, rslt;
+ int nfds, rslt, got_imsg_hup = 0;
switch (fork()) {
case -1:
continue;
}
- dispatch_imsg(ifi, priv_ibuf);
+ got_imsg_hup = dispatch_imsg(ifi, priv_ibuf);
+ if (got_imsg_hup)
+ quit = SIGHUP;
}
imsg_clear(priv_ibuf);
}
if (quit == SIGHUP) {
- if (!(ifi->flags & IFI_HUP))
+ if (!got_imsg_hup)
log_warnx("%s; restarting.", strsignal(quit));
signal(SIGHUP, SIG_IGN); /* will be restored after exec */
execvp(saved_argv[0], saved_argv);
-/* $OpenBSD: dhcpd.h,v 1.193 2017/06/23 19:51:07 krw Exp $ */
+/* $OpenBSD: dhcpd.h,v 1.194 2017/06/24 10:09:26 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
int rdomain;
int flags;
#define IFI_VALID_LLADDR 0x01
-#define IFI_HUP 0x04
#define IFI_IS_RESPONSIBLE 0x08
#define IFI_IN_CHARGE 0x10
struct dhcp_packet recv_packet;
-/* $OpenBSD: privsep.c,v 1.48 2017/06/23 16:18:02 krw Exp $ */
+/* $OpenBSD: privsep.c,v 1.49 2017/06/24 10:09:26 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
#include "log.h"
#include "privsep.h"
-void
+int
dispatch_imsg(struct interface_info *ifi, struct imsgbuf *ibuf)
{
struct imsg imsg;
sizeof(struct imsg_hup))
log_warnx("bad IMSG_HUP");
else {
- ifi->flags |= IFI_HUP;
- quit = SIGHUP;
+ imsg_free(&imsg);
+ return 1;
}
break;
imsg_free(&imsg);
}
+ return 0;
}
-/* $OpenBSD: privsep.h,v 1.36 2017/06/23 15:40:56 krw Exp $ */
+/* $OpenBSD: privsep.h,v 1.37 2017/06/24 10:09:26 krw Exp $ */
/*
* Copyright (c) 2004 Henning Brauer <henning@openbsd.org>
int mtu;
};
-void dispatch_imsg(struct interface_info *, struct imsgbuf *);
+int dispatch_imsg(struct interface_info *, struct imsgbuf *);
void add_direct_route(struct in_addr, struct in_addr, struct in_addr);
void add_default_route(struct in_addr, struct in_addr);