aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Tan <samueltan@google.com>2015-08-13 16:51:04 -0700
committerSamuel Tan <samueltan@google.com>2015-08-18 13:47:16 -0700
commit47d708b8f4e037f6f224f71ea5864c90184b4ffb (patch)
treef4a6385b6551b3c960a9bc593d53f9a71d1d4459
parent23ff6edd8b4ec796a32d36a3eca8a8d8c785b565 (diff)
downloaddhcpcd-6.8.2-47d708b8f4e037f6f224f71ea5864c90184b4ffb.tar.gz
[PATCH] UPSTREAM: Fix ARP checking
Cherry-picked from https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/ master/net-misc/dhcpcd/files/patches/dhcpcd-6.8.2-UPSTREAM-Fix-ARP- checking.patch. 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 BUG: 22956197 Change-Id: I1ba5c5d56a104cadf4566367408abb068b7e1268 Reviewed-on: https://chromium-review.googlesource.com/272614
-rw-r--r--dhcp.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/dhcp.c b/dhcp.c
index dd9be05..f2a5899 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");