tabascoeye / lwip

a fork of the light-weight IP stack
Other
15 stars 6 forks source link

Multiple netifs on same subnet don't behave as expected #7

Closed tabascoeye closed 10 years ago

tabascoeye commented 10 years ago

The routing function ip_route() is a bit too simple for the scenario that multiple netifs are on the same subnet.

For outbound packets, the function is called with the destination IP as parameter. That destination is then matched against each netif's subnet (IP+Netmask) and the first match "wins" the packet. This means that with two netifs on the same subnet, all outgoing packets will always run via the first one even packets from sockets which are bound to the IP of the second netif. The netifs are not taken out of the routing list when they loose their link. This means that a connection that you supposedly have established with the second netif will go down when you unplug the first netif.

A workaaround for that last problem is to have a link callback function and set the netif to down state, so that it is taken out of the routing list.

This will still create a bit of waiting time when the first cable is unplugged because the ARP tables need to be updated.

==> so: 1) we need to enhance the routing algorithm to take the "src" IP into account and choose the netif according to that criteria also 2) we might consider checking for link status and for another netif matching the destination subnet if the src IP is INADDR_ANY, so that the packet still goes out into the subnet even when one of the two interfaces is down

tabascoeye commented 10 years ago

This is the same issue as #5 ==> closed