Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vlan: fix bond/team enslave of vlan challenged slave/port

In vlan_uses_dev() check for number of vlan devs rather than existence
of vlan_info. The reason is that vlan id 0 is there without appropriate
vlan dev on it by default which prevented from enslaving vlan challenged
dev.

Reported-by: Jon Stanley <jstanley@rmrf.net>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Jiri Pirko and committed by
David S. Miller
55462cf3 73b7656c

+9 -2
+1 -1
drivers/net/bonding/bond_main.c
··· 1519 1519 /* no need to lock since we're protected by rtnl_lock */ 1520 1520 if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) { 1521 1521 pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name); 1522 - if (bond_vlan_used(bond)) { 1522 + if (vlan_uses_dev(bond_dev)) { 1523 1523 pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", 1524 1524 bond_dev->name, slave_dev->name, bond_dev->name); 1525 1525 return -EPERM;
+8 -1
net/8021q/vlan_core.c
··· 366 366 367 367 bool vlan_uses_dev(const struct net_device *dev) 368 368 { 369 - return rtnl_dereference(dev->vlan_info) ? true : false; 369 + struct vlan_info *vlan_info; 370 + 371 + ASSERT_RTNL(); 372 + 373 + vlan_info = rtnl_dereference(dev->vlan_info); 374 + if (!vlan_info) 375 + return false; 376 + return vlan_info->grp.nr_vlan_devs ? true : false; 370 377 } 371 378 EXPORT_SYMBOL(vlan_uses_dev);