summaryrefslogtreecommitdiff
path: root/sbin/dhclient/dispatch.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2017-04-05 18:22:32 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2017-04-05 18:22:32 +0000
commitd44e6b45ccf0e79cbf0f1e3f55b8bc47cc8950e2 (patch)
tree89078ac59a8261ac1eee1748cc002b914fa183be /sbin/dhclient/dispatch.c
parent2a24af8706127913d791cf1272a14317d01608a6 (diff)
Shuffle sendhup() into dispatch.c, the only place it is used.
Diffstat (limited to 'sbin/dhclient/dispatch.c')
-rw-r--r--sbin/dhclient/dispatch.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/sbin/dhclient/dispatch.c b/sbin/dhclient/dispatch.c
index 2165c0f19f2..0361c3de511 100644
--- a/sbin/dhclient/dispatch.c
+++ b/sbin/dhclient/dispatch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dispatch.c,v 1.118 2017/04/04 15:15:48 krw Exp $ */
+/* $OpenBSD: dispatch.c,v 1.119 2017/04/05 18:22:30 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -73,6 +73,7 @@
struct dhcp_timeout timeout;
void packethandler(struct interface_info *ifi);
+void sendhup(struct client_lease *);
void
get_hw_address(struct interface_info *ifi)
@@ -338,3 +339,25 @@ get_rdomain(char *name)
close(s);
return rv;
}
+
+/*
+ * Inform the [priv] process a HUP was received and it should restart.
+ */
+void
+sendhup(struct client_lease *active)
+{
+ struct imsg_hup imsg;
+ int rslt;
+
+ if (active)
+ imsg.addr = active->address;
+ else
+ imsg.addr.s_addr = INADDR_ANY;
+
+ rslt = imsg_compose(unpriv_ibuf, IMSG_HUP, 0, 0, -1,
+ &imsg, sizeof(imsg));
+ if (rslt == -1)
+ log_warn("sendhup: imsg_compose");
+
+ flush_unpriv_ibuf("sendhup");
+}