Commit fbe68ee8 authored by Steffen Klassert's avatar Steffen Klassert

vti6: Add a lookup method for tunnels with wildcard endpoints.

Currently we can't lookup tunnels with wildcard endpoints.
This patch adds a method to lookup these tunnels in the
receive path.
Signed-off-by: default avatarSteffen Klassert <steffen.klassert@secunet.com>
parent 12bfa8bd
...@@ -95,6 +95,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote, ...@@ -95,6 +95,7 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote,
unsigned int hash = HASH(remote, local); unsigned int hash = HASH(remote, local);
struct ip6_tnl *t; struct ip6_tnl *t;
struct vti6_net *ip6n = net_generic(net, vti6_net_id); struct vti6_net *ip6n = net_generic(net, vti6_net_id);
struct in6_addr any;
for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) { for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
if (ipv6_addr_equal(local, &t->parms.laddr) && if (ipv6_addr_equal(local, &t->parms.laddr) &&
...@@ -102,6 +103,22 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote, ...@@ -102,6 +103,22 @@ vti6_tnl_lookup(struct net *net, const struct in6_addr *remote,
(t->dev->flags & IFF_UP)) (t->dev->flags & IFF_UP))
return t; return t;
} }
memset(&any, 0, sizeof(any));
hash = HASH(&any, local);
for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
if (ipv6_addr_equal(local, &t->parms.laddr) &&
(t->dev->flags & IFF_UP))
return t;
}
hash = HASH(remote, &any);
for_each_vti6_tunnel_rcu(ip6n->tnls_r_l[hash]) {
if (ipv6_addr_equal(remote, &t->parms.raddr) &&
(t->dev->flags & IFF_UP))
return t;
}
t = rcu_dereference(ip6n->tnls_wc[0]); t = rcu_dereference(ip6n->tnls_wc[0]);
if (t && (t->dev->flags & IFF_UP)) if (t && (t->dev->flags & IFF_UP))
return t; return t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment