All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel
@ 2016-04-29  0:12 Tom Herbert
  2016-04-29  7:40 ` Nicolas Dichtel
  2016-05-01 23:39 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Tom Herbert @ 2016-04-29  0:12 UTC (permalink / raw)
  To: davem, netdev; +Cc: kernel-team, nicolas.dichtel

The handler 'ila_fill_encap_info' adds two attributes: ILA_ATTR_LOCATOR
and ILA_ATTR_CSUM_MODE.

Also, do nla_put_u8 instead of nla_put_u64 for ILA_ATTR_CSUM_MODE.

Fixes: 65d7ab8de582 ("net: Identifier Locator Addressing module")
Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
 net/ipv6/ila/ila_lwt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 4985e1a..7788090 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -133,7 +133,7 @@ static int ila_fill_encap_info(struct sk_buff *skb,
 	if (nla_put_u64_64bit(skb, ILA_ATTR_LOCATOR, (__force u64)p->locator.v64,
 			      ILA_ATTR_PAD))
 		goto nla_put_failure;
-	if (nla_put_u64(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
+	if (nla_put_u8(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
 		goto nla_put_failure;
 
 	return 0;
@@ -144,8 +144,12 @@ nla_put_failure:
 
 static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
 {
-	/* No encapsulation overhead */
-	return 0;
+	return
+		/* ILA_ATTR_LOCATOR */
+		nla_total_size(sizeof(u64)) +
+		/* ILA_ATTR_CSUM_MODE */
+		nla_total_size(sizeof(u8)) +
+		0;
 }
 
 static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
-- 
2.8.0.rc2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel
  2016-04-29  0:12 [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel Tom Herbert
@ 2016-04-29  7:40 ` Nicolas Dichtel
  2016-05-01 23:39 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2016-04-29  7:40 UTC (permalink / raw)
  To: Tom Herbert, davem, netdev; +Cc: kernel-team

Le 29/04/2016 02:12, Tom Herbert a écrit :
> The handler 'ila_fill_encap_info' adds two attributes: ILA_ATTR_LOCATOR
> and ILA_ATTR_CSUM_MODE.
> 
> Also, do nla_put_u8 instead of nla_put_u64 for ILA_ATTR_CSUM_MODE.
> 
> Fixes: 65d7ab8de582 ("net: Identifier Locator Addressing module")
> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> ---
>  net/ipv6/ila/ila_lwt.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
> index 4985e1a..7788090 100644
> --- a/net/ipv6/ila/ila_lwt.c
> +++ b/net/ipv6/ila/ila_lwt.c
> @@ -133,7 +133,7 @@ static int ila_fill_encap_info(struct sk_buff *skb,
>  	if (nla_put_u64_64bit(skb, ILA_ATTR_LOCATOR, (__force u64)p->locator.v64,
>  			      ILA_ATTR_PAD))
>  		goto nla_put_failure;
> -	if (nla_put_u64(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
> +	if (nla_put_u8(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
>  		goto nla_put_failure;
>  
>  	return 0;
> @@ -144,8 +144,12 @@ nla_put_failure:
>  
>  static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
>  {
> -	/* No encapsulation overhead */
> -	return 0;
> +	return
> +		/* ILA_ATTR_LOCATOR */
> +		nla_total_size(sizeof(u64)) +
It should be nla_total_size_64bit() here.


Regards,
Nicolas

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel
  2016-04-29  0:12 [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel Tom Herbert
  2016-04-29  7:40 ` Nicolas Dichtel
@ 2016-05-01 23:39 ` David Miller
  2016-05-10  9:56   ` [PATCH net-next v2] " Nicolas Dichtel
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2016-05-01 23:39 UTC (permalink / raw)
  To: tom; +Cc: netdev, kernel-team, nicolas.dichtel

From: Tom Herbert <tom@herbertland.com>
Date: Thu, 28 Apr 2016 17:12:29 -0700

> @@ -144,8 +144,12 @@ nla_put_failure:
>  
>  static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
>  {
> -	/* No encapsulation overhead */
> -	return 0;
> +	return
> +		/* ILA_ATTR_LOCATOR */
> +		nla_total_size(sizeof(u64)) +

As Nicolas stated, you need to use the 64-bit sizing helper here.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next v2] ila: ipv6/ila: fix nlsize calculation for lwtunnel
  2016-05-01 23:39 ` David Miller
@ 2016-05-10  9:56   ` Nicolas Dichtel
  2016-05-10 15:51     ` Tom Herbert
  2016-05-10 20:01     ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Nicolas Dichtel @ 2016-05-10  9:56 UTC (permalink / raw)
  To: tom; +Cc: netdev, davem, Nicolas Dichtel

From: Tom Herbert <tom@herbertland.com>

The handler 'ila_fill_encap_info' adds two attributes: ILA_ATTR_LOCATOR
and ILA_ATTR_CSUM_MODE.

nla_total_size_64bit() must be use for ILA_ATTR_LOCATOR.

Also, do nla_put_u8 instead of nla_put_u64 for ILA_ATTR_CSUM_MODE.

Fixes: f13a82d87b21 ("ipv6: use nla_put_u64_64bit()")
Fixes: 90bfe662db13 ("ila: add checksum neutral ILA translations")
Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---

Tom, I have taken the liberty of resending your patch, I hope it's ok
for you. Goal is to fix this before net-next closes.

v1 -> v2:
  update the patch after the merge of net (and thus update 'Fixes' tag)
  use nla_total_size_64bit() for ILA_ATTR_LOCATOR

 net/ipv6/ila/ila_lwt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
index 17038e1ede98..1dfb64166d7d 100644
--- a/net/ipv6/ila/ila_lwt.c
+++ b/net/ipv6/ila/ila_lwt.c
@@ -133,7 +133,7 @@ static int ila_fill_encap_info(struct sk_buff *skb,
 	if (nla_put_u64_64bit(skb, ILA_ATTR_LOCATOR, (__force u64)p->locator.v64,
 			      ILA_ATTR_PAD))
 		goto nla_put_failure;
-	if (nla_put_u64(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
+	if (nla_put_u8(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
 		goto nla_put_failure;
 
 	return 0;
@@ -144,7 +144,9 @@ nla_put_failure:
 
 static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
 {
-	return nla_total_size(sizeof(u64)); /* ILA_ATTR_LOCATOR */
+	return nla_total_size_64bit(sizeof(u64)) + /* ILA_ATTR_LOCATOR */
+	       nla_total_size(sizeof(u8)) +        /* ILA_ATTR_CSUM_MODE */
+	       0;
 }
 
 static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2] ila: ipv6/ila: fix nlsize calculation for lwtunnel
  2016-05-10  9:56   ` [PATCH net-next v2] " Nicolas Dichtel
@ 2016-05-10 15:51     ` Tom Herbert
  2016-05-10 20:01     ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Tom Herbert @ 2016-05-10 15:51 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Linux Kernel Network Developers, David S. Miller

On Tue, May 10, 2016 at 2:56 AM, Nicolas Dichtel
<nicolas.dichtel@6wind.com> wrote:
> From: Tom Herbert <tom@herbertland.com>
>
> The handler 'ila_fill_encap_info' adds two attributes: ILA_ATTR_LOCATOR
> and ILA_ATTR_CSUM_MODE.
>
> nla_total_size_64bit() must be use for ILA_ATTR_LOCATOR.
>
> Also, do nla_put_u8 instead of nla_put_u64 for ILA_ATTR_CSUM_MODE.
>
> Fixes: f13a82d87b21 ("ipv6: use nla_put_u64_64bit()")
> Fixes: 90bfe662db13 ("ila: add checksum neutral ILA translations")
> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>
> Tom, I have taken the liberty of resending your patch, I hope it's ok
> for you. Goal is to fix this before net-next closes.
>
> v1 -> v2:
>   update the patch after the merge of net (and thus update 'Fixes' tag)
>   use nla_total_size_64bit() for ILA_ATTR_LOCATOR
>
>  net/ipv6/ila/ila_lwt.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
> index 17038e1ede98..1dfb64166d7d 100644
> --- a/net/ipv6/ila/ila_lwt.c
> +++ b/net/ipv6/ila/ila_lwt.c
> @@ -133,7 +133,7 @@ static int ila_fill_encap_info(struct sk_buff *skb,
>         if (nla_put_u64_64bit(skb, ILA_ATTR_LOCATOR, (__force u64)p->locator.v64,
>                               ILA_ATTR_PAD))
>                 goto nla_put_failure;
> -       if (nla_put_u64(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
> +       if (nla_put_u8(skb, ILA_ATTR_CSUM_MODE, (__force u8)p->csum_mode))
>                 goto nla_put_failure;
>
>         return 0;
> @@ -144,7 +144,9 @@ nla_put_failure:
>
>  static int ila_encap_nlsize(struct lwtunnel_state *lwtstate)
>  {
> -       return nla_total_size(sizeof(u64)); /* ILA_ATTR_LOCATOR */
> +       return nla_total_size_64bit(sizeof(u64)) + /* ILA_ATTR_LOCATOR */
> +              nla_total_size(sizeof(u8)) +        /* ILA_ATTR_CSUM_MODE */
> +              0;
>  }
>
>  static int ila_encap_cmp(struct lwtunnel_state *a, struct lwtunnel_state *b)
> --
> 2.8.1
>

Acked-by: Tom Herbert <tom@herbertland.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next v2] ila: ipv6/ila: fix nlsize calculation for lwtunnel
  2016-05-10  9:56   ` [PATCH net-next v2] " Nicolas Dichtel
  2016-05-10 15:51     ` Tom Herbert
@ 2016-05-10 20:01     ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2016-05-10 20:01 UTC (permalink / raw)
  To: nicolas.dichtel; +Cc: tom, netdev

From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Tue, 10 May 2016 11:56:32 +0200

> From: Tom Herbert <tom@herbertland.com>
> 
> The handler 'ila_fill_encap_info' adds two attributes: ILA_ATTR_LOCATOR
> and ILA_ATTR_CSUM_MODE.
> 
> nla_total_size_64bit() must be use for ILA_ATTR_LOCATOR.
> 
> Also, do nla_put_u8 instead of nla_put_u64 for ILA_ATTR_CSUM_MODE.
> 
> Fixes: f13a82d87b21 ("ipv6: use nla_put_u64_64bit()")
> Fixes: 90bfe662db13 ("ila: add checksum neutral ILA translations")
> Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> Signed-off-by: Tom Herbert <tom@herbertland.com>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-05-10 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29  0:12 [PATCH net-next] ila: ipv6/ila: fix nlsize calculation for lwtunnel Tom Herbert
2016-04-29  7:40 ` Nicolas Dichtel
2016-05-01 23:39 ` David Miller
2016-05-10  9:56   ` [PATCH net-next v2] " Nicolas Dichtel
2016-05-10 15:51     ` Tom Herbert
2016-05-10 20:01     ` 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.