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: <51FDB9C7.4090703@redhat.com>
Date:	Sun, 04 Aug 2013 04:17:43 +0200
From:	Nikolay Aleksandrov <nikolay@...hat.com>
To:	netdev@...r.kernel.org
CC:	davem@...emloft.net, vfalico@...hat.com, fubar@...ibm.com,
	jhs@...atatu.com
Subject: Re: [PATCH net 1/2] vlan: make vlan_dev_real_dev work over stacked
 vlans

On 08/03/2013 10:07 PM, Nikolay Aleksandrov wrote:
> From: Nikolay Aleksandrov <Nikolay Aleksandrov nikolay@...hat.com>
> 
> 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 <nikolay@...hat.com>
> ---
>  net/8021q/vlan_core.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 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);
>  
> 
I have one question - why not make it possible to call vlan_dev_real_dev()
with any device (vlan/non-vlan) and make it return a real device in all
cases (e.g. if it's a non-vlan device simply return it) ?
In the terms of the code above - simply change:
struct net_device *ret = vlan_dev_priv(dev)->real_dev;
with
struct net_device *ret = dev;

This way we'll be able to simplify calls like if (is_vlan_dev(dev)) (or the
flag check alternative of this) to just vlan_dev_real_dev(). The old call
sites of this function will still work properly.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ