[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250206165132.2898347-3-nicolas.dichtel@6wind.com>
Date: Thu, 6 Feb 2025 17:50:27 +0100
From: Nicolas Dichtel <nicolas.dichtel@...nd.com>
To: "David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Eric Dumazet <edumazet@...gle.com>,
Alexander Lobakin <aleksander.lobakin@...el.com>
Cc: netdev@...r.kernel.org,
Nicolas Dichtel <nicolas.dichtel@...nd.com>
Subject: [PATCH net 2/2] net: enhance error message for 'netns local' iface
The current message is "Invalid argument". Let's help the user by
explaining the error.
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@...nd.com>
---
net/core/rtnetlink.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 5032e65b8faa..91b358bdfe5c 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -3024,8 +3024,12 @@ static int do_setlink(const struct sk_buff *skb, struct net_device *dev,
new_ifindex = nla_get_s32_default(tb[IFLA_NEW_IFINDEX], 0);
err = __dev_change_net_namespace(dev, tgt_net, pat, new_ifindex);
- if (err)
+ if (err) {
+ if (dev->netns_local)
+ NL_SET_ERR_MSG(extack,
+ "The interface has the 'netns local' property");
goto errout;
+ }
status |= DO_SETLINK_MODIFIED;
}
--
2.47.1
Powered by blists - more mailing lists