]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix transition from IPv4LL to a valid DHCP state.
authorRoy Marples <roy@marples.name>
Fri, 24 Oct 2014 09:14:16 +0000 (09:14 +0000)
committerRoy Marples <roy@marples.name>
Fri, 24 Oct 2014 09:14:16 +0000 (09:14 +0000)
dhcp.c
dhcp.h
ipv4ll.c

diff --git a/dhcp.c b/dhcp.c
index 2b7a94289497d46b402426d5247aa5909735d6ac..2207b9e59d065377f5ceb27660758911f49ff5bb 100644 (file)
--- 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 0c05a485b8ad8f0676637575fb744144378f49b0..d78ff4f7bda497b6dcf46ac67ea42f3d682ba41b 100644 (file)
--- 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
 };
 
index 757ad24bf55ad56c9200d447fdf3eb678fc37947..b4cb14f408c356c8d9694f58bc7cb9ba1a643422 100644 (file)
--- 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 ||