diff options
author | Guillaume Nault <g.nault@alphalink.fr> | 2016-11-29 13:09:48 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-11-30 20:14:08 +0100 |
commit | 31e2f21fb35bfaa5bdbe1a4860dc99e6b10d8dcd (patch) | |
tree | 9546bf8fd1837769d8ff63d13acac5a1f57e5a9a /net/l2tp/l2tp_ip6.c | |
parent | l2tp: fix lookup for sockets not bound to a device in l2tp_ip (diff) | |
download | linux-31e2f21fb35bfaa5bdbe1a4860dc99e6b10d8dcd.tar.xz linux-31e2f21fb35bfaa5bdbe1a4860dc99e6b10d8dcd.zip |
l2tp: fix address test in __l2tp_ip6_bind_lookup()
The '!(addr && ipv6_addr_equal(addr, laddr))' part of the conditional
matches if addr is NULL or if addr != laddr.
But the intend of __l2tp_ip6_bind_lookup() is to find a sockets with
the same address, so the ipv6_addr_equal() condition needs to be
inverted.
For better clarity and consistency with the rest of the expression, the
(!X || X == Y) notation is used instead of !(X && X != Y).
Signed-off-by: Guillaume Nault <g.nault@alphalink.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp/l2tp_ip6.c')
-rw-r--r-- | net/l2tp/l2tp_ip6.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 4a8644001d09..aa821cb639e5 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -72,7 +72,7 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net, if ((l2tp->conn_id == tunnel_id) && net_eq(sock_net(sk), net) && - !(addr && ipv6_addr_equal(addr, laddr)) && + (!addr || ipv6_addr_equal(addr, laddr)) && (!sk->sk_bound_dev_if || !dif || sk->sk_bound_dev_if == dif)) goto found; |