lwip: fix udp tx packet loss issue

This commit is contained in:
xiehang
2020-08-04 19:57:12 +08:00
parent ffd1059c9a
commit 602d25c525

View File

@ -1048,9 +1048,9 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
unsigned int qlen = 0;
new_entry->next = 0;
new_entry->p = p;
struct etharp_q_entry *r;
if (arp_table[i].q != NULL) {
/* queue was already existent, append the new entry to the end */
struct etharp_q_entry *r;
r = arp_table[i].q;
qlen++;
while (r->next != NULL) {
@ -1064,11 +1064,19 @@ etharp_query(struct netif *netif, const ip4_addr_t *ipaddr, struct pbuf *q)
}
#if ARP_QUEUE_LEN
if (qlen >= ARP_QUEUE_LEN) {
#if ESP_LWIP_ARP
r->next = NULL;
pbuf_free(new_entry->p);
memp_free(MEMP_ARP_QUEUE, new_entry);
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: could not queue the packet %p (queue is full)\n", (void *)q));
return ERR_MEM;
#else
struct etharp_q_entry *old;
old = arp_table[i].q;
arp_table[i].q = arp_table[i].q->next;
pbuf_free(old->p);
memp_free(MEMP_ARP_QUEUE, old);
#endif
}
#endif
LWIP_DEBUGF(ETHARP_DEBUG | LWIP_DBG_TRACE, ("etharp_query: queued packet %p on ARP entry %"U16_F"\n", (void *)q, i));