From: xufeng zhang <xufeng.zhang@windriver.com>
To: Vlad Yasevich <vyasevich@gmail.com>
Cc: <sri@us.ibm.com>, <davem@davemloft.net>,
<xufengzhang.main@gmail.com>, <linux-sctp@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sctp: Make "Invalid Stream Identifier" ERROR follows SACK when bundling
Date: Tue, 24 Jul 2012 11:02:47 +0800 [thread overview]
Message-ID: <500E1057.3020509@windriver.com> (raw)
In-Reply-To: <42fcd21f-68bd-4dc7-8460-0cb968eb512e@email.android.com>
On 07/24/2012 10:27 AM, Vlad Yasevich wrote:
> xufeng zhang<xufeng.zhang@windriver.com> wrote:
>
>
>> On 07/19/2012 01:57 PM, xufengzhang.main@gmail.com wrote:
>>
>>> When "Invalid Stream Identifier" ERROR happens after process the
>>> received DATA chunks, this ERROR chunk is enqueued into outqueue
>>> before SACK chunk, so when bundling ERROR chunk with SACK chunk,
>>> the ERROR chunk is always placed first in the packet because of
>>> the chunk's position in the outqueue.
>>> This violates sctp specification:
>>> RFC 4960 6.5. Stream Identifier and Stream Sequence Number
>>> ...The endpoint may bundle the ERROR chunk in the same
>>> packet as the SACK as long as the ERROR follows the SACK.
>>> So we must place SACK first when bundling "Invalid Stream Identifier"
>>> ERROR and SACK in one packet.
>>> Although we can do that by enqueue SACK chunk into outqueue before
>>> ERROR chunk, it will violate the side-effect interpreter processing.
>>> It's easy to do this job when dequeue chunks from the outqueue,
>>> by this way, we introduce a flag 'has_isi_err' which indicate
>>> whether or not the "Invalid Stream Identifier" ERROR happens.
>>>
>>> Signed-off-by: Xufeng Zhang<xufeng.zhang@windriver.com>
>>> ---
>>> include/net/sctp/structs.h | 2 ++
>>> net/sctp/output.c | 26 ++++++++++++++++++++++++++
>>> 2 files changed, 28 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
>>> index 88949a9..5adf4de 100644
>>> --- a/include/net/sctp/structs.h
>>> +++ b/include/net/sctp/structs.h
>>> @@ -842,6 +842,8 @@ struct sctp_packet {
>>> has_sack:1, /* This packet contains a SACK chunk. */
>>> has_auth:1, /* This packet contains an AUTH chunk */
>>> has_data:1, /* This packet contains at least 1 DATA chunk */
>>> + has_isi_err:1, /* This packet contains a "Invalid Stream
>>> + * Identifier" ERROR chunk */
>>> ipfragok:1, /* So let ip fragment this packet */
>>> malloced:1; /* Is it malloced? */
>>> };
>>> diff --git a/net/sctp/output.c b/net/sctp/output.c
>>> index 817174e..77fb1ae 100644
>>> --- a/net/sctp/output.c
>>> +++ b/net/sctp/output.c
>>> @@ -79,6 +79,7 @@ static void sctp_packet_reset(struct sctp_packet
>>>
>> *packet)
>>
>>> packet->has_sack = 0;
>>> packet->has_data = 0;
>>> packet->has_auth = 0;
>>> + packet->has_isi_err = 0;
>>> packet->ipfragok = 0;
>>> packet->auth = NULL;
>>> }
>>> @@ -267,6 +268,7 @@ static sctp_xmit_t sctp_packet_bundle_sack(struct
>>>
>> sctp_packet *pkt,
>>
>>> sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *packet,
>>> struct sctp_chunk *chunk)
>>> {
>>> + struct sctp_chunk *lchunk;
>>> sctp_xmit_t retval = SCTP_XMIT_OK;
>>> __u16 chunk_len = WORD_ROUND(ntohs(chunk->chunk_hdr->length));
>>>
>>> @@ -316,7 +318,31 @@ sctp_xmit_t sctp_packet_append_chunk(struct
>>>
>> sctp_packet *packet,
>>
>>> packet->has_cookie_echo = 1;
>>> break;
>>>
>>> + case SCTP_CID_ERROR:
>>> + if (chunk->subh.err_hdr->cause& SCTP_ERROR_INV_STRM)
>>> + packet->has_isi_err = 1;
>>> + break;
>>> +
>>> case SCTP_CID_SACK:
>>> + /* RFC 4960
>>> + * 6.5 Stream Identifier and Stream Sequence Number
>>> + * The endpoint may bundle the ERROR chunk in the same
>>> + * packet as the SACK as long as the ERROR follows the SACK.
>>> + */
>>> + if (packet->has_isi_err) {
>>> + if (list_is_singular(&packet->chunk_list))
>>> + list_add(&chunk->list,&packet->chunk_list);
>>> + else {
>>> + lchunk = list_first_entry(&packet->chunk_list,
>>> + struct sctp_chunk, list);
>>> + list_add(&chunk->list,&lchunk->list);
>>> + }
>>>
>>>
>> And I should clarify the above judgment code.
>> AFAIK, there should be two cases for the bundling when invalid stream
>> identifier error happens:
>> 1). COOKIE_ACK ERROR SACK
>> 2). ERROR SACK
>> So I need to deal with the two cases differently.
>>
>>
> Sorry but I just don't buy that the above are the only 2 cases. What if there are addip chunks as well? What if there are some other extensions also. This code has to be generic enough to handle any condition.
>
Aha, you are right, this may happens.
So I think the general solution is to fix this problem in the enqueue side.
What do you think? any better suggestion!
Thanks,
Xufeng Zhang
> - vlad
>
>
>> Thanks,
>> Xufeng Zhang
>>
>>> + packet->size += chunk_len;
>>> + chunk->transport = packet->transport;
>>> + packet->has_sack = 1;
>>> + goto finish;
>>> + }
>>> +
>>> packet->has_sack = 1;
>>> break;
>>>
>>>
>>>
>
>
next prev parent reply other threads:[~2012-07-24 2:55 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-19 5:57 [PATCH] sctp: Make "Invalid Stream Identifier" ERROR follows SACK when bundling xufengzhang.main
2012-07-22 19:45 ` David Miller
2012-07-23 0:49 ` Neil Horman
2012-07-23 2:30 ` xufeng zhang
2012-07-23 12:14 ` Neil Horman
2012-07-24 1:53 ` Xufeng Zhang
[not found] ` <500DFF5A.20203@windriver.com>
2012-07-24 11:38 ` Neil Horman
2012-07-25 2:34 ` Xufeng Zhang
2012-07-25 11:15 ` Neil Horman
2012-07-23 5:16 ` xufeng zhang
2012-07-24 2:27 ` Vlad Yasevich
2012-07-24 3:02 ` xufeng zhang [this message]
2012-07-24 14:05 ` Vlad Yasevich
2012-07-25 2:28 ` Xufeng Zhang
2012-07-25 7:16 ` Vlad Yasevich
2012-07-25 8:05 ` Xufeng Zhang
2012-07-25 9:22 ` Xufeng Zhang
2012-07-25 11:27 ` Neil Horman
2012-07-26 1:34 ` Xufeng Zhang
2012-07-25 15:00 ` Vlad Yasevich
2012-07-26 1:30 ` Xufeng Zhang
2012-07-26 2:45 ` Vlad Yasevich
2012-07-26 2:50 ` Xufeng Zhang
2012-07-26 2:55 ` Vlad Yasevich
2012-07-26 3:12 ` Xufeng Zhang
2012-07-27 21:22 ` Vlad Yasevich
2012-07-30 4:58 ` Xufeng Zhang
2012-07-30 5:47 ` Xufeng Zhang
2012-07-31 6:17 ` Xufeng Zhang
2012-07-31 6:51 ` xufeng zhang
2012-08-02 21:17 ` Vlad Yasevich
2012-08-03 2:24 ` xufeng zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=500E1057.3020509@windriver.com \
--to=xufeng.zhang@windriver.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sctp@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sri@us.ibm.com \
--cc=vyasevich@gmail.com \
--cc=xufengzhang.main@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox