summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2012-09-17 20:30:18 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2012-09-17 20:30:18 +0000
commit6a29543c398264cc32dcc647b3f294c3e0d13da6 (patch)
tree29907082a4457170a8e85b1d3ebbd86179291026
parent79d9163e078bf085b994c63ae7bf596c4df665de (diff)
When a link is lost, call dhclient-script with reason "FAIL". This
does the resolv.conf dance and removes 'dead' routes, rather than leaving these droppings behind. When dhclient is exiting after calling dhclient-script with "FAIL", give the script a couple of seconds to finish. Also pass the lease parameters (old_*) to dhclient-script so routes can be cleaned up in this path too. ok beck@
-rw-r--r--sbin/dhclient/dhclient.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 484f747a474..93298b2f729 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dhclient.c,v 1.154 2012/09/01 19:02:27 krw Exp $ */
+/* $OpenBSD: dhclient.c,v 1.155 2012/09/17 20:30:17 krw Exp $ */
/*
* Copyright 2004 Henning Brauer <henning@openbsd.org>
@@ -243,6 +243,10 @@ routehandler(void)
if (ifi->linkstat) {
client->state = S_REBOOTING;
state_reboot();
+ } else if (client->active) {
+ script_init("FAIL");
+ script_write_params("old_", client->active);
+ script_go();
}
}
break;
@@ -261,7 +265,9 @@ routehandler(void)
die:
script_init("FAIL");
+ script_write_params("old_", client->active);
script_go();
+ sleep(2);
error("routehandler: %s", errmsg);
}