mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-06-05 21:04:45 +00:00
napt: Fix PBUF_REF type to clone the pbuf before forwarding
Picked from espressif/esp-idf@39068263 Ref IDF-4800
This commit is contained in:
@@ -370,7 +370,23 @@ ip4_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
return;
|
||||
}
|
||||
/* transmit pbuf on chosen interface */
|
||||
#if ESP_LWIP && IP_NAPT
|
||||
if (p->type_internal == PBUF_REF)
|
||||
{
|
||||
struct pbuf *q = pbuf_clone(PBUF_LINK, PBUF_RAM, p);
|
||||
if (q != NULL) {
|
||||
netif->output(netif, q, ip4_current_dest_addr());
|
||||
pbuf_free(q);
|
||||
} else {
|
||||
MIB2_STATS_INC(mib2.ipinaddrerrors);
|
||||
MIB2_STATS_INC(mib2.ipindiscards);
|
||||
}
|
||||
} else {
|
||||
netif->output(netif, p, ip4_current_dest_addr());
|
||||
}
|
||||
#else
|
||||
netif->output(netif, p, ip4_current_dest_addr());
|
||||
#endif /* ESP_LWIP && IP_NAPT */
|
||||
return;
|
||||
return_noroute:
|
||||
MIB2_STATS_INC(mib2.ipoutnoroutes);
|
||||
|
||||
Reference in New Issue
Block a user