From a80b00a38e93c31b2070740562fbe5a19544c513 Mon Sep 17 00:00:00 2001 From: Antonio Huete Jimenez Date: Sat, 2 Aug 2014 14:04:09 +0200 Subject: [PATCH] dhclient - 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. Taken-from: OpenBSD --- sbin/dhclient/dhclient.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index d79fca4e24..12a7677b4e 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.154 2012/09/01 19:02:27 krw Exp $ */ +/* $OpenBSD: src/sbin/dhclient/dhclient.c,v 1.155 2012/09/17 20:30:17 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -238,6 +238,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; @@ -256,7 +260,9 @@ routehandler(void) die: script_init("FAIL"); + script_write_params("old_", client->active); script_go(); + sleep(2); error("routehandler: %s", errmsg); } -- 2.41.0