All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch net] vlan: fix bond/team enslave of vlan challenged slave/port
@ 2012-10-14 14:30 Jiri Pirko
  2012-10-15 14:53 ` Jon Stanley
  2012-10-16 18:56 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Jiri Pirko @ 2012-10-14 14:30 UTC (permalink / raw)
  To: netdev; +Cc: davem, fubar, andy, kaber, jstanley

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>
---
 drivers/net/bonding/bond_main.c | 2 +-
 net/8021q/vlan_core.c           | 9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b721902..b2530b0 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1519,7 +1519,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
 	/* no need to lock since we're protected by rtnl_lock */
 	if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
 		pr_debug("%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->name);
-		if (bond_vlan_used(bond)) {
+		if (vlan_uses_dev(bond_dev)) {
 			pr_err("%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
 			       bond_dev->name, slave_dev->name, bond_dev->name);
 			return -EPERM;
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index fbbf1fa..65e06ab 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -366,6 +366,13 @@ EXPORT_SYMBOL(vlan_vids_del_by_dev);
 
 bool vlan_uses_dev(const struct net_device *dev)
 {
-	return rtnl_dereference(dev->vlan_info) ? true : false;
+	struct vlan_info *vlan_info;
+
+	ASSERT_RTNL();
+
+	vlan_info = rtnl_dereference(dev->vlan_info);
+	if (!vlan_info)
+		return false;
+	return vlan_info->grp.nr_vlan_devs ? true : false;
 }
 EXPORT_SYMBOL(vlan_uses_dev);
-- 
1.7.11.4

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

* Re: [patch net] vlan: fix bond/team enslave of vlan challenged slave/port
  2012-10-14 14:30 [patch net] vlan: fix bond/team enslave of vlan challenged slave/port Jiri Pirko
@ 2012-10-15 14:53 ` Jon Stanley
  2012-10-15 20:38   ` Jon Stanley
  2012-10-16 18:56 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Jon Stanley @ 2012-10-15 14:53 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, fubar, andy, kaber

On Sun, Oct 14, 2012 at 10:30 AM, Jiri Pirko <jiri@resnulli.us> wrote:

> 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.

Thanks for the patch!

However, I'm now running into a new issue. Note that I've backported
this to an older kernel (3.3.2, eww), but I don't *think* that matters
for this. Now I'm getting a "refused to change device type" which
looks like it comes from around here:

                        res = netdev_bonding_change(bond_dev,
                                                    NETDEV_PRE_TYPE_CHANGE);
                        res = notifier_to_errno(res);
                        if (res) {
                                pr_err("%s: refused to change device type\n",
                                       bond_dev->name);

I'm not quite smart enough to figure out what's going on here. FWIW,
looking back in history it looks like the only relevant change from
here to mainline is the replacement of netdev_bonding_change() with
direct calls to call_netdevice_notifiers().

Again, .let me know if more info is needed, and thanks for the quick response!

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

* Re: [patch net] vlan: fix bond/team enslave of vlan challenged slave/port
  2012-10-15 14:53 ` Jon Stanley
@ 2012-10-15 20:38   ` Jon Stanley
  2012-10-16 12:59     ` Jiri Pirko
  0 siblings, 1 reply; 5+ messages in thread
From: Jon Stanley @ 2012-10-15 20:38 UTC (permalink / raw)
  To: Jiri Pirko; +Cc: netdev, davem, fubar, andy, kaber

On Mon, Oct 15, 2012 at 10:53 AM, Jon Stanley <jstanley@rmrf.net> wrote:

> However, I'm now running into a new issue. Note that I've backported
> this to an older kernel (3.3.2, eww)

My bad, I tried this on mainline and it works fine. Any pointers on
what needs to get backported into 3.3 before I go pulling my hair out
over it? :)

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

* Re: [patch net] vlan: fix bond/team enslave of vlan challenged slave/port
  2012-10-15 20:38   ` Jon Stanley
@ 2012-10-16 12:59     ` Jiri Pirko
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Pirko @ 2012-10-16 12:59 UTC (permalink / raw)
  To: Jon Stanley; +Cc: netdev, davem, fubar, andy, kaber

Mon, Oct 15, 2012 at 10:38:44PM CEST, jstanley@rmrf.net wrote:
>On Mon, Oct 15, 2012 at 10:53 AM, Jon Stanley <jstanley@rmrf.net> wrote:
>
>> However, I'm now running into a new issue. Note that I've backported
>> this to an older kernel (3.3.2, eww)
>
>My bad, I tried this on mainline and it works fine. Any pointers on
>what needs to get backported into 3.3 before I go pulling my hair out
>over it? :)

I can't think about anything atm. Happy hair pulling :)

>--
>To unsubscribe from this list: send the line "unsubscribe netdev" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [patch net] vlan: fix bond/team enslave of vlan challenged slave/port
  2012-10-14 14:30 [patch net] vlan: fix bond/team enslave of vlan challenged slave/port Jiri Pirko
  2012-10-15 14:53 ` Jon Stanley
@ 2012-10-16 18:56 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2012-10-16 18:56 UTC (permalink / raw)
  To: jiri; +Cc: netdev, fubar, andy, kaber, jstanley

From: Jiri Pirko <jiri@resnulli.us>
Date: Sun, 14 Oct 2012 16:30:56 +0200

> 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>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2012-10-16 18:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-14 14:30 [patch net] vlan: fix bond/team enslave of vlan challenged slave/port Jiri Pirko
2012-10-15 14:53 ` Jon Stanley
2012-10-15 20:38   ` Jon Stanley
2012-10-16 12:59     ` Jiri Pirko
2012-10-16 18:56 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.