Commit 000224c1 authored by Guillaume Nault's avatar Guillaume Nault Committed by Greg Kroah-Hartman

l2tp: consider '::' as wildcard address in l2tp_ip6 socket lookup


[ Upstream commit 97b84fd6 ]

An L2TP socket bound to the unspecified address should match with any
address. If not, it can't receive any packet and __l2tp_ip6_bind_lookup()
can't prevent another socket from binding on the same device/tunnel ID.

While there, rename the 'addr' variable to 'sk_laddr' (local addr), to
make following patch clearer.
Signed-off-by: default avatarGuillaume Nault <g.nault@alphalink.fr>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c2804b21
...@@ -64,7 +64,7 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, ...@@ -64,7 +64,7 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
struct sock *sk; struct sock *sk;
sk_for_each_bound(sk, &l2tp_ip6_bind_table) { sk_for_each_bound(sk, &l2tp_ip6_bind_table) {
const struct in6_addr *addr = inet6_rcv_saddr(sk); const struct in6_addr *sk_laddr = inet6_rcv_saddr(sk);
struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk);
if (l2tp == NULL) if (l2tp == NULL)
...@@ -72,7 +72,7 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, ...@@ -72,7 +72,7 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
if ((l2tp->conn_id == tunnel_id) && if ((l2tp->conn_id == tunnel_id) &&
net_eq(sock_net(sk), net) && net_eq(sock_net(sk), net) &&
(!addr || ipv6_addr_equal(addr, laddr)) && (!sk_laddr || ipv6_addr_any(sk_laddr) || ipv6_addr_equal(sk_laddr, laddr)) &&
(!sk->sk_bound_dev_if || !dif || (!sk->sk_bound_dev_if || !dif ||
sk->sk_bound_dev_if == dif)) sk->sk_bound_dev_if == dif))
goto found; goto found;
......
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