All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: sctp: sctp_verify_init: clean up mandatory checks and add comment
Date: Tue, 27 Aug 2013 14:23:30 +0000	[thread overview]
Message-ID: <521CB662.3050903@cogentembedded.com> (raw)
In-Reply-To: <1377612363-10779-1-git-send-email-dborkman@redhat.com>

Hello.

On 27-08-2013 18:06, Daniel Borkmann wrote:

> Add a comment related to RFC4960 explaning why we do not check for initial
> TSN, and while at it, remove yoda notation checks and clean up code from
> checks of mandatory conditions. That's probably just really minor, but makes
> reviewing easier.

> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
>   v1->v2: update comment as Neil suggested

>   net/sctp/sm_make_chunk.c | 26 ++++++++++++--------------
>   1 file changed, 12 insertions(+), 14 deletions(-)

> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 01e9783..e1c1531 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -2240,25 +2240,23 @@ int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
>   		     struct sctp_chunk **errp)
>   {
>   	union sctp_params param;
> -	int has_cookie = 0;
> +	bool has_cookie = false;
>   	int result;
>
> -	/* Verify stream values are non-zero. */
> -	if ((0 = peer_init->init_hdr.num_outbound_streams) ||
> -	    (0 = peer_init->init_hdr.num_inbound_streams) ||
> -	    (0 = peer_init->init_hdr.init_tag) ||
> -	    (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) {
> -
> +	/* Check for missing mandatory parameters. Note: Initial TSN is
> +	 * also mandatory, but is not checked here since the valid range
> +	 * is 0..2**(32-1). RFC4960, section 3.3.3.

    I don't think you really meant 2**(32-1) = 2**31. Previously you wrote 
2**32-1.

WBR, Sergei


WARNING: multiple messages have this Message-ID (diff)
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Daniel Borkmann <dborkman@redhat.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-sctp@vger.kernel.org
Subject: Re: [PATCH net-next v2] net: sctp: sctp_verify_init: clean up mandatory checks and add comment
Date: Tue, 27 Aug 2013 18:23:30 +0400	[thread overview]
Message-ID: <521CB662.3050903@cogentembedded.com> (raw)
In-Reply-To: <1377612363-10779-1-git-send-email-dborkman@redhat.com>

Hello.

On 27-08-2013 18:06, Daniel Borkmann wrote:

> Add a comment related to RFC4960 explaning why we do not check for initial
> TSN, and while at it, remove yoda notation checks and clean up code from
> checks of mandatory conditions. That's probably just really minor, but makes
> reviewing easier.

> Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> ---
>   v1->v2: update comment as Neil suggested

>   net/sctp/sm_make_chunk.c | 26 ++++++++++++--------------
>   1 file changed, 12 insertions(+), 14 deletions(-)

> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 01e9783..e1c1531 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -2240,25 +2240,23 @@ int sctp_verify_init(struct net *net, const struct sctp_association *asoc,
>   		     struct sctp_chunk **errp)
>   {
>   	union sctp_params param;
> -	int has_cookie = 0;
> +	bool has_cookie = false;
>   	int result;
>
> -	/* Verify stream values are non-zero. */
> -	if ((0 == peer_init->init_hdr.num_outbound_streams) ||
> -	    (0 == peer_init->init_hdr.num_inbound_streams) ||
> -	    (0 == peer_init->init_hdr.init_tag) ||
> -	    (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) {
> -
> +	/* Check for missing mandatory parameters. Note: Initial TSN is
> +	 * also mandatory, but is not checked here since the valid range
> +	 * is 0..2**(32-1). RFC4960, section 3.3.3.

    I don't think you really meant 2**(32-1) == 2**31. Previously you wrote 
2**32-1.

WBR, Sergei

  parent reply	other threads:[~2013-08-27 14:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-27 14:06 [PATCH net-next v2] net: sctp: sctp_verify_init: clean up mandatory checks and add comment Daniel Borkmann
2013-08-27 14:06 ` Daniel Borkmann
2013-08-27 14:11 ` Neil Horman
2013-08-27 14:11   ` Neil Horman
2013-08-27 14:23 ` Sergei Shtylyov [this message]
2013-08-27 14:23   ` Sergei Shtylyov

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=521CB662.3050903@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.