* [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
@ 2026-06-08 16:46 Eric Dumazet
2026-06-10 7:46 ` Nicolas Dichtel
2026-06-10 15:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2026-06-08 16:46 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Ido Schimmel, David Ahern, netdev, eric.dumazet,
Eric Dumazet, Steffen Klassert
In vti6_tnl_lookup(), when an exact match for a tunnel fails,
the code falls back to searching for wildcard tunnels:
- Tunnels matching the packet's local address, with any remote address
wildcard remote).
- Tunnels matching the packet's remote address, with any local address
(wildcard local).
However, vti6 stores all these different types of tunnels in the same
hash table (ip6n->tnls_r_l) prone to hash collisions.
The bug is that the fallback search loops in vti6_tnl_lookup() were
missing checks to ensure that the candidate tunnel actually has
a wildcard address.
Fixes: fbe68ee87522 ("vti6: Add a lookup method for tunnels with wildcard endpoints.")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
---
net/ipv6/ip6_vti.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c
index df793c8bfffb0a26ea7f54933b88bccc9b1aa495..8b2c59c8eb27ea659615c8894d8f5e37e7298870 100644
--- a/net/ipv6/ip6_vti.c
+++ b/net/ipv6/ip6_vti.c
@@ -106,6 +106,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote,
hash = HASH(&any, local);
for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
if (ipv6_addr_equal(local, &t->parms.laddr) &&
+ ipv6_addr_any(&t->parms.raddr) &&
(t->dev->flags & IFF_UP))
return t;
}
@@ -113,6 +114,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote,
hash = HASH(remote, &any);
for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
if (ipv6_addr_equal(remote, &t->parms.raddr) &&
+ ipv6_addr_any(&t->parms.laddr) &&
(t->dev->flags & IFF_UP))
return t;
}
--
2.54.0.1064.gd145956f57-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
2026-06-08 16:46 [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup() Eric Dumazet
@ 2026-06-10 7:46 ` Nicolas Dichtel
2026-06-10 15:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Dichtel @ 2026-06-10 7:46 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Ido Schimmel, David Ahern, netdev, eric.dumazet,
Steffen Klassert
Le 08/06/2026 à 18:46, Eric Dumazet a écrit :
> In vti6_tnl_lookup(), when an exact match for a tunnel fails,
> the code falls back to searching for wildcard tunnels:
>
> - Tunnels matching the packet's local address, with any remote address
> wildcard remote).
>
> - Tunnels matching the packet's remote address, with any local address
> (wildcard local).
>
> However, vti6 stores all these different types of tunnels in the same
> hash table (ip6n->tnls_r_l) prone to hash collisions.
>
> The bug is that the fallback search loops in vti6_tnl_lookup() were
> missing checks to ensure that the candidate tunnel actually has
> a wildcard address.
>
> Fixes: fbe68ee87522 ("vti6: Add a lookup method for tunnels with wildcard endpoints.")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
2026-06-08 16:46 [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup() Eric Dumazet
2026-06-10 7:46 ` Nicolas Dichtel
@ 2026-06-10 15:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-06-10 15:20 UTC (permalink / raw)
To: Eric Dumazet
Cc: davem, kuba, pabeni, horms, idosch, dsahern, netdev, eric.dumazet,
steffen.klassert
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 8 Jun 2026 16:46:13 +0000 you wrote:
> In vti6_tnl_lookup(), when an exact match for a tunnel fails,
> the code falls back to searching for wildcard tunnels:
>
> - Tunnels matching the packet's local address, with any remote address
> wildcard remote).
>
> - Tunnels matching the packet's remote address, with any local address
> (wildcard local).
>
> [...]
Here is the summary with links:
- [net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
https://git.kernel.org/netdev/net/c/a5c0359f5cbc
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-10 15:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08 16:46 [PATCH net] ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup() Eric Dumazet
2026-06-10 7:46 ` Nicolas Dichtel
2026-06-10 15:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox