From: nikolay@redhat.com Date: Sat, 3 Aug 2013 20:07:46 +0000 (+0200) Subject: vlan: make vlan_dev_real_dev work over stacked vlans X-Git-Tag: v3.12-rc1~259^2~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0369722f024cd374f74eac6d261014403aa27ea2;p=kernel%2Fkernel-generic.git vlan: make vlan_dev_real_dev work over stacked vlans Sometimes we might have stacked vlans on top of each other, and we're interested in the first non-vlan real device on the path, so transform vlan_dev_real_dev to go over the stacked vlans and extract the first non-vlan device. Signed-off-by: Nikolay Aleksandrov Signed-off-by: Veaceslav Falico Signed-off-by: David S. Miller --- diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c index 4a78c4d..6ee48aa 100644 --- a/net/8021q/vlan_core.c +++ b/net/8021q/vlan_core.c @@ -91,7 +91,12 @@ EXPORT_SYMBOL(__vlan_find_dev_deep); struct net_device *vlan_dev_real_dev(const struct net_device *dev) { - return vlan_dev_priv(dev)->real_dev; + struct net_device *ret = vlan_dev_priv(dev)->real_dev; + + while (is_vlan_dev(ret)) + ret = vlan_dev_priv(ret)->real_dev; + + return ret; } EXPORT_SYMBOL(vlan_dev_real_dev);