summaryrefslogtreecommitdiff
path: root/sbin/dhclient/kroute.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2013-02-21 14:10:23 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2013-02-21 14:10:23 +0000
commit5686ae8eaac23512eb7e7edac52432d667cfaf22 (patch)
tree54ac161b623907e51deb766a4b724c02c703356d /sbin/dhclient/kroute.c
parent1c8050996a8e245a63b39b3a6b3cff90b9dfff3b (diff)
Use imsg_flush() to force delivery of IMSG_DELETE_ADDRESS to
privileged process. This ensures a quicker exit of any previous copy of dhclient. Prodded by deraadt@
Diffstat (limited to 'sbin/dhclient/kroute.c')
-rw-r--r--sbin/dhclient/kroute.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c
index 12ee0ff4efe..9a73434bf07 100644
--- a/sbin/dhclient/kroute.c
+++ b/sbin/dhclient/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.37 2013/02/18 22:10:04 krw Exp $ */
+/* $OpenBSD: kroute.c,v 1.38 2013/02/21 14:10:22 krw Exp $ */
/*
* Copyright 2012 Kenneth R Westerback <krw@openbsd.org>
@@ -393,9 +393,13 @@ delete_address(char *ifname, int rdomain, struct in_addr addr)
rslt = imsg_compose(unpriv_ibuf, IMSG_DELETE_ADDRESS, 0, 0 , -1, &imsg,
sizeof(imsg));
-
if (rslt == -1)
warning("delete_address: imsg_compose: %s", strerror(errno));
+
+ /* Do flush to quickly kill previous dhclient, if any. */
+ rslt = imsg_flush(unpriv_ibuf);
+ if (rslt == -1 && errno != EPIPE)
+ warning("delete_address: imsg_flush: %s", strerror(errno));
}
void