lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161206082233.GD1984@nanopsycho>
Date:   Tue, 6 Dec 2016 09:22:33 +0100
From:   Jiri Pirko <jiri@...nulli.us>
To:     Xin Long <lucien.xin@...il.com>
Cc:     network dev <netdev@...r.kernel.org>, davem@...emloft.net,
        Marcelo Ricardo Leitner <marcelo.leitner@...il.com>
Subject: Re: [PATCHv2 net] team: team_port_add should check link_up before
 enable port

Tue, Dec 06, 2016 at 08:29:08AM CET, lucien.xin@...il.com wrote:
>Now when users add a nic to team dev, the option 'enable' of the port
>is true by default, as team_port_enable enables it after dev_open in
>team_port_add.
>
>But even if the port_dev has no carrier, like it's cable was unpluged,
>the port is still enabled. It leads to that team dev couldn't work well
>if this port was chosen to connect, and has no chance to change to use
>other ports if link_watch is ethtool.
>
>This patch is to enable the port only when the port_dev has carrier in
>team_port_add.
>
>v1 -> v2:
>  use netif_carrier_ok() instead of !!netif_carrier_ok(), as it returns
>  bool now.
>
>Signed-off-by: Xin Long <lucien.xin@...il.com>
>---
> drivers/net/team/team.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index a380649..4bc0103 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -1140,6 +1140,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
> 	struct net_device *dev = team->dev;
> 	struct team_port *port;
> 	char *portname = port_dev->name;
>+	bool linkup;
> 	int err;
> 
> 	if (port_dev->flags & IFF_LOOPBACK) {
>@@ -1249,9 +1250,12 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
> 
> 	port->index = -1;
> 	list_add_tail_rcu(&port->list, &team->port_list);
>-	team_port_enable(team, port);
>+	linkup = netif_carrier_ok(port_dev);
>+	if (linkup)
>+		team_port_enable(team, port);

This is obviously wrong change. It you use a simple setup without
userspace part (e.g. round robin), The port gets never enabled.
team_port_enabl is called from here and team_port_en_option_set.

By default, all ports should be enabled. Only in case the userspace
daemon decides to disable, it does so.

Could you send me the exact configuration where you see the issue?
This should be definitelly fixed in user part.

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ