Taking things nice & slow, I started with the following setup:
PING | 192.168.1.50 | 192.168.1.75 | 192.168.4.1 | 192.168.4.3 |
---|---|---|---|---|
192.168.1.50 | n/a | n/a | n/a | n/a |
192.168.1.75 | YES | n/a | n/a | n/a |
192.168.4.1 | YES | n/a | n/a | YES |
192.168.4.3 | NO | n/a | n/a | n/a |
/**
* IP_FORWARD==1: Enables the ability to forward IP packets across network
* interfaces. If you are going to run lwIP on a device with only one network
* interface, define this to 0.
*/
#ifndef IP_FORWARD
// #define IP_FORWARD 0
#define IP_FORWARD 1
#endif
I rebuilt the firmware, flashed it to a ESP Module and:
FAILED. No changes to the module's routing behaviour.
If anyone is more familiar with the code, don't hesitate to leave a comment.
Next Steps:
- Get packet forwarding to work
- Routes? What routes? (There is a hook for those in later versions of LWIP. Backporting possible?)
PS:
Another search of the source code shows that there is another place that sets IP_FORWARD: /app/include/lwipopts.h - I'll try that next.
1) lwipopts.h, opt.h ===> IP_FORWARD 1
ReplyDelete2) xtensa-lx106-elf-ar x liblwip.a ==> extract LIB
3) MODIFY /core/ipv4/ip.c
//icmp_time_exceeded(p, ICMP_TE_TTL); ==> COMMENT
and COMMENT !!!
//if (netif == inp) {
// LWIP_DEBUGF(IP_DEBUG, ("ip_forward: not bouncing packets back on incoming interface.\n"));
// goto return_noroute;
// }
--> ip.o
xtensa-lx106-elf-ar cr liblwip.a api_lib.o ... (new)ip.o .. udp.o
and replace the old liblwip.a with the new one that support IP FORWARDING :):)