summaryrefslogtreecommitdiff
path: root/sbin/dhclient/kroute.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-02-18 15:57:09 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-02-18 15:57:09 +0000
commit7ff2a33f379288f213d7cb15f7fcc42d00a4a944 (patch)
tree60c5caef0f66b3cb95cc7c50aa061fa0e2587a8c /sbin/dhclient/kroute.c
parentdb294c686ab28b18455805547d2aa0a8f3ca8516 (diff)
Rework log messages to be more useful. Rename
IMGS_CLEANUP/imsg_cleanup/cleanup to IMSG_HUP/imsg_hup/sendhup to more accurately reflect intent of causing the privileged process to initiate restart. There should now be one and only one message logged at termination or restart, logged by the process initiating the termination or restart. As part of fixing this, remove duplicate cleanup attempts and exit after sending IMSG_HUP. These make logged messages more consistant and fix issues with incorrect cleanups. More prodding from deraadt@
Diffstat (limited to 'sbin/dhclient/kroute.c')
-rw-r--r--sbin/dhclient/kroute.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index 36eab14e4e0..fa184c6d329 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.35 2013/02/17 17:36:31 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.36 2013/02/18 15:57:08 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -655,12 +655,12 @@ priv_add_address(struct imsg_add_address *imsg)
}
/*
- * [priv_]cleanup removes dhclient installed routes and address.
+ * Inform the [priv] process a HUP was received and it should restart.
*/
void
-cleanup(struct client_lease *active)
+sendhup(struct client_lease *active)
{
- struct imsg_cleanup imsg;
+ struct imsg_hup imsg;
int rslt;
memset(&imsg, 0, sizeof(imsg));
@@ -670,7 +670,7 @@ cleanup(struct client_lease *active)
if (active)
imsg.addr = active->address;
- rslt = imsg_compose(unpriv_ibuf, IMSG_CLEANUP, 0, 0, -1,
+ rslt = imsg_compose(unpriv_ibuf, IMSG_HUP, 0, 0, -1,
&imsg, sizeof(imsg));
if (rslt == -1)
warning("cleanup: imsg_compose: %s", strerror(errno));
@@ -681,8 +681,11 @@ cleanup(struct client_lease *active)
warning("cleanup: imsg_flush: %s", strerror(errno));
}
+/*
+ * priv_cleanup removes dhclient installed routes and address.
+ */
void
-priv_cleanup(struct imsg_cleanup *imsg)
+priv_cleanup(struct imsg_hup *imsg)
{
struct imsg_flush_routes fimsg;
struct imsg_delete_address dimsg;