diff options
author | Vlad Yasevich <vladislav.yasevich@hp.com> | 2008-07-19 02:05:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-19 02:05:40 -0400 |
commit | 7dab83de50c7b2b7ceac695a0b56fa6c0f95b0bc (patch) | |
tree | 979c6905f2ef643acccfea9ab9ed926e764e72c8 /net/sctp/ipv6.c | |
parent | 6d0ccbac688207ca0616ab5094932af4db4747b3 (diff) |
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/ipv6.c')
-rw-r--r-- | net/sctp/ipv6.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index a2f4d4d51593..a238d6834b33 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -818,7 +818,7 @@ static int sctp_inet6_af_supported(sa_family_t family, struct sctp_sock *sp) | |||
818 | return 1; | 818 | return 1; |
819 | /* v4-mapped-v6 addresses */ | 819 | /* v4-mapped-v6 addresses */ |
820 | case AF_INET: | 820 | case AF_INET: |
821 | if (!__ipv6_only_sock(sctp_opt2sk(sp)) && sp->v4mapped) | 821 | if (!__ipv6_only_sock(sctp_opt2sk(sp))) |
822 | return 1; | 822 | return 1; |
823 | default: | 823 | default: |
824 | return 0; | 824 | return 0; |
@@ -840,6 +840,11 @@ static int sctp_inet6_cmp_addr(const union sctp_addr *addr1, | |||
840 | 840 | ||
841 | if (!af1 || !af2) | 841 | if (!af1 || !af2) |
842 | return 0; | 842 | return 0; |
843 | |||
844 | /* If the socket is IPv6 only, v4 addrs will not match */ | ||
845 | if (__ipv6_only_sock(sctp_opt2sk(opt)) && af1 != af2) | ||
846 | return 0; | ||
847 | |||
843 | /* Today, wildcard AF_INET/AF_INET6. */ | 848 | /* Today, wildcard AF_INET/AF_INET6. */ |
844 | if (sctp_is_any(addr1) || sctp_is_any(addr2)) | 849 | if (sctp_is_any(addr1) || sctp_is_any(addr2)) |
845 | return 1; | 850 | return 1; |
@@ -876,7 +881,11 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
876 | return 0; | 881 | return 0; |
877 | } | 882 | } |
878 | dev_put(dev); | 883 | dev_put(dev); |
884 | } else if (type == IPV6_ADDR_MAPPED) { | ||
885 | if (!opt->v4mapped) | ||
886 | return 0; | ||
879 | } | 887 | } |
888 | |||
880 | af = opt->pf->af; | 889 | af = opt->pf->af; |
881 | } | 890 | } |
882 | return af->available(addr, opt); | 891 | return af->available(addr, opt); |
@@ -919,9 +928,12 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr) | |||
919 | static int sctp_inet6_supported_addrs(const struct sctp_sock *opt, | 928 | static int sctp_inet6_supported_addrs(const struct sctp_sock *opt, |
920 | __be16 *types) | 929 | __be16 *types) |
921 | { | 930 | { |
922 | types[0] = SCTP_PARAM_IPV4_ADDRESS; | 931 | types[0] = SCTP_PARAM_IPV6_ADDRESS; |
923 | types[1] = SCTP_PARAM_IPV6_ADDRESS; | 932 | if (!opt || !ipv6_only_sock(sctp_opt2sk(opt))) { |
924 | return 2; | 933 | types[1] = SCTP_PARAM_IPV4_ADDRESS; |
934 | return 2; | ||
935 | } | ||
936 | return 1; | ||
925 | } | 937 | } |
926 | 938 | ||
927 | static const struct proto_ops inet6_seqpacket_ops = { | 939 | static const struct proto_ops inet6_seqpacket_ops = { |