Re: [PATCH] net: Do not route traffic to interfaces that are not up

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Aug 20, 2018 at 11:28:19PM -0700, Andrey Smirnov wrote:
> 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 <andrew.smirnov@xxxxxxxxx>
> ---

Applied, thanks

Sascha

>  net/net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/net.c b/net/net.c
> index d21855415..63f42fa5c 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)) {
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux