| From 55553dd246d6d49f4f389ac65766fc199ca2a76e Mon Sep 17 00:00:00 2001 |
| From: Peter Qiu <zqiu@chromium.org> |
| Date: Thu, 28 May 2015 09:35:22 -0700 |
| Subject: [PATCH] UPSTREAM: Fix ARP checking |
| |
| Fix ARP checking logic and the usage of IN_IFF_TENTATIVE compiler flag |
| around ARP checking. |
| |
| Upstream patch link: |
| http://roy.marples.name/projects/dhcpcd/info/fad4fae29d5d7dc9 |
| http://roy.marples.name/projects/dhcpcd/info/9dcdaf2d1ef4a44d |
| --- |
| dhcp.c | 23 ++++++++++++++--------- |
| 1 file changed, 14 insertions(+), 9 deletions(-) |
| |
| diff --git a/dhcp.c b/dhcp.c |
| index d3d0d05..7047ac1 100644 |
| --- a/dhcp.c |
| +++ b/dhcp.c |
| @@ -3125,33 +3125,38 @@ dhcp_handledhcp(struct interface *ifp, struct dhcp_message **dhcpp, |
| eloop_timeout_delete(ifp->ctx->eloop, NULL, ifp); |
| astate = NULL; |
| |
| -#ifndef IN_IFF_TENTATIVE |
| +#ifdef IN_IFF_TENTATIVE |
| + addr.s_addr = state->offer->yiaddr; |
| + astate = arp_new(ifp, &addr); |
| + if (astate) { |
| + astate->probed_cb = dhcp_arp_probed; |
| + astate->conflicted_cb = dhcp_arp_conflicted; |
| + /* No need to start the probe as we'll |
| + * listen to the kernel stating DAD or not and |
| + * that action look look for our ARP state for |
| + * what to do. */ |
| + } |
| +#else |
| if ((ifo->options & DHCPCD_ARP || state->nak_receive_count > 0 || |
| dhcp->yiaddr == state->failed.s_addr) |
| && state->addr.s_addr != state->offer->yiaddr) |
| -#endif |
| { |
| addr.s_addr = state->offer->yiaddr; |
| -#ifndef IN_IFF_TENTATIVE |
| /* If the interface already has the address configured |
| * then we can't ARP for duplicate detection. */ |
| ia = ipv4_findaddr(ifp->ctx, &addr); |
| - if (ia) { |
| -#endif |
| + if (ia == NULL) { |
| astate = arp_new(ifp, &addr); |
| if (astate) { |
| astate->probed_cb = dhcp_arp_probed; |
| astate->conflicted_cb = dhcp_arp_conflicted; |
| -#ifndef IN_IFF_TENTATIVE |
| arp_probe(astate); |
| -#endif |
| rpc_signal_status("ArpSelf"); |
| } |
| -#ifndef IN_IFF_TENTATIVE |
| return; |
| } |
| -#endif |
| } |
| +#endif |
| |
| if ((ifo->options & DHCPCD_ARPGW) && (dhcp_probe_gw(ifp))) { |
| rpc_signal_status("ArpGateway"); |
| -- |
| 2.2.0.rc0.207.ga3a616c |
| |