Solved it and as a refrence to anyone who read this later
To enable a lwip stack access to/from other network over unix port
Here are the steps
*sudo sysctl -w net.ipv4.ip_forward=1*
*sudo ifconfig eth0 0.0.0.0 promisc up*
*sudo brctl addbr br0*
*sudo ifconfig br0 <bridge IP suitable to network you wih to be on>*
*sudo brctl addif br0 eth0*
Note : Remember bridging works only over ethernet not wirless interface
Contrib version : 1.4.0
Modifications to file contrib/ports/unix/netif/tapif.c
*Function : low_level_init()*
*Near about Line# 137*
/* sprintf(buf, IFCONFIG_BIN IFCONFIG_ARGS,
ip4_addr1(&(netif->gw)),
ip4_addr2(&(netif->gw)),
ip4_addr3(&(netif->gw)),
ip4_addr4(&(netif->gw)));
*/
snprintf(buf,sizeof(buf),"ifconfig tap0 0.0.0.0 promisc up");
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
system(buf);
snprintf(buf,sizeof(buf),"brctl addif br0 tap0");
LWIP_DEBUGF(TAPIF_DEBUG, ("tapif_init: system(\"%s\");\n", buf));
system(buf);
sys_thread_new("tapif_thread", tapif_thread, netif,
DEFAULT_THREAD_STACKSIZE, DEFAULT_THREAD_PRIO);
}
......................................................
This should make it work,
however it may some time to establish the path and return intial reply to
ping
and may even show "Destination Host Unreachable" for inital packet replies
If this take too much time or no connection at all then
After you run the simhost application
*sudo arp -s <LWIP stack IP> <Tap0 MAC address>*
Tap0 MAC address changes everytime you execute the application
so if it suddenly stops working then please repeat the last step
Note :
LWIP stack IP : Host IP
Tap IP : Gateway IP
--
Thanks
Regards
Saket Chawla
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users