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

From: Jiri Pirko <[email-masked]>
Date: Sat, 20 Jul 2019 09:20:37 +0200

Sat, Jul 20, 2019 at 05:58:49AM CEST, [email-masked] wrote:
>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?

Well I call them from net/core/rtnetlink.c, so yes. Maybe I'm missing
your point...

>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

Probably yes. Will add it.

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