From: Roy Marples Date: Fri, 24 Oct 2014 09:14:16 +0000 (+0000) Subject: Fix transition from IPv4LL to a valid DHCP state. X-Git-Tag: v6.6.0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4d1491e53b650155bf696a7d9c086720d2c2e710;p=thirdparty%2Fdhcpcd.git Fix transition from IPv4LL to a valid DHCP state. --- diff --git a/dhcp.c b/dhcp.c index 2b7a9428..2207b9e5 100644 --- a/dhcp.c +++ b/dhcp.c @@ -1949,7 +1949,11 @@ dhcp_bind(struct interface *ifp, struct arp_state *astate) " seconds", ifp->name, lease->renewaltime, lease->rebindtime); } - state->state = DHS_BOUND; + if (!(ifo->options & DHCPCD_STATIC) && + state->new->cookie != htonl(MAGIC_COOKIE)) + state->state = DHS_IPV4LL_BOUND; + else + state->state = DHS_BOUND; if (!state->lease.frominfo && !(ifo->options & (DHCPCD_INFORM | DHCPCD_STATIC))) if (write_lease(ifp, state->new) == -1) @@ -2525,7 +2529,8 @@ dhcp_handledhcp(struct interface *iface, struct dhcp_message **dhcpp, iface->name, msg); free(msg); } - if (state->state == DHS_DISCOVER && + if ((state->state == DHS_DISCOVER || + state->state == DHS_IPV4LL_BOUND) && get_option_uint8(iface->ctx, &tmp, dhcp, DHO_AUTOCONFIGURE) == 0) { @@ -2586,7 +2591,7 @@ dhcp_handledhcp(struct interface *iface, struct dhcp_message **dhcpp, } if ((type == 0 || type == DHCP_OFFER) && - state->state == DHS_DISCOVER) + (state->state == DHS_DISCOVER || state->state == DHS_IPV4LL_BOUND)) { lease->frominfo = 0; lease->addr.s_addr = dhcp->yiaddr; diff --git a/dhcp.h b/dhcp.h index 0c05a485..d78ff4f7 100644 --- a/dhcp.h +++ b/dhcp.h @@ -196,7 +196,7 @@ enum DHS { DHS_REBOOT, DHS_INFORM, DHS_RENEW_REQUESTED, - DHS_INIT_IPV4LL, + DHS_IPV4LL_BOUND, DHS_PROBE }; diff --git a/ipv4ll.c b/ipv4ll.c index 757ad24b..b4cb14f4 100644 --- a/ipv4ll.c +++ b/ipv4ll.c @@ -138,9 +138,6 @@ ipv4ll_conflicted(struct arp_state *astate, const struct arp_msg *amsg) struct dhcp_state *state = D_STATE(astate->iface); in_addr_t fail; - if (state->offer == NULL) - return; - fail = 0; /* RFC 3927 2.2.1, Probe Conflict Detection */ if (amsg->sip.s_addr == astate->addr.s_addr ||