* [PATCH] SCTP: Fix chunk parameter processing bug
@ 2008-03-05 7:10 Gui Jianfeng
2008-03-05 13:53 ` Vlad Yasevich
0 siblings, 1 reply; 3+ messages in thread
From: Gui Jianfeng @ 2008-03-05 7:10 UTC (permalink / raw)
To: netdev; +Cc: David Miller, vladislav
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>
---
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 e45be4e..ed5d413 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,
asoc->peer.ipv4_address = 0;
asoc->peer.ipv6_address = 0;
+ /* Assume that peer supports the address family
+ by which it sends a packet.
+ */
+ if (peer_addr->sa.sa_family == AF_INET6)
+ asoc->peer.ipv6_address = 1;
+ else if (peer_addr->sa.sa_family == AF_INET)
+ asoc->peer.ipv4_address = 1;
+
/* Cycle through address types; avoid divide by 0. */
sat = ntohs(param.p->length) - sizeof(sctp_paramhdr_t);
if (sat)
--
1.5.3
--
Regards
Gui Jianfeng
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] SCTP: Fix chunk parameter processing bug
2008-03-05 7:10 [PATCH] SCTP: Fix chunk parameter processing bug Gui Jianfeng
@ 2008-03-05 13:53 ` Vlad Yasevich
2008-03-05 21:44 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Vlad Yasevich @ 2008-03-05 13:53 UTC (permalink / raw)
To: Gui Jianfeng; +Cc: netdev, David Miller
Gui Jianfeng wrote:
> 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>
Thanks for catching this.
-vlad
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] SCTP: Fix chunk parameter processing bug
2008-03-05 13:53 ` Vlad Yasevich
@ 2008-03-05 21:44 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2008-03-05 21:44 UTC (permalink / raw)
To: vladislav.yasevich; +Cc: guijianfeng, netdev
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Wed, 05 Mar 2008 08:53:45 -0500
> Gui Jianfeng wrote:
> > Signed-off-by: Gui Jianfeng <guijianfeng@cn.fujitsu.com>
>
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
>
> Thanks for catching this.
I applied this after killing trailing whitespace errors and making the
added comment conform to kernel coding standards.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-03-05 21:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-05 7:10 [PATCH] SCTP: Fix chunk parameter processing bug Gui Jianfeng
2008-03-05 13:53 ` Vlad Yasevich
2008-03-05 21:44 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).