Skip to content

Commit 62cbbf8

Browse files
author
Guillaume Nault
committed
net: Fix netns for ip_tunnel_init_flow()
JIRA: https://issues.redhat.com/browse/RHEL-73391 Upstream Status: linux.git Conflicts: * Missing upstream commit ac931d4 ("ipip,ip_tunnel,sit: Add FOU support for externally controlled ipip devices"): No "if (!tunnel_hlen)" in ip_md_tunnel_xmit() in RHEL 9. * Missing upstream commit e7191e5 ("ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_bind_dev()"): RHEL 9 still uses RT_TOS() in ip_tunnel_bind_dev(), instead of just masking the ECN bits with INET_DSCP_MASK. * Missing upstream commit c34cfe7 ("ipv4: ip_tunnel: Unmask upper DSCP bits in ip_md_tunnel_xmit()"): RHEL 9 still uses RT_TOS() in ip_md_tunnel_xmit(), instead of just masking the ECN bits with INET_DSCP_MASK. * Missing upstream commit c2b639f ("ipv4: ip_tunnel: Unmask upper DSCP bits in ip_tunnel_xmit()"): RHEL 9 still uses RT_TOS() in ip_tunnel_xmit(), instead of just masking the ECN bits with INET_DSCP_MASK. commit b5a7b66 Author: Xiao Liang <shaw.leon@gmail.com> Date: Thu Dec 19 21:03:36 2024 +0800 net: Fix netns for ip_tunnel_init_flow() The device denoted by tunnel->parms.link resides in the underlay net namespace. Therefore pass tunnel->net to ip_tunnel_init_flow(). Fixes: db53cd3 ("net: Handle l3mdev in ip_tunnel_init_flow") Signed-off-by: Xiao Liang <shaw.leon@gmail.com> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Link: https://patch.msgid.link/20241219130336.103839-1-shaw.leon@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Guillaume Nault <gnault@redhat.com>
1 parent 4b871f4 commit 62cbbf8

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

drivers/net/ethernet/mellanox/mlxsw/spectrum_span.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,7 @@ mlxsw_sp_span_gretap4_route(const struct net_device *to_dev,
423423

424424
parms = mlxsw_sp_ipip_netdev_parms4(to_dev);
425425
ip_tunnel_init_flow(&fl4, parms.iph.protocol, *daddrp, *saddrp,
426-
0, 0, dev_net(to_dev), parms.link, tun->fwmark, 0,
427-
0);
426+
0, 0, tun->net, parms.link, tun->fwmark, 0, 0);
428427

429428
rt = ip_route_output_key(tun->net, &fl4);
430429
if (IS_ERR(rt))

net/ipv4/ip_tunnel.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static int ip_tunnel_bind_dev(struct net_device *dev)
293293

294294
ip_tunnel_init_flow(&fl4, iph->protocol, iph->daddr,
295295
iph->saddr, tunnel->parms.o_key,
296-
RT_TOS(iph->tos), dev_net(dev),
296+
RT_TOS(iph->tos), tunnel->net,
297297
tunnel->parms.link, tunnel->fwmark, 0, 0);
298298
rt = ip_route_output_key(tunnel->net, &fl4);
299299

@@ -596,7 +596,7 @@ void ip_md_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
596596
}
597597
ip_tunnel_init_flow(&fl4, proto, key->u.ipv4.dst, key->u.ipv4.src,
598598
tunnel_id_to_key32(key->tun_id), RT_TOS(tos),
599-
dev_net(dev), 0, skb->mark, skb_get_hash(skb),
599+
tunnel->net, 0, skb->mark, skb_get_hash(skb),
600600
key->flow_flags);
601601
if (tunnel->encap.type != TUNNEL_ENCAP_NONE)
602602
goto tx_error;
@@ -755,7 +755,7 @@ void ip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev,
755755

756756
ip_tunnel_init_flow(&fl4, protocol, dst, tnl_params->saddr,
757757
tunnel->parms.o_key, RT_TOS(tos),
758-
dev_net(dev), READ_ONCE(tunnel->parms.link),
758+
tunnel->net, READ_ONCE(tunnel->parms.link),
759759
tunnel->fwmark, skb_get_hash(skb), 0);
760760

761761
if (ip_tunnel_encap(skb, tunnel, &protocol, &fl4) < 0)

0 commit comments

Comments
 (0)