Subject: Re: [patch net-next rfc 3/7] net: rtnetlink: add commands to add and delete alternative ifnames

From: Jakub Kicinski <[email-masked]>
Date: Fri, 19 Jul 2019 20:58:49 -0700

On Fri, 19 Jul 2019 13:00:25 +0200, Jiri Pirko wrote:
> +int netdev_name_node_alt_destroy(struct net_device *dev, char *name)
> +{
> +	struct netdev_name_node *name_node;
> +	struct net *net = dev_net(dev);
> +
> +	name_node = netdev_name_node_lookup(net, name);
> +	if (!name_node)
> +		return -ENOENT;
> +	__netdev_name_node_alt_destroy(name_node);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(netdev_name_node_alt_destroy);

I was surprised to see the exports are they strictly necessary?
Just wondering..

> @@ -8258,6 +8313,7 @@ static void rollback_registered_many(struct list_head *head)
>  		dev_uc_flush(dev);
>  		dev_mc_flush(dev);
>  
> +		netdev_name_node_alt_flush(dev);
>  		netdev_name_node_free(dev->name_node);
>  
>  		if (dev->netdev_ops->ndo_uninit)
> diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
> index 1ee6460f8275..7a2010b16e10 100644
> --- a/net/core/rtnetlink.c
> +++ b/net/core/rtnetlink.c
> @@ -1750,6 +1750,8 @@ static const struct nla_policy ifla_policy[IFLA_MAX+1] = {
>  	[IFLA_CARRIER_DOWN_COUNT] = { .type = NLA_U32 },
>  	[IFLA_MIN_MTU]		= { .type = NLA_U32 },
>  	[IFLA_MAX_MTU]		= { .type = NLA_U32 },
> +	[IFLA_ALT_IFNAME_MOD]	= { .type = NLA_STRING,
> +				    .len = ALTIFNAMSIZ - 1 },

Should we set:

	.strict_start_type = IFLA_ALT_IFNAME_MOD

?

>  };
>  
>  static const struct nla_policy ifla_info_policy[IFLA_INFO_MAX+1] = {