From: krw Date: Wed, 21 Jun 2017 15:49:27 +0000 (+0000) Subject: No need to manually check validity of ifi->active when X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=124ac52daa8ed7fe2a52a8aec45915979c37350f;p=openbsd No need to manually check validity of ifi->active when REBOOT'ing. It will be pointing to a recorded lease if anything. So rely on get_recorded_lease() to return the next valid candidate lease, which might be the lease ifi->active was pointing at. --- diff --git a/sbin/dhclient/dhclient.c b/sbin/dhclient/dhclient.c index 95111d292c1..d025cf043e9 100644 --- a/sbin/dhclient/dhclient.c +++ b/sbin/dhclient/dhclient.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhclient.c,v 1.441 2017/06/21 15:24:34 krw Exp $ */ +/* $OpenBSD: dhclient.c,v 1.442 2017/06/21 15:49:27 krw Exp $ */ /* * Copyright 2004 Henning Brauer @@ -749,25 +749,17 @@ state_preboot(struct interface_info *ifi) void state_reboot(struct interface_info *ifi) { - char ifname[IF_NAMESIZE]; - time_t cur_time; - cancel_timeout(ifi); + deleting.s_addr = INADDR_ANY; adding.s_addr = INADDR_ANY; - time(&cur_time); - if (ifi->active) { - if (ifi->active->expiry <= cur_time) - ifi->active = NULL; - else if (addressinuse(ifi, ifi->active->address, ifname) && - strncmp(ifname, ifi->name, IF_NAMESIZE) != 0) - ifi->active = NULL; - } else - ifi->active = get_recorded_lease(ifi); - - /* No active lease, or the lease is BOOTP, go straight to INIT. */ - if (!ifi->active || BOOTP_LEASE(ifi->active)) { + /* + * If there is no recorded lease or the lease is BOOTP then + * go straight to INIT and try to DISCOVER a new lease. + */ + ifi->active = get_recorded_lease(ifi); + if (ifi->active == NULL || BOOTP_LEASE(ifi->active)) { ifi->state = S_INIT; state_init(ifi); return;