From 3e798dfd88c219385a74150e70a413f021e8a161 Mon Sep 17 00:00:00 2001 From: Patrik Flykt Date: Fri, 12 Apr 2019 13:13:24 -0600 Subject: [PATCH] net: ethernet: Send sender IP address in ARP announce packets In addition to checking that the ARP entry does not exist as the implementation is done currently, also check if the ARP packet is due to IPv4 link local address configuration. In both cases use the provided IPv4 address instead of the one set for the interface. Signed-off-by: Patrik Flykt --- subsys/net/l2/ethernet/arp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/subsys/net/l2/ethernet/arp.c b/subsys/net/l2/ethernet/arp.c index ecf71785c06..ef027faf7cb 100644 --- a/subsys/net/l2/ethernet/arp.c +++ b/subsys/net/l2/ethernet/arp.c @@ -297,10 +297,10 @@ static inline struct net_pkt *arp_prepare(struct net_if *iface, memcpy(hdr->src_hwaddr.addr, net_pkt_lladdr_src(pkt)->addr, sizeof(struct net_eth_addr)); - if (entry) { - my_addr = if_get_addr(entry->iface, current_ip); - } else { + if (!entry || (pkt != NULL && net_pkt_ipv4_auto(pkt))) { my_addr = current_ip; + } else { + my_addr = if_get_addr(entry->iface, current_ip); } if (my_addr) {