diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-12-14 11:41:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-12-15 13:52:22 -0500 |
commit | 107e242569541795a84264f94375e987ba04d309 (patch) | |
tree | 4ca6c3b9c5ff637a5438196fb86666ac469188e7 | |
parent | ef4775e3402b7d45b06dddd79f860a5c4d5fc1cf (diff) |
sctp: update mid instead of ssn when doing stream and asoc reset
When using idata and doing stream and asoc reset, setting ssn with
0 could only clear the 1st 16 bits of mid.
So to make this work for both data and idata, it sets mid with 0
instead of ssn, and also mid_uo for unordered idata also need to
be cleared, as said in section 2.3.2 of RFC8260.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Marcelo R. Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/sctp/stream.c | 40 |
1 files changed, 25 insertions, 15 deletions
diff --git a/net/sctp/stream.c b/net/sctp/stream.c index b3a9f37c1598..06b644dd858c 100644 --- a/net/sctp/stream.c +++ b/net/sctp/stream.c | |||
@@ -216,11 +216,13 @@ void sctp_stream_clear(struct sctp_stream *stream) | |||
216 | { | 216 | { |
217 | int i; | 217 | int i; |
218 | 218 | ||
219 | for (i = 0; i < stream->outcnt; i++) | 219 | for (i = 0; i < stream->outcnt; i++) { |
220 | stream->out[i].ssn = 0; | 220 | stream->out[i].mid = 0; |
221 | stream->out[i].mid_uo = 0; | ||
222 | } | ||
221 | 223 | ||
222 | for (i = 0; i < stream->incnt; i++) | 224 | for (i = 0; i < stream->incnt; i++) |
223 | stream->in[i].ssn = 0; | 225 | stream->in[i].mid = 0; |
224 | } | 226 | } |
225 | 227 | ||
226 | void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) | 228 | void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) |
@@ -607,10 +609,10 @@ struct sctp_chunk *sctp_process_strreset_outreq( | |||
607 | } | 609 | } |
608 | 610 | ||
609 | for (i = 0; i < nums; i++) | 611 | for (i = 0; i < nums; i++) |
610 | stream->in[ntohs(str_p[i])].ssn = 0; | 612 | stream->in[ntohs(str_p[i])].mid = 0; |
611 | } else { | 613 | } else { |
612 | for (i = 0; i < stream->incnt; i++) | 614 | for (i = 0; i < stream->incnt; i++) |
613 | stream->in[i].ssn = 0; | 615 | stream->in[i].mid = 0; |
614 | } | 616 | } |
615 | 617 | ||
616 | result = SCTP_STRRESET_PERFORMED; | 618 | result = SCTP_STRRESET_PERFORMED; |
@@ -783,10 +785,12 @@ struct sctp_chunk *sctp_process_strreset_tsnreq( | |||
783 | /* G5: The next expected and outgoing SSNs MUST be reset to 0 for all | 785 | /* G5: The next expected and outgoing SSNs MUST be reset to 0 for all |
784 | * incoming and outgoing streams. | 786 | * incoming and outgoing streams. |
785 | */ | 787 | */ |
786 | for (i = 0; i < stream->outcnt; i++) | 788 | for (i = 0; i < stream->outcnt; i++) { |
787 | stream->out[i].ssn = 0; | 789 | stream->out[i].mid = 0; |
790 | stream->out[i].mid_uo = 0; | ||
791 | } | ||
788 | for (i = 0; i < stream->incnt; i++) | 792 | for (i = 0; i < stream->incnt; i++) |
789 | stream->in[i].ssn = 0; | 793 | stream->in[i].mid = 0; |
790 | 794 | ||
791 | result = SCTP_STRRESET_PERFORMED; | 795 | result = SCTP_STRRESET_PERFORMED; |
792 | 796 | ||
@@ -976,11 +980,15 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
976 | 980 | ||
977 | if (result == SCTP_STRRESET_PERFORMED) { | 981 | if (result == SCTP_STRRESET_PERFORMED) { |
978 | if (nums) { | 982 | if (nums) { |
979 | for (i = 0; i < nums; i++) | 983 | for (i = 0; i < nums; i++) { |
980 | stream->out[ntohs(str_p[i])].ssn = 0; | 984 | stream->out[ntohs(str_p[i])].mid = 0; |
985 | stream->out[ntohs(str_p[i])].mid_uo = 0; | ||
986 | } | ||
981 | } else { | 987 | } else { |
982 | for (i = 0; i < stream->outcnt; i++) | 988 | for (i = 0; i < stream->outcnt; i++) { |
983 | stream->out[i].ssn = 0; | 989 | stream->out[i].mid = 0; |
990 | stream->out[i].mid_uo = 0; | ||
991 | } | ||
984 | } | 992 | } |
985 | 993 | ||
986 | flags = SCTP_STREAM_RESET_OUTGOING_SSN; | 994 | flags = SCTP_STREAM_RESET_OUTGOING_SSN; |
@@ -1041,10 +1049,12 @@ struct sctp_chunk *sctp_process_strreset_resp( | |||
1041 | asoc->ctsn_ack_point = asoc->next_tsn - 1; | 1049 | asoc->ctsn_ack_point = asoc->next_tsn - 1; |
1042 | asoc->adv_peer_ack_point = asoc->ctsn_ack_point; | 1050 | asoc->adv_peer_ack_point = asoc->ctsn_ack_point; |
1043 | 1051 | ||
1044 | for (i = 0; i < stream->outcnt; i++) | 1052 | for (i = 0; i < stream->outcnt; i++) { |
1045 | stream->out[i].ssn = 0; | 1053 | stream->out[i].mid = 0; |
1054 | stream->out[i].mid_uo = 0; | ||
1055 | } | ||
1046 | for (i = 0; i < stream->incnt; i++) | 1056 | for (i = 0; i < stream->incnt; i++) |
1047 | stream->in[i].ssn = 0; | 1057 | stream->in[i].mid = 0; |
1048 | } | 1058 | } |
1049 | 1059 | ||
1050 | for (i = 0; i < stream->outcnt; i++) | 1060 | for (i = 0; i < stream->outcnt; i++) |