diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2009-03-24 12:24:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-24 22:49:10 -0400 |
commit | 0f8d3c7ac3693d7b6c731bf2159273a59bf70e12 (patch) | |
tree | b1b5afc7a0c0475286dee7562cde523c9fbcdabe /net/ipv6 | |
parent | 783ed5a78373253052bc61a3c5c8b9f17af4e3c6 (diff) |
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: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r-- | net/ipv6/af_inet6.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 7f092fa912bd..9b6a37d16fb0 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -346,8 +346,11 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
346 | goto out; | 346 | goto out; |
347 | } | 347 | } |
348 | 348 | ||
349 | if (addr_type != IPV6_ADDR_ANY) | 349 | if (addr_type != IPV6_ADDR_ANY) { |
350 | sk->sk_userlocks |= SOCK_BINDADDR_LOCK; | 350 | sk->sk_userlocks |= SOCK_BINDADDR_LOCK; |
351 | if (addr_type != IPV6_ADDR_MAPPED) | ||
352 | np->ipv6only = 1; | ||
353 | } | ||
351 | if (snum) | 354 | if (snum) |
352 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; | 355 | sk->sk_userlocks |= SOCK_BINDPORT_LOCK; |
353 | inet->sport = htons(inet->num); | 356 | inet->sport = htons(inet->num); |