From: Roy Marples Date: Tue, 23 Jun 2015 08:34:56 +0000 (+0000) Subject: Remove redundant IPv4LL checks X-Git-Tag: v6.9.1~35 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09c6388bf7bd623615c831f28d7e3a2214263fb3;p=thirdparty%2Fdhcpcd.git Remove redundant IPv4LL checks --- diff --git a/dhcp.c b/dhcp.c index 91fc283e..56a3859a 100644 --- a/dhcp.c +++ b/dhcp.c @@ -2101,11 +2101,7 @@ dhcp_bind(struct interface *ifp, struct arp_state *astate) " seconds", ifp->name, lease->renewaltime, lease->rebindtime); } - if (!(ifo->options & DHCPCD_STATIC) && - state->new->cookie != htonl(MAGIC_COOKIE)) - state->state = DHS_IPV4LL_BOUND; - else - state->state = DHS_BOUND; + state->state = DHS_BOUND; if (!state->lease.frominfo && !(ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC))) if (write_lease(ifp, state->new) == -1) @@ -2338,16 +2334,6 @@ dhcp_drop(struct interface *ifp, const char *reason) eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); return; } - /* Don't reset DHCP state if we have an IPv4LL address and link is up, - * unless the interface is departing. */ - if (state->state != DHS_IPV4LL_BOUND || - ifp->carrier != LINK_UP || - ifp->options->options & DHCPCD_DEPARTED) - { - eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); - dhcp_auth_reset(&state->auth); - dhcp_close(ifp); - } if (ifp->options->options & DHCPCD_RELEASE) { unlink(state->leasefile); @@ -2368,6 +2354,10 @@ dhcp_drop(struct interface *ifp, const char *reason) } } + eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); + dhcp_auth_reset(&state->auth); + dhcp_close(ifp); + free(state->old); state->old = state->new; state->new = NULL; @@ -2655,8 +2645,7 @@ dhcp_handledhcp(struct interface *ifp, struct dhcp_message **dhcpp, "%s: message: %s", ifp->name, msg); free(msg); } - if ((state->state == DHS_DISCOVER || - state->state == DHS_IPV4LL_BOUND) && + if (state->state == DHS_DISCOVER && get_option_uint8(ifp->ctx, &tmp, dhcp, DHO_AUTOCONFIGURE) == 0) { @@ -2710,9 +2699,7 @@ dhcp_handledhcp(struct interface *ifp, struct dhcp_message **dhcpp, } #endif - if ((type == 0 || type == DHCP_OFFER) && - (state->state == DHS_DISCOVER || state->state == DHS_IPV4LL_BOUND)) - { + if ((type == 0 || type == DHCP_OFFER) && state->state == DHS_DISCOVER) { lease->frominfo = 0; lease->addr.s_addr = dhcp->yiaddr; lease->cookie = dhcp->cookie; diff --git a/dhcp.h b/dhcp.h index 8c962788..c7dba9d8 100644 --- a/dhcp.h +++ b/dhcp.h @@ -194,9 +194,7 @@ enum DHS { DHS_REBIND, DHS_REBOOT, DHS_INFORM, - DHS_RENEW_REQUESTED, - DHS_IPV4LL_BOUND, - DHS_PROBE + DHS_RENEW_REQUESTED }; struct dhcp_state {