I needed the ability to port forward back onto the same network but the current lwip files as of ESP-IDF 4.4.0 do not support this. The attached files add this capability to lwip. I built an ESP32LocalPortForwarder app that provides a web interface to manage port forward rules using these updated lwip files (https://github.com/mtnbkr88/ESP32LocalPortForwarder). Copy the attached files to the these locations to enable local port forwarding:
ESP-IDF\components\lwip\lwip\src\core\ipv4\ip4.c
ESP-IDF\components\lwip\lwip\src\core\ipv4\ip4_napt.c
ESP-IDF\components\lwip\lwip\src\include\lwip\ip4_napt.h
I also had to modify opt.h and enable the below because menuconfig does not support enabling all these options:
#define IP_FORWARD 1
#define IP_NAPT 1
#define IP_FORWARD_ALLOW_TX_ON_RX_NETIF 1
Please add these changed files to future versions of lwip so local port forwarding will be available if needed.
lwip local port forwarding enabled files attached
lwip local port forwarding enabled files attached
- Attachments
-
- ip4_napt.c
- (28.28 KiB) Downloaded 242 times
-
- ip4.c
- (49.78 KiB) Downloaded 230 times
-
- ip4_napt.h
- (3.62 KiB) Downloaded 229 times
Who is online
Users browsing this forum: No registered users and 118 guests