Skip to content

Commit 68d00f3

Browse files
Vadim Fedorenkodavem330
authored andcommitted
ip6_tunnel: fix ip6_tnl_lookup
The commit ea3dc96 ("ip6_tunnel: Add support for wildcard tunnel endpoints.") introduces support for wildcards in tunnels endpoints, but in some rare circumstances ip6_tnl_lookup selects wrong tunnel interface relying only on source or destination address of the packet and not checking presence of wildcard in tunnels endpoints. Later in ip6_tnl_rcv this packets can be dicarded because of difference in ipproto even if fallback device have proper ipproto configuration. This patch adds checks of wildcard endpoint in tunnel avoiding such behavior Fixes: ea3dc96 ("ip6_tunnel: Add support for wildcard tunnel endpoints.") Signed-off-by: Vadim Fedorenko <junk@yandex-team.ru> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 29fbff8 commit 68d00f3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/ipv6/ip6_tunnel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,15 @@ ip6_tnl_lookup(struct net *net, const struct in6_addr *remote, const struct in6_
157157
hash = HASH(&any, local);
158158
for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
159159
if (ipv6_addr_equal(local, &t->parms.laddr) &&
160+
ipv6_addr_any(&t->parms.raddr) &&
160161
(t->dev->flags & IFF_UP))
161162
return t;
162163
}
163164

164165
hash = HASH(remote, &any);
165166
for_each_ip6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
166167
if (ipv6_addr_equal(remote, &t->parms.raddr) &&
168+
ipv6_addr_any(&t->parms.laddr) &&
167169
(t->dev->flags & IFF_UP))
168170
return t;
169171
}

0 commit comments

Comments
 (0)