[Devel] [PATCH vz9] vlan: set NETIF_F_VIRTUAL flag before it is checked

Nikita Yushchenko nikita.yushchenko at virtuozzo.com
Mon Feb 21 13:50:30 MSK 2022


Please disregard. Will send a more generic version now.

> Setting NETIF_F_VIRTUAL in vlan_dev_init() is too late: vlan_dev_init()
> is .ndo_init method, that is called from register_netdevice() later than
> ve_is_dev_movable() that uses that flag.
> 
> Proper location to set the flag is vlan_setup() which is the setup
> method called at netdev creation time.
> 
> Feature: net: whitelist allowed Container network devices
> 
> Signed-off-by: Nikita Yushchenko <nikita.yushchenko at virtuozzo.com>
> ---
>   net/8021q/vlan_dev.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index dde3d3e32092..1a468888b4b9 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -573,9 +573,6 @@ static int vlan_dev_init(struct net_device *dev)
>   			   NETIF_F_ALL_FCOE;
>   
>   	dev->features |= dev->hw_features | NETIF_F_LLTX;
> -#ifdef CONFIG_VE
> -	dev->ve_features = NETIF_F_VIRTUAL;
> -#endif
>   	dev->gso_max_size = real_dev->gso_max_size;
>   	dev->gso_max_segs = real_dev->gso_max_segs;
>   	if (dev->features & NETIF_F_VLAN_FEATURES)
> @@ -866,4 +863,8 @@ void vlan_setup(struct net_device *dev)
>   	dev->max_mtu		= ETH_MAX_MTU;
>   
>   	eth_zero_addr(dev->broadcast);
> +
> +#ifdef CONFIG_VE
> +	dev->ve_features = NETIF_F_VIRTUAL;
> +#endif
>   }



More information about the Devel mailing list