diff options
author | Gui Jianfeng <guijianfeng@cn.fujitsu.com> | 2008-03-05 16:43:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-03-05 16:43:32 -0500 |
commit | 140ee9603c753ce11fc3088c1988a77e92183f9b (patch) | |
tree | dd8bd485a3a453292dc0d571fffca017f1161fe0 /net/sctp/sm_make_chunk.c | |
parent | 0d66afe7805b169b6bf3c7a88cf8163298b8ef05 (diff) |
SCTP: Fix chunk parameter processing bug
If an address family is not listed in "Supported Address Types"
parameter(INIT Chunk), but the packet is sent by that family, this
address family should be considered as supported by peer. Otherwise,
an error condition will occur. For instance, if kernel receives an
IPV6 SCTP INIT chunk with "Support Address Types" parameter which
indicates just supporting IPV4 Address family. Kernel will reply an
IPV6 SCTP INIT ACK packet, but the source ipv6 address in ipv6 header
will be vacant. This is not correct.
refer to RFC4460 as following:
IMPLEMENTATION NOTE: If an SCTP endpoint lists in the 'Supported
Address Types' parameter either IPv4 or IPv6, but uses the other
family for sending the packet containing the INIT chunk, or if it
also lists addresses of the other family in the INIT chunk, then
the address family that is not listed in the 'Supported Address
Types' parameter SHOULD also be considered as supported by the
receiver of the INIT chunk. The receiver of the INIT chunk SHOULD
NOT respond with any kind of error indication.
Here is a fix to comply to RFC.
Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sm_make_chunk.c')
-rw-r--r-- | net/sctp/sm_make_chunk.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index e45be4e3f80d..578630e8e00d 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -2375,6 +2375,14 @@ static int sctp_process_param(struct sctp_association *asoc, | |||
2375 | asoc->peer.ipv4_address = 0; | 2375 | asoc->peer.ipv4_address = 0; |
2376 | asoc->peer.ipv6_address = 0; | 2376 | asoc->peer.ipv6_address = 0; |
2377 | 2377 | ||
2378 | /* Assume that peer supports the address family | ||
2379 | * by which it sends a packet. | ||
2380 | */ | ||
2381 | if (peer_addr->sa.sa_family == AF_INET6) | ||
2382 | asoc->peer.ipv6_address = 1; | ||
2383 | else if (peer_addr->sa.sa_family == AF_INET) | ||
2384 | asoc->peer.ipv4_address = 1; | ||
2385 | |||
2378 | /* Cycle through address types; avoid divide by 0. */ | 2386 | /* Cycle through address types; avoid divide by 0. */ |
2379 | sat = ntohs(param.p->length) - sizeof(sctp_paramhdr_t); | 2387 | sat = ntohs(param.p->length) - sizeof(sctp_paramhdr_t); |
2380 | if (sat) | 2388 | if (sat) |