summaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2009-03-24 16:24:48 +0000
committerDavid S. Miller <davem@davemloft.net>2009-03-24 19:49:09 -0700
commit783ed5a78373253052bc61a3c5c8b9f17af4e3c6 (patch)
treee927af1d258187767995fc77bda8eebf5a513077 /net/ipv6
parent4097f663cbe9e58de7ebed222f8af33267f297a8 (diff)
downloadop-kernel-dev-783ed5a78373253052bc61a3c5c8b9f17af4e3c6.zip
op-kernel-dev-783ed5a78373253052bc61a3c5c8b9f17af4e3c6.tar.gz
ipv6: Disallow binding to v4-mapped address on v6-only socket.
A socket marked v6-only, can not receive or send traffic to v4-mapped addresses. Thus allowing binding to v4-mapped address on such a socket makes no sense. 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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index fbf533c..7f092fa 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -276,6 +276,13 @@ int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
/* Check if the address belongs to the host. */
if (addr_type == IPV6_ADDR_MAPPED) {
+ /* Binding to v4-mapped address on a v6-only socket
+ * makes no sense
+ */
+ if (np->ipv6only) {
+ err = -EINVAL;
+ goto out;
+ }
v4addr = addr->sin6_addr.s6_addr32[3];
if (inet_addr_type(net, v4addr) != RTN_LOCAL) {
err = -EADDRNOTAVAIL;
OpenPOWER on IntegriCloud