* [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-12 5:07 ` Xin Long
0 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2015-11-12 5:07 UTC (permalink / raw)
To: network dev, linux-sctp; +Cc: marcelo.leitner, vyasevic, davem
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;
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-12 5:07 ` Xin Long
0 siblings, 0 replies; 10+ messages in thread
From: Xin Long @ 2015-11-12 5:07 UTC (permalink / raw)
To: network dev, linux-sctp; +Cc: marcelo.leitner, vyasevic, davem
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;
--
2.1.0
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
2015-11-12 5:07 ` Xin Long
@ 2015-11-12 10:44 ` marcelo.leitner
-1 siblings, 0 replies; 10+ messages in thread
From: marcelo.leitner @ 2015-11-12 10:44 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, vyasevic, davem
On Thu, Nov 12, 2015 at 01:07:07PM +0800, 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>
Fixes: 65b07e5d0d09 ("[SCTP]: API updates to suport SCTP-AUTH
extensions.")
Thanks!
> ---
> 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;
> --
> 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
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-12 10:44 ` marcelo.leitner
0 siblings, 0 replies; 10+ messages in thread
From: marcelo.leitner @ 2015-11-12 10:44 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, vyasevic, davem
On Thu, Nov 12, 2015 at 01:07:07PM +0800, 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>
Fixes: 65b07e5d0d09 ("[SCTP]: API updates to suport SCTP-AUTH
extensions.")
Thanks!
> ---
> 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;
> --
> 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
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
2015-11-12 5:07 ` Xin Long
@ 2015-11-12 13:13 ` Neil Horman
-1 siblings, 0 replies; 10+ messages in thread
From: Neil Horman @ 2015-11-12 13:13 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, marcelo.leitner, vyasevic, davem
On Thu, Nov 12, 2015 at 01:07:07PM +0800, 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;
> --
> 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
>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-12 13:13 ` Neil Horman
0 siblings, 0 replies; 10+ messages in thread
From: Neil Horman @ 2015-11-12 13:13 UTC (permalink / raw)
To: Xin Long; +Cc: network dev, linux-sctp, marcelo.leitner, vyasevic, davem
On Thu, Nov 12, 2015 at 01:07:07PM +0800, 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;
> --
> 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
>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
2015-11-12 5:07 ` Xin Long
@ 2015-11-12 21:02 ` Vlad Yasevich
-1 siblings, 0 replies; 10+ messages in thread
From: Vlad Yasevich @ 2015-11-12 21:02 UTC (permalink / raw)
To: Xin Long, network dev, linux-sctp; +Cc: marcelo.leitner, vyasevic, davem
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-12 21:02 ` Vlad Yasevich
0 siblings, 0 replies; 10+ messages in thread
From: Vlad Yasevich @ 2015-11-12 21:02 UTC (permalink / raw)
To: Xin Long, network dev, linux-sctp; +Cc: marcelo.leitner, vyasevic, davem
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
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
2015-11-12 5:07 ` Xin Long
@ 2015-11-15 23:28 ` David Miller
-1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2015-11-15 23:28 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, vyasevic
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 12 Nov 2015 13:07:07 +0800
> 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>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH net] sctp: translate host order to network order when setting a hmacid
@ 2015-11-15 23:28 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2015-11-15 23:28 UTC (permalink / raw)
To: lucien.xin; +Cc: netdev, linux-sctp, marcelo.leitner, vyasevic
From: Xin Long <lucien.xin@gmail.com>
Date: Thu, 12 Nov 2015 13:07:07 +0800
> 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>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-11-15 23:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2015-11-12 21:02 ` Vlad Yasevich
2015-11-15 23:28 ` David Miller
2015-11-15 23:28 ` David Miller
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.