CONFIG_LWIP_L2_TO_L3_COPY unnecessary to use NAPT feature in lwip (IDFGH-11763) #12861
Closed
3 tasks done
Labels
Resolution: Done
Issue is done internally
Status: Done
Issue is done internally
Type: Bug
bugs in IDF
Answers checklist.
IDF version.
5.1.2
Operating System used.
Windows
How did you build your project?
Eclipse IDE
If you are using Windows, please specify command line type.
None
What is the expected behavior?
1- As stated in the documentation I enabled CONFIG_LWIP_IP_FORWARD and CONFIG_LWIP_IPV4_NAPT and CONFIG_LWIP_L2_TO_L3_COPY to get napt functionnality. The result of it was that napt worked as expected.
2- In another test I enabled CONFIG_LWIP_IP_FORWARD and CONFIG_LWIP_IPV4_NAPT but not CONFIG_LWIP_L2_TO_L3_COPY. And the result of it was also that napt worked as expected.
Conclusion: enabling CONFIG_LWIP_L2_TO_L3_COPY seems to be unnecessary (despite what the docuentation says). So it could be interesting to update code and documentation to remove the need of CONFIG_LWIP_L2_TO_L3_COPY.
What is the actual behavior?
lwip file: wlanif.c
function: esp_netif_recv_ret_t wlanif_input(void *, void , size_t, void )
1- with CONFIG_LWIP_L2_TO_L3_COPY:
#ifdef CONFIG_LWIP_L2_TO_L3_COPY
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_ERR_NO_MEM);
}
memcpy(p->payload, buffer, len);
esp_netif_free_rx_buffer(esp_netif, l2_buff);
#else
p = esp_pbuf_allocate(esp_netif, buffer, len, l2_buff);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_ERR_NO_MEM);
}
#endif
=> napt works as expected
2- without CONFIG_LWIP_L2_TO_L3_COPY:
#undef CONFIG_LWIP_L2_TO_L3_COPY // to desable CONFIG_LWIP_L2_TO_L3_COPY
#ifdef CONFIG_LWIP_L2_TO_L3_COPY
p = pbuf_alloc(PBUF_RAW, len, PBUF_RAM);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_ERR_NO_MEM);
}
memcpy(p->payload, buffer, len);
esp_netif_free_rx_buffer(esp_netif, l2_buff);
#else
p = esp_pbuf_allocate(esp_netif, buffer, len, l2_buff);
if (p == NULL) {
esp_netif_free_rx_buffer(esp_netif, l2_buff);
return ESP_NETIF_OPTIONAL_RETURN_CODE(ESP_ERR_NO_MEM);
}
#endif
=> CONFIG_LWIP_L2_TO_L3_COPY desabled BUT napt works as expected.
Seems that CONFIG_LWIP_L2_TO_L3_COPY is unnecessary.
Steps to reproduce.
...
Build or installation Logs.
No response
More Information.
No response
The text was updated successfully, but these errors were encountered: