All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vlad Yasevich <vyasevich@gmail.com>
To: Xin Long <lucien.xin@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org
Cc: marcelo.leitner@gmail.com, vyasevic@redhat.com, davem@davemloft.net
Subject: Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
Date: Thu, 12 Nov 2015 21:02:57 +0000	[thread overview]
Message-ID: <5644FE81.9070900@gmail.com> (raw)
In-Reply-To: <8cede44279b2f01a58fa02d4bb46b40fb630563f.1447304827.git.lucien.xin@gmail.com>

On 11/12/2015 12:07 AM, Xin Long wrote:
> now sctp auth cannot work well when setting a hmacid manually, which
> is caused by that we didn't use the network order for hmacid, so fix
> it by adding the transformation in sctp_auth_ep_set_hmacs.
> 
> even we set hmacid with the network order in userspace, it still
> can't work, because of this condition in sctp_auth_ep_set_hmacs():
> 
> 		if (id > SCTP_AUTH_HMAC_ID_MAX)
> 			return -EOPNOTSUPP;
> 
> so this wasn't working before and thus it won't break compatibility.
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
>  net/sctp/auth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/auth.c b/net/sctp/auth.c
> index 4f15b7d..1543e39 100644
> --- a/net/sctp/auth.c
> +++ b/net/sctp/auth.c
> @@ -809,8 +809,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
>  	if (!has_sha1)
>  		return -EINVAL;
>  
> -	memcpy(ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0],
> -		hmacs->shmac_num_idents * sizeof(__u16));
> +	for (i = 0; i < hmacs->shmac_num_idents; i++)
> +		ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]);
>  	ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) +
>  				hmacs->shmac_num_idents * sizeof(__u16));
>  	return 0;
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

WARNING: multiple messages have this Message-ID (diff)
From: Vlad Yasevich <vyasevich@gmail.com>
To: Xin Long <lucien.xin@gmail.com>,
	network dev <netdev@vger.kernel.org>,
	linux-sctp@vger.kernel.org
Cc: marcelo.leitner@gmail.com, vyasevic@redhat.com, davem@davemloft.net
Subject: Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
Date: Thu, 12 Nov 2015 16:02:57 -0500	[thread overview]
Message-ID: <5644FE81.9070900@gmail.com> (raw)
In-Reply-To: <8cede44279b2f01a58fa02d4bb46b40fb630563f.1447304827.git.lucien.xin@gmail.com>

On 11/12/2015 12:07 AM, Xin Long wrote:
> now sctp auth cannot work well when setting a hmacid manually, which
> is caused by that we didn't use the network order for hmacid, so fix
> it by adding the transformation in sctp_auth_ep_set_hmacs.
> 
> even we set hmacid with the network order in userspace, it still
> can't work, because of this condition in sctp_auth_ep_set_hmacs():
> 
> 		if (id > SCTP_AUTH_HMAC_ID_MAX)
> 			return -EOPNOTSUPP;
> 
> so this wasn't working before and thus it won't break compatibility.
> 
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
> ---
>  net/sctp/auth.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/sctp/auth.c b/net/sctp/auth.c
> index 4f15b7d..1543e39 100644
> --- a/net/sctp/auth.c
> +++ b/net/sctp/auth.c
> @@ -809,8 +809,8 @@ int sctp_auth_ep_set_hmacs(struct sctp_endpoint *ep,
>  	if (!has_sha1)
>  		return -EINVAL;
>  
> -	memcpy(ep->auth_hmacs_list->hmac_ids, &hmacs->shmac_idents[0],
> -		hmacs->shmac_num_idents * sizeof(__u16));
> +	for (i = 0; i < hmacs->shmac_num_idents; i++)
> +		ep->auth_hmacs_list->hmac_ids[i] = htons(hmacs->shmac_idents[i]);
>  	ep->auth_hmacs_list->param_hdr.length = htons(sizeof(sctp_paramhdr_t) +
>  				hmacs->shmac_num_idents * sizeof(__u16));
>  	return 0;
> 

Acked-by: Vlad Yasevich <vyasevich@gmail.com>

-vlad

  parent reply	other threads:[~2015-11-12 21:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-12  5:07 [PATCH net] sctp: translate host order to network order when setting a hmacid Xin Long
2015-11-12  5:07 ` Xin Long
2015-11-12 10:44 ` marcelo.leitner
2015-11-12 10:44   ` marcelo.leitner
2015-11-12 13:13 ` Neil Horman
2015-11-12 13:13   ` Neil Horman
2015-11-12 21:02 ` Vlad Yasevich [this message]
2015-11-12 21:02   ` Vlad Yasevich
2015-11-15 23:28 ` David Miller
2015-11-15 23:28   ` 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=5644FE81.9070900@gmail.com \
    --to=vyasevich@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevic@redhat.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 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.