From f0624a701513e5444340e7f071ac875d34b39336 Mon Sep 17 00:00:00 2001 From: Andrey Smirnov Date: Mon, 20 Aug 2018 23:28:19 -0700 Subject: net: Do not route traffic to interfaces that are not up In the case when: - Board has multiple network interfaces - Two ore more of those interfaces are statically configured to be on the same network - Only one of those interfaces is up and it is preceeded (as far as for_each_netdev is concerned) by interface in the same network that isn't net_route() will choose "non-up" device as a route for traffic resulting in no network connectivity. Change the routing logic to also consider if interface is "up", so that only such interfaces would be considered for sending network traffic out. Signed-off-by: Andrey Smirnov Signed-off-by: Sascha Hauer --- net/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'net') diff --git a/net/net.c b/net/net.c index d218554153..63f42fa5cc 100644 --- a/net/net.c +++ b/net/net.c @@ -149,7 +149,7 @@ struct eth_device *net_route(IPaddr_t dest) struct eth_device *edev; for_each_netdev(edev) { - if (!edev->ipaddr) + if (!edev->ipaddr || !edev->ifup) continue; if ((dest & edev->netmask) == (edev->ipaddr & edev->netmask)) { -- cgit v1.2.3