Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

routing with multiple interfaces on same subnet is broken #5

Open
tabascoeye opened this issue Jun 4, 2014 · 2 comments
Open

routing with multiple interfaces on same subnet is broken #5

tabascoeye opened this issue Jun 4, 2014 · 2 comments

Comments

@tabascoeye
Copy link
Owner

When multiple netifs are on the same local subnet multiple problems arise:

  • ip_route() is called with only destination IP as parameter. Thus the netif that is found as matching is always the first one on this subnet and not the one where the socket is bound to
  • when the link goes down on that first netif, the packet is still sent its way and gets lost even though there is a perfectly fine netif on the same subnet ready to take over.
  • the "default_netif" must match to the interface that has the configured "default gateway" because it is always the last chance netif when no route is found ==> when there are two netifs on the same subnet and the default gateway is on that net, the netif going link down must give its "default status" to the other netif on the same subnet

phew...

  • I suggest starting with adding "src" to the parameters of ip_route() and choosing the netif also according to the source (if not INADDR_ANY etc.)
  • we need to include the check for link_down in ip_route() as well so that other interfaces on a matching subnet have a chance to sent the packet. This also means that during the first run of the for loop, the correct netif (matching src ip) might be down so we have to either re-run the for loop, now taking other netifs on that subent into account or find another way to check for another netif on same subnet.
  • the default_netif must always match the one netif that is a) up+link and b) can reach the default gateway.
@tabascoeye
Copy link
Owner Author

Alternative to adding the "src" to the routing function (which feels odd) we could replace all the places where the function is abused to find out a local IP and/or the fitting netif to send on.
Becuase in those cases, we need to find a good match.

  • in udp_connect()
  • in udp_sendto()
  • in tcp_eff_send_mss()
  • in snmp_send_trap()
  • in etharp_add_static_entry()

@tabascoeye
Copy link
Owner Author

Also check the official LwIP bug tracker: http://savannah.nongnu.org/task/?13397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant