Hi Eason,
There is no route table inside lwIP. About the out packet, lwIP will search
the interface according to ip addr/mask of each ethernet interface. If no
result, the packet will be sent to the default interface.

Therefore, please let the two interfaces in different sub-network, for
example,
192.168.1.xx;
192.168.2.xx;

If these two interfaces are in same sub-network, lwIP is wondering which
one is the correct one and then only send to the first one.

BTW,
If you want to use the packet forward function simply from one interface to
another interface, you can look at the lwIP NAT implementation in RT-Thread
RTOS:
https://github.com/RT-Thread/rt-thread/tree/master/components/net/lwip_nat




Best Regards,
Bernard Xiong


2015-05-09 12:00 GMT+08:00 Eason <u9411...@gmail.com>:

> Hi Simon, I have some questions.
>
> I add the second interface(struct netif* xnetif_1) by using
> netif_add(xnetif_1, &ipaddr, &netmask, &gw, NULL, ethernetif_init,
> tcpip_input);,
> and I don't set it to default interface, isn't it? No metter what I add, I
> just set default interface on first interface(struct netif* xnetif_0).
>
> In ip_input(), it forwards packets to correct interface if the packets are
> not for currently interface, so I shouldn't edit any other codes? Or
> designe
> a routing table?
>
>
>
> --
> View this message in context:
> http://lwip.100.n7.nabble.com/Lwip-with-two-ethernet-ports-tp24405p24420.html
> Sent from the lwip-users mailing list archive at Nabble.com.
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/lwip-users
>
_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to