netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] team: prevent ipv6 link local address on port devices
@ 2022-12-05 17:46 Xin Long
  2022-12-05 18:39 ` Stephen Hemminger
  2022-12-06  8:05 ` Jiri Pirko
  0 siblings, 2 replies; 10+ messages in thread
From: Xin Long @ 2022-12-05 17:46 UTC (permalink / raw)
  To: network dev; +Cc: davem, kuba, Eric Dumazet, Paolo Abeni, Jiri Pirko, LiLiang

The similar fix from commit c2edacf80e15 ("bonding / ipv6: no addrconf
for slaves separately from master") is also needed in Team. Otherwise,
DAD and RS packets to be sent from the slaves in turn can confuse the
switches and cause them to incorrectly update their forwarding tables
as Liang noticed in the test with activebackup mode.

Note that the patch also sets IFF_MASTER flag for Team dev accordingly
while IFF_SLAVE flag is set for port devs. Although IFF_MASTER flag is
not really used in Team, it's good to show in 'ip link':

  eth1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP>
  team0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP>

Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device")
Reported-by: LiLiang <liali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 drivers/net/team/team.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 62ade69295a9..5b187913cfec 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1127,6 +1127,7 @@ static void team_upper_dev_unlink(struct team *team, struct team_port *port)
 {
 	netdev_upper_dev_unlink(port->dev, team->dev);
 	port->dev->priv_flags &= ~IFF_TEAM_PORT;
+	port->dev->flags &= ~IFF_SLAVE;
 }
 
 static void __team_port_change_port_added(struct team_port *port, bool linkup);
@@ -1212,6 +1213,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
 		goto err_port_enter;
 	}
 
+	port_dev->flags |= IFF_SLAVE;
 	err = dev_open(port_dev, extack);
 	if (err) {
 		netdev_dbg(dev, "Device %s opening failed\n",
@@ -1312,6 +1314,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
 	dev_close(port_dev);
 
 err_dev_open:
+	port_dev->flags &= ~IFF_SLAVE;
 	team_port_leave(team, port);
 	team_port_set_orig_dev_addr(port);
 
@@ -2171,6 +2174,7 @@ static void team_setup(struct net_device *dev)
 	dev->ethtool_ops = &team_ethtool_ops;
 	dev->needs_free_netdev = true;
 	dev->priv_destructor = team_destructor;
+	dev->flags |= IFF_MASTER;
 	dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
 	dev->priv_flags |= IFF_NO_QUEUE;
 	dev->priv_flags |= IFF_TEAM;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-12-09 11:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05 17:46 [PATCH net] team: prevent ipv6 link local address on port devices Xin Long
2022-12-05 18:39 ` Stephen Hemminger
2022-12-06  8:05 ` Jiri Pirko
2022-12-06 13:32   ` Xin Long
2022-12-06 21:52     ` Xin Long
2022-12-07 13:31       ` Jiri Pirko
2022-12-07 23:35         ` Xin Long
2022-12-08 11:19           ` Jiri Pirko
2022-12-08 17:07             ` Xin Long
2022-12-09 11:11               ` Jiri Pirko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).