Skip to content

Commit

Permalink
[nrf fromtree] net: arp: Directly send the queued pkt
Browse files Browse the repository at this point in the history
We must send the packet without queueing it. The pkt has already
been queued for sending, once by net_if and second time in the ARP
queue. We must not queue it twice in net_if so that the statistics
of the pkt are not counted twice and the packet filter callbacks
are only called once.

Fixes #62483

Signed-off-by: Jukka Rissanen <[email protected]>
(cherry picked from commit 0e5016e)
  • Loading branch information
jukkar authored and rlubos committed Nov 10, 2023
1 parent 2a8c218 commit a707fc7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion subsys/net/l2/ethernet/arp.c
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,8 @@ static void arp_update(struct net_if *iface,
sys_slist_prepend(&arp_table, &entry->node);

while (!k_fifo_is_empty(&entry->pending_queue)) {
int ret;

pkt = k_fifo_get(&entry->pending_queue, K_FOREVER);

/* Set the dst in the pending packet */
Expand All @@ -525,7 +527,17 @@ static void arp_update(struct net_if *iface,
net_sprint_ipv4_addr(&entry->ip),
pkt, pkt->frags);

net_if_queue_tx(iface, pkt);
/* We directly send the packet without first queueing it.
* The pkt has already been queued for sending, once by
* net_if and second time in the ARP queue. We must not
* queue it twice in net_if so that the statistics of
* the pkt are not counted twice and the packet filter
* callbacks are only called once.
*/
ret = net_if_l2(iface)->send(iface, pkt);
if (ret < 0) {
net_pkt_unref(pkt);
}
}

k_mutex_unlock(&arp_mutex);
Expand Down

0 comments on commit a707fc7

Please sign in to comment.