Skip to content

Commit

Permalink
net: l2: ethernet: arp: Simplify ACD case
Browse files Browse the repository at this point in the history
In case of ACD Probe/Announcement, all we need is to generate ARP
packet, we don't really want any cache entries to be created or searched
for. There was a bug, that a cache entry was created for the
Announcement sent, resulting in skipped ARP packet generation and
malformed packet being sent by the ACD module.

Therefore, simplify all this, by simply returning early in case of
conflict detection packets.

Signed-off-by: Robert Lubos <[email protected]>
  • Loading branch information
rlubos committed Jun 5, 2024
1 parent 1368048 commit b34e34d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions subsys/net/l2/ethernet/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt,
return NULL;
}

if (net_pkt_ipv4_acd(pkt)) {
return arp_prepare(net_pkt_iface(pkt), request_ip, NULL,
pkt, current_ip);
}

if (IS_ENABLED(CONFIG_NET_IPV4_AUTO)) {
is_ipv4_ll_used = net_ipv4_is_ll_addr((struct in_addr *)
&NET_IPV4_HDR(pkt)->src) ||
Expand Down Expand Up @@ -406,8 +411,7 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt,
* in the pending list and if so, resend the request, otherwise just
* append the packet to the request fifo list.
*/
if (!net_pkt_ipv4_acd(pkt) &&
k_queue_unique_append(&entry->pending_queue._queue,
if (k_queue_unique_append(&entry->pending_queue._queue,
net_pkt_ref(pkt))) {
NET_DBG("Pending ARP request for %s, queuing pkt %p",
net_sprint_ipv4_addr(addr), pkt);
Expand Down

0 comments on commit b34e34d

Please sign in to comment.