[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250226224117.47418-1-kuniyu@amazon.com>
Date: Wed, 26 Feb 2025 14:41:17 -0800
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <nicolas.dichtel@...nd.com>
CC: <aleksander.lobakin@...el.com>, <andrew@...n.ch>, <davem@...emloft.net>,
<edumazet@...gle.com>, <idosch@...sch.org>, <kuba@...nel.org>,
<kuniyu@...zon.com>, <netdev@...r.kernel.org>, <pabeni@...hat.com>
Subject: Re: [PATCH net-next v5 3/3] net: plumb extack in __dev_change_net_namespace()
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
Date: Wed, 26 Feb 2025 10:31:58 +0100
> It could be hard to understand why the netlink command fails. For example,
> if dev->netns_immutable is set, the error is "Invalid argument".
>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
> Reviewed-by: Eric Dumazet <edumazet@...gle.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
I left two small comments but am not sure if it's worth respin.
> @@ -12041,30 +12047,48 @@ int __dev_change_net_namespace(struct net_device *dev, struct net *net,
> err = -EEXIST;
> if (netdev_name_in_use(net, dev->name)) {
> /* We get here if we can't use the current device name */
> - if (!pat)
> + if (!pat) {
> + NL_SET_ERR_MSG(extack,
> + "An interface with the same name exists in the target netns");
> goto out;
> + }
> err = dev_prep_valid_name(net, dev, pat, new_name, EEXIST);
> - if (err < 0)
> + if (err < 0) {
> + NL_SET_ERR_MSG_FMT(extack,
> + "Unable to use '%s' for the new interface name",
Only this message does not have "in the target netns".
> + pat);
> goto out;
> + }
> }
> /* Check that none of the altnames conflicts. */
> err = -EEXIST;
> netdev_for_each_altname(dev, name_node)
I'd add { here
> - if (netdev_name_in_use(net, name_node->name))
> + if (netdev_name_in_use(net, name_node->name)) {
> + NL_SET_ERR_MSG_FMT(extack,
> + "An interface with the altname %s exists in the target netns",
> + name_node->name);
> goto out;
> + }
and } here.
Powered by blists - more mailing lists