summaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
authorVlad Yasevich <vladislav.yasevich@hp.com>2008-07-19 08:05:40 +0200
committerDavid S. Miller <davem@davemloft.net>2008-07-19 08:05:40 +0200
commit7dab83de50c7b2b7ceac695a0b56fa6c0f95b0bc (patch)
tree979c6905f2ef643acccfea9ab9ed926e764e72c8 /net/sctp/protocol.c
parentsctp: Prevent uninitialized memory access (diff)
downloadlinux-7dab83de50c7b2b7ceac695a0b56fa6c0f95b0bc.tar.xz
linux-7dab83de50c7b2b7ceac695a0b56fa6c0f95b0bc.zip
sctp: Support ipv6only AF_INET6 sockets.
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index dd811a8456a8..cdd881142f2c 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -381,6 +381,10 @@ static int sctp_v4_addr_valid(union sctp_addr *addr,
struct sctp_sock *sp,
const struct sk_buff *skb)
{
+ /* IPv4 addresses not allowed */
+ if (sp && ipv6_only_sock(sctp_opt2sk(sp)))
+ return 0;
+
/* Is this a non-unicast address or a unusable SCTP address? */
if (IS_IPV4_UNUSABLE_ADDRESS(addr->v4.sin_addr.s_addr))
return 0;
@@ -404,6 +408,9 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
!sysctl_ip_nonlocal_bind)
return 0;
+ if (ipv6_only_sock(sctp_opt2sk(sp)))
+ return 0;
+
return 1;
}