Commit 107e2425 authored by Xin Long's avatar Xin Long Committed by David S. Miller

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: default avatarXin Long <lucien.xin@gmail.com>
Acked-by: default avatarMarcelo R. Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ef4775e3
...@@ -216,11 +216,13 @@ void sctp_stream_clear(struct sctp_stream *stream) ...@@ -216,11 +216,13 @@ void sctp_stream_clear(struct sctp_stream *stream)
{ {
int i; int i;
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++) {
stream->out[i].ssn = 0; stream->out[i].mid = 0;
stream->out[i].mid_uo = 0;
}
for (i = 0; i < stream->incnt; i++) for (i = 0; i < stream->incnt; i++)
stream->in[i].ssn = 0; stream->in[i].mid = 0;
} }
void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new) void sctp_stream_update(struct sctp_stream *stream, struct sctp_stream *new)
...@@ -607,10 +609,10 @@ struct sctp_chunk *sctp_process_strreset_outreq( ...@@ -607,10 +609,10 @@ struct sctp_chunk *sctp_process_strreset_outreq(
} }
for (i = 0; i < nums; i++) for (i = 0; i < nums; i++)
stream->in[ntohs(str_p[i])].ssn = 0; stream->in[ntohs(str_p[i])].mid = 0;
} else { } else {
for (i = 0; i < stream->incnt; i++) for (i = 0; i < stream->incnt; i++)
stream->in[i].ssn = 0; stream->in[i].mid = 0;
} }
result = SCTP_STRRESET_PERFORMED; result = SCTP_STRRESET_PERFORMED;
...@@ -783,10 +785,12 @@ struct sctp_chunk *sctp_process_strreset_tsnreq( ...@@ -783,10 +785,12 @@ struct sctp_chunk *sctp_process_strreset_tsnreq(
/* G5: The next expected and outgoing SSNs MUST be reset to 0 for all /* G5: The next expected and outgoing SSNs MUST be reset to 0 for all
* incoming and outgoing streams. * incoming and outgoing streams.
*/ */
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++) {
stream->out[i].ssn = 0; stream->out[i].mid = 0;
stream->out[i].mid_uo = 0;
}
for (i = 0; i < stream->incnt; i++) for (i = 0; i < stream->incnt; i++)
stream->in[i].ssn = 0; stream->in[i].mid = 0;
result = SCTP_STRRESET_PERFORMED; result = SCTP_STRRESET_PERFORMED;
...@@ -976,11 +980,15 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -976,11 +980,15 @@ struct sctp_chunk *sctp_process_strreset_resp(
if (result == SCTP_STRRESET_PERFORMED) { if (result == SCTP_STRRESET_PERFORMED) {
if (nums) { if (nums) {
for (i = 0; i < nums; i++) for (i = 0; i < nums; i++) {
stream->out[ntohs(str_p[i])].ssn = 0; stream->out[ntohs(str_p[i])].mid = 0;
stream->out[ntohs(str_p[i])].mid_uo = 0;
}
} else { } else {
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++) {
stream->out[i].ssn = 0; stream->out[i].mid = 0;
stream->out[i].mid_uo = 0;
}
} }
flags = SCTP_STREAM_RESET_OUTGOING_SSN; flags = SCTP_STREAM_RESET_OUTGOING_SSN;
...@@ -1041,10 +1049,12 @@ struct sctp_chunk *sctp_process_strreset_resp( ...@@ -1041,10 +1049,12 @@ struct sctp_chunk *sctp_process_strreset_resp(
asoc->ctsn_ack_point = asoc->next_tsn - 1; asoc->ctsn_ack_point = asoc->next_tsn - 1;
asoc->adv_peer_ack_point = asoc->ctsn_ack_point; asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++) {
stream->out[i].ssn = 0; stream->out[i].mid = 0;
stream->out[i].mid_uo = 0;
}
for (i = 0; i < stream->incnt; i++) for (i = 0; i < stream->incnt; i++)
stream->in[i].ssn = 0; stream->in[i].mid = 0;
} }
for (i = 0; i < stream->outcnt; i++) for (i = 0; i < stream->outcnt; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment