diff options
author | Hannes Frederic Sowa <hannes@stressinduktion.org> | 2014-01-19 23:16:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-21 19:59:19 -0500 |
commit | 82b276cd2b0bacd58e7c307bf8856925a68c4d14 (patch) | |
tree | ffc8648efa91f83f81c94ac83447dc5246a835cf /net/l2tp | |
parent | 446fab59333dea91e54688f033dd8d788d0486fb (diff) |
ipv6: protect protocols not handling ipv4 from v4 connection/bind attempts
Some ipv6 protocols cannot handle ipv4 addresses, so we must not allow
connecting and binding to them. sendmsg logic does already check msg->name
for this but must trust already connected sockets which could be set up
for connection to ipv4 address family.
Per-socket flag ipv6only is of no use here, as it is under users control
by setsockopt.
Signed-off-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/l2tp')
-rw-r--r-- | net/l2tp/l2tp_ip6.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index aab5f74e91e6..7704ea9502fd 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c | |||
@@ -371,6 +371,9 @@ static int l2tp_ip6_connect(struct sock *sk, struct sockaddr *uaddr, | |||
371 | if (addr_len < sizeof(*lsa)) | 371 | if (addr_len < sizeof(*lsa)) |
372 | return -EINVAL; | 372 | return -EINVAL; |
373 | 373 | ||
374 | if (usin->sin6_family != AF_INET6) | ||
375 | return -EINVAL; | ||
376 | |||
374 | addr_type = ipv6_addr_type(&usin->sin6_addr); | 377 | addr_type = ipv6_addr_type(&usin->sin6_addr); |
375 | if (addr_type & IPV6_ADDR_MULTICAST) | 378 | if (addr_type & IPV6_ADDR_MULTICAST) |
376 | return -EINVAL; | 379 | return -EINVAL; |