From: Roy Marples Date: Mon, 26 Oct 2015 23:16:35 +0000 (+0000) Subject: Fix DHCP INFORM on non IN_IFF_* systems. X-Git-Tag: v6.9.4~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b8b87b837744814d5bb69ae93c658a7c38269b3;p=thirdparty%2Fdhcpcd.git Fix DHCP INFORM on non IN_IFF_* systems. --- diff --git a/dhcp.c b/dhcp.c index 00ce2fc3..24317838 100644 --- 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 7b9fa1a1..a3a4f737 100644 --- 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