netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org, Neil Horman <nhorman@tuxdriver.com>,
	davem@davemloft.net
Subject: Re: [PATCHv2 net-next 7/8] sctp: update mid instead of ssn when doing stream and asoc reset
Date: Thu, 14 Dec 2017 16:26:33 -0200	[thread overview]
Message-ID: <20171214182633.GO3532@localhost.localdomain> (raw)
In-Reply-To: <3cfeed24a57f7c09d51f95df8545d7efc34db9cc.1513269224.git.lucien.xin@gmail.com>

On Fri, Dec 15, 2017 at 12:41:31AM +0800, Xin Long wrote:
> 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>

> ---
>  net/sctp/stream.c | 40 +++++++++++++++++++++++++---------------
>  1 file changed, 25 insertions(+), 15 deletions(-)
> 
> diff --git a/net/sctp/stream.c b/net/sctp/stream.c
> index b3a9f37..06b644d 100644
> --- a/net/sctp/stream.c
> +++ b/net/sctp/stream.c
> @@ -216,11 +216,13 @@ void sctp_stream_clear(struct sctp_stream *stream)
>  {
>  	int i;
>  
> -	for (i = 0; i < stream->outcnt; i++)
> -		stream->out[i].ssn = 0;
> +	for (i = 0; i < stream->outcnt; i++) {
> +		stream->out[i].mid = 0;
> +		stream->out[i].mid_uo = 0;
> +	}
>  
>  	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)
> @@ -607,10 +609,10 @@ struct sctp_chunk *sctp_process_strreset_outreq(
>  		}
>  
>  		for (i = 0; i < nums; i++)
> -			stream->in[ntohs(str_p[i])].ssn = 0;
> +			stream->in[ntohs(str_p[i])].mid = 0;
>  	} else {
>  		for (i = 0; i < stream->incnt; i++)
> -			stream->in[i].ssn = 0;
> +			stream->in[i].mid = 0;
>  	}
>  
>  	result = SCTP_STRRESET_PERFORMED;
> @@ -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
>  	 *      incoming and outgoing streams.
>  	 */
> -	for (i = 0; i < stream->outcnt; i++)
> -		stream->out[i].ssn = 0;
> +	for (i = 0; i < stream->outcnt; i++) {
> +		stream->out[i].mid = 0;
> +		stream->out[i].mid_uo = 0;
> +	}
>  	for (i = 0; i < stream->incnt; i++)
> -		stream->in[i].ssn = 0;
> +		stream->in[i].mid = 0;
>  
>  	result = SCTP_STRRESET_PERFORMED;
>  
> @@ -976,11 +980,15 @@ struct sctp_chunk *sctp_process_strreset_resp(
>  
>  		if (result == SCTP_STRRESET_PERFORMED) {
>  			if (nums) {
> -				for (i = 0; i < nums; i++)
> -					stream->out[ntohs(str_p[i])].ssn = 0;
> +				for (i = 0; i < nums; i++) {
> +					stream->out[ntohs(str_p[i])].mid = 0;
> +					stream->out[ntohs(str_p[i])].mid_uo = 0;
> +				}
>  			} else {
> -				for (i = 0; i < stream->outcnt; i++)
> -					stream->out[i].ssn = 0;
> +				for (i = 0; i < stream->outcnt; i++) {
> +					stream->out[i].mid = 0;
> +					stream->out[i].mid_uo = 0;
> +				}
>  			}
>  
>  			flags = SCTP_STREAM_RESET_OUTGOING_SSN;
> @@ -1041,10 +1049,12 @@ struct sctp_chunk *sctp_process_strreset_resp(
>  			asoc->ctsn_ack_point = asoc->next_tsn - 1;
>  			asoc->adv_peer_ack_point = asoc->ctsn_ack_point;
>  
> -			for (i = 0; i < stream->outcnt; i++)
> -				stream->out[i].ssn = 0;
> +			for (i = 0; i < stream->outcnt; i++) {
> +				stream->out[i].mid = 0;
> +				stream->out[i].mid_uo = 0;
> +			}
>  			for (i = 0; i < stream->incnt; i++)
> -				stream->in[i].ssn = 0;
> +				stream->in[i].mid = 0;
>  		}
>  
>  		for (i = 0; i < stream->outcnt; i++)
> -- 
> 2.1.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2017-12-14 18:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 16:41 [PATCHv2 net-next 0/8] sctp: Implement Stream Interleave: Interaction with Other SCTP Extensions Xin Long
2017-12-14 16:41 ` [PATCHv2 net-next 1/8] sctp: add basic structures and make chunk function for ifwdtsn Xin Long
2017-12-14 18:25   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 2/8] sctp: implement generate_ftsn for sctp_stream_interleave Xin Long
2017-12-14 18:25   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 3/8] sctp: implement validate_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 4/8] sctp: implement report_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 5/8] sctp: implement handle_ftsn " Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 6/8] sctp: add stream interleave support in stream scheduler Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 16:41 ` [PATCHv2 net-next 7/8] sctp: update mid instead of ssn when doing stream and asoc reset Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner [this message]
2017-12-14 16:41 ` [PATCHv2 net-next 8/8] sctp: support sysctl to allow users to use stream interleave Xin Long
2017-12-14 18:26   ` Marcelo Ricardo Leitner
2017-12-14 19:58 ` [PATCHv2 net-next 0/8] sctp: Implement Stream Interleave: Interaction with Other SCTP Extensions Neil Horman
2017-12-15 18:53 ` David Miller

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=20171214182633.GO3532@localhost.localdomain \
    --to=marcelo.leitner@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.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;
as well as URLs for NNTP newsgroup(s).