mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
446fab5933
commit
82b276cd2b
6 changed files with 24 additions and 2 deletions
|
|
@ -320,6 +320,9 @@ static int ping_check_bind_addr(struct sock *sk, struct inet_sock *isk,
|
|||
if (addr_len < sizeof(*addr))
|
||||
return -EINVAL;
|
||||
|
||||
if (addr->sin6_family != AF_INET6)
|
||||
return -EINVAL;
|
||||
|
||||
pr_debug("ping_check_bind_addr(sk=%p,addr=%pI6c,port=%d)\n",
|
||||
sk, addr->sin6_addr.s6_addr, ntohs(addr->sin6_port));
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue