Skip to content

Commit ebced02

Browse files
MaochenWang1aescolar
authored andcommitted
net: arp: Fix failed to add the arp table in stress test
During stress test with WiFi connect, disconnect, ping and throughput traffic, ARP table updating failed issue may occur. In arp_prepare(), if packet allocate failed, should add the arp entry back to arp_free_entries, to avoid this entry is leak forever. Signed-off-by: Maochen Wang <[email protected]>
1 parent f34f060 commit ebced02

File tree

1 file changed

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

1 file changed

+7
-0
lines changed

subsys/net/l2/ethernet/arp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,13 @@ struct net_pkt *net_arp_prepare(struct net_pkt *pkt,
416416
NET_DBG("Resending ARP %p", req);
417417
}
418418

419+
if (!req && entry) {
420+
/* Add the arp entry back to arp_free_entries, to avoid the
421+
* arp entry is leak due to ARP packet allocated failed.
422+
*/
423+
sys_slist_prepend(&arp_free_entries, &entry->node);
424+
}
425+
419426
k_mutex_unlock(&arp_mutex);
420427
return req;
421428
}

0 commit comments

Comments
 (0)