[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241218130909.2173-5-shaw.leon@gmail.com>
Date: Wed, 18 Dec 2024 21:09:02 +0800
From: Xiao Liang <shaw.leon@...il.com>
To: netdev@...r.kernel.org,
linux-kselftest@...r.kernel.org,
Kuniyuki Iwashima <kuniyu@...zon.com>,
Jakub Kicinski <kuba@...nel.org>,
Donald Hunter <donald.hunter@...il.com>,
Paolo Abeni <pabeni@...hat.com>
Cc: "David S. Miller" <davem@...emloft.net>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
Ido Schimmel <idosch@...dia.com>,
Andrew Lunn <andrew+netdev@...n.ch>,
Simon Horman <horms@...nel.org>,
Shuah Khan <shuah@...nel.org>,
Jiri Pirko <jiri@...nulli.us>,
Hangbin Liu <liuhangbin@...il.com>,
linux-rdma@...r.kernel.org,
linux-can@...r.kernel.org,
osmocom-net-gprs@...ts.osmocom.org,
bpf@...r.kernel.org,
linux-ppp@...r.kernel.org,
wireguard@...ts.zx2c4.com,
linux-wireless@...r.kernel.org,
b.a.t.m.a.n@...ts.open-mesh.org,
bridge@...ts.linux.dev,
linux-wpan@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH net-next v6 04/11] ieee802154: 6lowpan: Use link netns in newlink() of rtnl_link_ops
When link_net is set, use it as link netns instead of dev_net(). This
prepares for rtnetlink core to create device in target netns directly,
in which case the two namespaces may be different.
Signed-off-by: Xiao Liang <shaw.leon@...il.com>
---
net/ieee802154/6lowpan/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ieee802154/6lowpan/core.c b/net/ieee802154/6lowpan/core.c
index c16c14807d87..65a5c61cf38c 100644
--- a/net/ieee802154/6lowpan/core.c
+++ b/net/ieee802154/6lowpan/core.c
@@ -143,7 +143,8 @@ static int lowpan_newlink(struct rtnl_newlink_params *params)
if (!tb[IFLA_LINK])
return -EINVAL;
/* find and hold wpan device */
- wdev = dev_get_by_index(dev_net(ldev), nla_get_u32(tb[IFLA_LINK]));
+ wdev = dev_get_by_index(params->link_net ? : dev_net(ldev),
+ nla_get_u32(tb[IFLA_LINK]));
if (!wdev)
return -ENODEV;
if (wdev->type != ARPHRD_IEEE802154) {
--
2.47.1
Powered by blists - more mailing lists