summaryrefslogtreecommitdiffstats
path: root/sbin/dhclient
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-08-17 15:53:43 +0000
committerjhb <jhb@FreeBSD.org>2012-08-17 15:53:43 +0000
commit5acd808491df1444887ad255d323393027e99fcd (patch)
tree1016d12a1b0d826dd0ecdd804f6e7b43f413287f /sbin/dhclient
parentd521b77bda858157b90767c330e22f4946888bff (diff)
downloadFreeBSD-src-5acd808491df1444887ad255d323393027e99fcd.zip
FreeBSD-src-5acd808491df1444887ad255d323393027e99fcd.tar.gz
Fix dhclient to properly exit and teardown the configured lease when
link is lost. devd will start a new dhclient instance when link is restored. PR: bin/166656 Submitted by: Peter Jeremy (mostly) Reviewed by: brooks (earlier version from Peter) MFC after: 1 month
Diffstat (limited to 'sbin/dhclient')
-rw-r--r--sbin/dhclient/dhclient.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c
index 4f2405a..7260d3f 100644
--- a/sbin/dhclient/dhclient.c
+++ b/sbin/dhclient/dhclient.c
@@ -278,6 +278,11 @@ routehandler(struct protocol *p)
ifi->name);
goto die;
}
+ if (!interface_link_status(ifi->name)) {
+ warning("Interface %s is down, dhclient exiting",
+ ifi->name);
+ goto die;
+ }
break;
case RTM_IFANNOUNCE:
ifan = (struct if_announcemsghdr *)rtm;
@@ -316,6 +321,8 @@ routehandler(struct protocol *p)
die:
script_init("FAIL", NULL);
+ if (ifi->client->active)
+ script_write_params("old_", ifi->client->active);
if (ifi->client->alias)
script_write_params("alias_", ifi->client->alias);
script_go();
OpenPOWER on IntegriCloud