Thread (10 messages) flat view 10 messages, 5 authors, 2025-02-07
STALE576d

Revision v1 of 5 in this series.

Revisions (5)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 [diff vs current]
  5. v5 [diff vs current]

[PATCH net 2/2] net: enhance error message for 'netns local' iface

From: Nicolas Dichtel <hidden>
Date: 2025-02-06 16:51:39
Subsystem: networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

The current message is "Invalid argument". Let's help the user by
explaining the error.

Signed-off-by: Nicolas Dichtel <redacted>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help