From 849b521858ae101118daa5e64318fb712d1844b2 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Thu, 2 Aug 2007 16:51:42 -0400 Subject: [PATCH] --- yaml --- r: 64595 b: refs/heads/master c: ab3e5e7b65dde661f5eb86b445496c5967283333 h: refs/heads/master i: 64593: 6e588548c650cea30d365f5543471bed68f882e3 64591: 54fb139e3ada5f1e1385d3ddfbaca1af785378dc v: v3 --- [refs] | 2 +- trunk/net/sctp/sm_make_chunk.c | 35 ++++++++++++++++++++++------------ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/[refs] b/[refs] index 26c89421f7cb..339dcc553023 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ea2dfb3733d53ac98b17756435d1f99e25490357 +refs/heads/master: ab3e5e7b65dde661f5eb86b445496c5967283333 diff --git a/trunk/net/sctp/sm_make_chunk.c b/trunk/net/sctp/sm_make_chunk.c index 51c4d7fef1d2..2b1129a7a94a 100644 --- a/trunk/net/sctp/sm_make_chunk.c +++ b/trunk/net/sctp/sm_make_chunk.c @@ -1174,25 +1174,36 @@ int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len, */ void sctp_chunk_assign_ssn(struct sctp_chunk *chunk) { + struct sctp_datamsg *msg; + struct sctp_chunk *lchunk; + struct sctp_stream *stream; __u16 ssn; __u16 sid; if (chunk->has_ssn) return; - /* This is the last possible instant to assign a SSN. */ - if (chunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { - ssn = 0; - } else { - sid = ntohs(chunk->subh.data_hdr->stream); - if (chunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) - ssn = sctp_ssn_next(&chunk->asoc->ssnmap->out, sid); - else - ssn = sctp_ssn_peek(&chunk->asoc->ssnmap->out, sid); - } + /* All fragments will be on the same stream */ + sid = ntohs(chunk->subh.data_hdr->stream); + stream = &chunk->asoc->ssnmap->out; - chunk->subh.data_hdr->ssn = htons(ssn); - chunk->has_ssn = 1; + /* Now assign the sequence number to the entire message. + * All fragments must have the same stream sequence number. + */ + msg = chunk->msg; + list_for_each_entry(lchunk, &msg->chunks, frag_list) { + if (lchunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { + ssn = 0; + } else { + if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) + ssn = sctp_ssn_next(stream, sid); + else + ssn = sctp_ssn_peek(stream, sid); + } + + lchunk->subh.data_hdr->ssn = htons(ssn); + lchunk->has_ssn = 1; + } } /* Helper function to assign a TSN if needed. This assumes that both