Commit 96a05d09 authored by Andreas Huber's avatar Andreas Huber Committed by Anas Nashif
Browse files

net: ipv4: Fix ARP probe check in address conflict detection



The second condition needs to check ARP probes only

The ACD is not properly implemented as described in RFC5227 ch. 2.1.1
The implementation incorrectly detects an IP conflict, if an ARP request
is received for the target IP.
The reason is that the current implementation checks for ARP requests
instead of ARP probes.

Signed-off-by: default avatarAndreas Huber <andreas.huber@ch.sauter-bc.com>
(cherry picked from commit 27d93f8b)
parent a3315af1
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -288,15 +288,18 @@ enum net_verdict net_ipv4_acd_input(struct net_if *iface, struct net_pkt *pkt)
		ll_addr = net_if_get_link_addr(addr_iface);

		/* RFC 5227, ch. 2.1.1 Probe Details:
		 * - Sender IP address match OR,
		 * - Target IP address match with different sender HW address,
		 * - ARP Request/Reply with Sender IP address match OR,
		 * - ARP Probe where Target IP address match with different sender HW address,
		 * indicate a conflict.
		 * ARP Probe has an all-zero sender IP address
		 */
		if (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr,
					  (uint8_t *)&ifaddr->address.in_addr) ||
		    (net_ipv4_addr_cmp_raw(arp_hdr->dst_ipaddr,
					  (uint8_t *)&ifaddr->address.in_addr) &&
		     memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0)) {
				 (memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0) &&
				 (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr,
						(uint8_t *)&(struct in_addr)INADDR_ANY_INIT)))) {
			NET_DBG("Conflict detected from %s for %s",
				net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr,
						   arp_hdr->hwlen),