summaryrefslogtreecommitdiff
path: root/net/ipv4/ipip.c
diff options
context:
space:
mode:
authorXiao Liang <shaw.leon@gmail.com>2025-02-19 20:50:32 +0800
committerJakub Kicinski <kuba@kernel.org>2025-02-21 15:28:02 -0800
commiteacb1160536e097ba1eb910a1b212d1032d2e9c6 (patch)
tree4af066d294f34002f7ca5a39c05047623490d165 /net/ipv4/ipip.c
parent9e17b2a1a097f3f3e8973722ccd3770eef193edd (diff)
net: ip_tunnel: 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. Convert common ip_tunnel_newlink() to accept an extra link netns argument. Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> Link: https://patch.msgid.link/20250219125039.18024-7-shaw.leon@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/ipv4/ipip.c')
-rw-r--r--net/ipv4/ipip.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index a8b844bcfc645..bab0bf90c908d 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -455,7 +455,8 @@ static int ipip_newlink(struct net_device *dev,
}
ipip_netlink_parms(data, &p, &t->collect_md, &fwmark);
- return ip_tunnel_newlink(dev, tb, &p, fwmark);
+ return ip_tunnel_newlink(params->link_net ? : dev_net(dev), dev, tb, &p,
+ fwmark);
}
static int ipip_changelink(struct net_device *dev, struct nlattr *tb[],