diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-12-03 22:19:48 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2012-12-03 22:19:48 +0000 |
commit | 5aaf6420dfa80d7c60e4db3b822d91219cc711f1 (patch) | |
tree | 82b89f8fc996c01d58186b95281b1b1ec5b59b8c /sbin/dhclient | |
parent | eaec9eb8090f0584f61f8e0c0dc2a320936ac897 (diff) |
Cleanup after a 'ifconfig down', but stick around so 'ifconfig up'
will get a new lease without having to restart dhclient. Also tweak
cleanup() to cancel any existing timeout, so one doesn't fire between
'down' and 'up'.
Makes sense to chris@ beck@.
Diffstat (limited to 'sbin/dhclient')
-rw-r--r-- | sbin/dhclient/dhclient.c | 7 | ||||
-rw-r--r-- | sbin/dhclient/kroute.c | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 94729e622ac..d44be7867fa 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.185 2012/12/02 17:03:19 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.186 2012/12/03 22:19:47 krw Exp $ */ /* * Copyright 2004 Henning Brauer <henning@openbsd.org> @@ -229,8 +229,9 @@ routehandler(void) if (ifm->ifm_index != ifi->index) break; if ((rtm->rtm_flags & RTF_UP) == 0) { - errmsg = "interface down"; - goto die; + ifi->linkstat = 0; + cleanup(client->active); + return; } linkstat = diff --git a/sbin/dhclient/kroute.c b/sbin/dhclient/kroute.c index 8665ad44ee7..53c0d0a7b5b 100644 --- a/sbin/dhclient/kroute.c +++ b/sbin/dhclient/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.20 2012/12/02 17:03:19 krw Exp $ */ +/* $OpenBSD: kroute.c,v 1.21 2012/12/03 22:19:47 krw Exp $ */ /* * Copyright 2012 Kenneth R Westerback <krw@openbsd.org> @@ -624,12 +624,14 @@ cleanup(struct client_lease *active) struct imsg_cleanup imsg; int rslt; + cancel_timeout(); + memset(&imsg, 0, sizeof(imsg)); strlcpy(imsg.ifname, ifi->name, sizeof(imsg.ifname)); imsg.rdomain = ifi->rdomain; if (active) - imsg.addr = active->address; + delete_address(ifi->name, ifi->rdomain, active->address); rslt = imsg_compose(unpriv_ibuf, IMSG_CLEANUP, 0, 0, -1, &imsg, sizeof(imsg)); |