Commit 0f8d3c7a authored by Vlad Yasevich's avatar Vlad Yasevich Committed by David S. Miller

ipv6: Allow ipv4 wildcard binds after ipv6 address binds

The IPv4 wildcard (0.0.0.0) address does not intersect
in any way with explicit IPv6 addresses.  These two should
be permitted, but the IPv4 conflict code checks the ipv6only
bit as part of the test.  Since binding to an explicit IPv6
address restricts the socket to only that IPv6 address, the
side-effect is that the socket behaves as v6-only.  By
explicitely setting ipv6only in this case, allows the 2 binds
to succeed.
Signed-off-by: default avatarVlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 783ed5a7
...@@ -346,8 +346,11 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) ...@@ -346,8 +346,11 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
goto out; goto out;
} }
if (addr_type != IPV6_ADDR_ANY) if (addr_type != IPV6_ADDR_ANY) {
sk->sk_userlocks |= SOCK_BINDADDR_LOCK; sk->sk_userlocks |= SOCK_BINDADDR_LOCK;
if (addr_type != IPV6_ADDR_MAPPED)
np->ipv6only = 1;
}
if (snum) if (snum)
sk->sk_userlocks |= SOCK_BINDPORT_LOCK; sk->sk_userlocks |= SOCK_BINDPORT_LOCK;
inet->sport = htons(inet->num); inet->sport = htons(inet->num);
......
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