mirror of
https://github.com/espressif/esp-lwip.git
synced 2026-09-12 20:20:04 +00:00
napt: Fix PBUF_REF type to clone the pbuf before forwarding
This commit is contained in:
@@ -421,7 +421,23 @@ ip4_forward(struct pbuf *p, struct ip_hdr *iphdr, struct netif *inp)
|
||||
return;
|
||||
}
|
||||
/* transmit pbuf on chosen interface */
|
||||
#if ESP_IP_FORWARD
|
||||
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_IP_FORWARD */
|
||||
return;
|
||||
return_noroute:
|
||||
MIB2_STATS_INC(mib2.ipoutnoroutes);
|
||||
|
||||
@@ -110,6 +110,8 @@
|
||||
#define ESP_THREAD_PROTECTION 0
|
||||
#define ESP_DHCP_DISABLE_CLIENT_ID 0
|
||||
#define ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER 0
|
||||
#define ESP_IP_FORWARD 1
|
||||
|
||||
|
||||
#ifdef IP_NAPT
|
||||
#define IP_NAPT_MAX 16
|
||||
|
||||
Reference in New Issue
Block a user