Skip to content

Commit 9552796

Browse files
committed
net: arp: Drop request where src hw address is our address
We replied to an ARP request that has the same Sender Hardware Address than that of ours. Such an ARP request must be discarded, no reply should be sent and translation table should not be updated. Fixes #16110 Signed-off-by: Jukka Rissanen <[email protected]>
1 parent a84e934 commit 9552796

File tree

1 file changed

+9
-0
lines changed
  • subsys/net/l2/ethernet

1 file changed

+9
-0
lines changed

subsys/net/l2/ethernet/arp.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,15 @@ enum net_verdict net_arp_input(struct net_pkt *pkt,
564564

565565
switch (ntohs(arp_hdr->opcode)) {
566566
case NET_ARP_REQUEST:
567+
/* If ARP request sender hw address is our address,
568+
* we must drop the packet.
569+
*/
570+
if (memcmp(&arp_hdr->src_hwaddr,
571+
net_if_get_link_addr(net_pkt_iface(pkt))->addr,
572+
sizeof(struct net_eth_addr)) == 0) {
573+
return NET_DROP;
574+
}
575+
567576
if (IS_ENABLED(CONFIG_NET_ARP_GRATUITOUS)) {
568577
if (memcmp(&eth_hdr->dst,
569578
net_eth_broadcast_addr(),

0 commit comments

Comments
 (0)