ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
Subsystems (4)
PATCH 1/1 ip6_vti: fix incorrect tunnel matching in vti6_tnl_lookup()
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.
--- net/ipv6/ip6_vti.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/ip6_vti.c +2 -0
@@ -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; }
Signature · 1 line
2.54.0.1064.gd145956f57-goog
Le 08/06/2026 à 18:46, Eric Dumazet a écrit :
Quoted 12 lines
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.
Quoted 7 lines
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 <[email protected]>Cc Steffen Klassert <[email protected]>
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 10 lines · 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html