]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix DHCP INFORM on non IN_IFF_* systems.
authorRoy Marples <roy@marples.name>
Mon, 26 Oct 2015 23:16:35 +0000 (23:16 +0000)
committerRoy Marples <roy@marples.name>
Mon, 26 Oct 2015 23:16:35 +0000 (23:16 +0000)
dhcp.c
ipv4.c

diff --git a/dhcp.c b/dhcp.c
index 00ce2fc3e9984fbaac6d3fe6a4e1f0862a277081..24317838f1a63d11d6cbe71de6f07eedde1ddc71 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -1897,10 +1897,25 @@ dhcp_arp_probed(struct arp_state *astate)
            astate->iface->name, inet_ntoa(astate->addr));
        if (state->state != DHS_INFORM)
                dhcp_bind(astate->iface);
+#ifndef IN_IFF_TENTATIVE
+       else {
+               struct dhcp_message *oldnew;
+
+               oldnew = state->new;
+               state->new = state->offer;
+               get_lease(astate->iface->ctx, &state->lease, state->new);
+               ipv4_applyaddr(astate->iface);
+               state->new = oldnew;
+       }
+#endif
+               
        arp_announce(astate);
 
        /* Stop IPv4LL now we have a working DHCP address */
        ipv4ll_drop(astate->iface);
+
+       if (ifo->options & DHCPCD_INFORM)
+               dhcp_inform(astate->iface);
 }
 
 static void
@@ -2163,7 +2178,7 @@ dhcp_arp_address(struct interface *ifp)
                struct dhcp_lease l;
 
                get_lease(ifp->ctx, &l, state->offer);
-               logger(ifp->ctx, LOG_INFO, "%s: probing static address %s/%d",
+               logger(ifp->ctx, LOG_INFO, "%s: probing address %s/%d",
                    ifp->name, inet_ntoa(l.addr), inet_ntocidr(l.net));
                if ((astate = arp_new(ifp, &addr)) != NULL) {
                        astate->probed_cb = dhcp_arp_probed;
@@ -2226,6 +2241,7 @@ dhcp_inform(struct interface *ifp)
        state = D_STATE(ifp);
        ifo = ifp->options;
 
+       state->state = DHS_INFORM;
        free(state->offer);
        state->offer = NULL;
 
@@ -2262,7 +2278,6 @@ dhcp_inform(struct interface *ifp)
 
        state->offer = dhcp_message_new(&ia->addr, &ia->net);
        if (state->offer) {
-               state->state = DHS_INFORM;
                state->xid = dhcp_xid(ifp);
                get_lease(ifp->ctx, &state->lease, state->offer);
                send_inform(ifp);
diff --git a/ipv4.c b/ipv4.c
index 7b9fa1a1d496ff17535fdebbc2b27bf62b411739..a3a4f737aea97529054f1ae0a89772797bc13f24 100644 (file)
--- a/ipv4.c
+++ b/ipv4.c
@@ -1166,9 +1166,10 @@ ipv4_applyaddr(void *arg)
         * notification right now via our link socket. */
        if_initrt(ifp);
        ipv4_buildroutes(ifp->ctx);
-       script_runreason(ifp, state->reason);
-
-       dhcpcd_daemonise(ifp->ctx);
+       if (state->state == DHS_BOUND) {
+               script_runreason(ifp, state->reason);
+               dhcpcd_daemonise(ifp->ctx);
+       }
 }
 
 void
@@ -1222,8 +1223,8 @@ ipv4_handleifa(struct dhcpcd_ctx *ctx,
                }
        }
 
-       dhcp_handleifa(cmd, ifp, addr, net, dst, flags);
        arp_handleifa(cmd, ifp, addr, flags);
+       dhcp_handleifa(cmd, ifp, addr, net, dst, flags);
 }
 
 void