Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ddb6b71 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller
Browse files

ila: ipv6/ila: fix nlsize calculation for lwtunnel



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: f13a82d8 ("ipv6: use nla_put_u64_64bit()")
Fixes: 90bfe662 ("ila: add checksum neutral ILA translations")
Reported-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarNicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 93edb8c7
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -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 @@ static int ila_fill_encap_info(struct sk_buff *skb,

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)