tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ARP Address Conflict Detection and dhcpcd arping



Hi Rudolf

On 11/10/2019 12:41, rudolf wrote:
I have a NetBSD 8.1_STABLE (july 2019) host with a static IP address and another machine (Linux) with dhcpcd "arping" configuration for this IP address. With the default value of sysctl net.inet.ip.dad_count (=3), I see no ARP reply ("ARP, Reply <IP addr> is-at <MAC>") messages from the NetBSD host on the arping queries ("ARP, Request who-has <IP addr> tell 0.0.0.0") and eventually the NetBSD host marks its IP address as duplicated (and the "arping" dhcpcd configuration of the second host fails).

This seems contradictory to what I read in "man 4 arp":
``ARP will defend the host's active address when a conflicting message is received.''

With "sysctl -w net.inet.ip.dad_count=0", the NetBSD host sends the ARP reply and the "arping" configuration of the second host works.

Is this expected behavior?

Totally not expected behaviour.

I see the same behaviour in -current which I just fixed and submitted a PR for -9, but -8 (from release to now) is fine and doesn't need a patch here - at least not from the steps listed.

Roy
Index: sys/netinet/if_arp.c
===================================================================
RCS file: /cvsroot/src/sys/netinet/if_arp.c,v
retrieving revision 1.288
diff -u -p -r1.288 if_arp.c
--- sys/netinet/if_arp.c	25 Sep 2019 09:52:32 -0000	1.288
+++ sys/netinet/if_arp.c	11 Oct 2019 13:21:23 -0000
@@ -1157,15 +1157,17 @@ in_arpinput(struct mbuf *m)
 	/*
 	 * DAD check, RFC 5227.
 	 * Collision on sender address is always a duplicate.
-	 * Collision on target address is only a duplicate IF
-	 * the sender address is the null host (ie a DAD probe) AND
-	 * the message was broadcast - if it's unicast then it's
-	 * a valid Unicast Poll from RFC 1122.
+	 * Collision on target address is only a duplicate
+	 * IF the sender address is the null host (ie a DAD probe)
+	 * AND the message was broadcast
+	 * AND our address is either tentative or duplicated
+	 * If it was unicast then it's a valid Unicast Poll from RFC 1122.
 	 */
 	if (do_dad &&
 	    (in_hosteq(isaddr, myaddr) ||
 	    (in_nullhost(isaddr) && in_hosteq(itaddr, myaddr) &&
-	     m->m_flags & M_BCAST)))
+	     m->m_flags & M_BCAST &&
+	     ia->ia4_flags & (IN_IFF_TENTATIVE | IN_IFF_DUPLICATED))))
 	{
 		struct sockaddr_dl sdl, *sdlp;
 


Home | Main Index | Thread Index | Old Index