Skip to content

Commit 27d93f8

Browse files
anhubammahadevan108
authored andcommitted
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: Andreas Huber <[email protected]>
1 parent 94f307a commit 27d93f8

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

subsys/net/ip/ipv4_acd.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,15 +288,18 @@ enum net_verdict net_ipv4_acd_input(struct net_if *iface, struct net_pkt *pkt)
288288
ll_addr = net_if_get_link_addr(addr_iface);
289289

290290
/* RFC 5227, ch. 2.1.1 Probe Details:
291-
* - Sender IP address match OR,
292-
* - Target IP address match with different sender HW address,
291+
* - ARP Request/Reply with Sender IP address match OR,
292+
* - ARP Probe where Target IP address match with different sender HW address,
293293
* indicate a conflict.
294+
* ARP Probe has an all-zero sender IP address
294295
*/
295296
if (net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr,
296297
(uint8_t *)&ifaddr->address.in_addr) ||
297298
(net_ipv4_addr_cmp_raw(arp_hdr->dst_ipaddr,
298299
(uint8_t *)&ifaddr->address.in_addr) &&
299-
memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0)) {
300+
(memcmp(&arp_hdr->src_hwaddr, ll_addr->addr, ll_addr->len) != 0) &&
301+
(net_ipv4_addr_cmp_raw(arp_hdr->src_ipaddr,
302+
(uint8_t *)&(struct in_addr)INADDR_ANY_INIT)))) {
300303
NET_DBG("Conflict detected from %s for %s",
301304
net_sprint_ll_addr((uint8_t *)&arp_hdr->src_hwaddr,
302305
arp_hdr->hwlen),

0 commit comments

Comments
 (0)