Le 19/04/2016 20:47, Eric Dumazet a écrit :
On Tue, 2016-04-19 at 14:31 -0400, David Miller wrote:+#ifndef HAVE_EFFICIENT_UNALIGNED_ACCESS + /* IF necessary, add a zero length NOP attribute so that the + * nla_data() of the IFLA_STATS64 will be 64-bit aligned. + * + * The nlattr header is 4 bytes in size, that's why we test + * if the skb->data _is_ aligned. This NOP attribute, plus + * nlattr header for IFLA_STATS64, will make nla_data() 8-byte + * aligned. + */ + if (IS_ALIGNED((unsigned long)skb->data, 8)) { + attr = nla_reserve(skb, IFLA_PAD, 0); + if (!attr) + return -EMSGSIZE; + } +#endifSince we want to use this in other places, we could define a helper. nla_align_64bit(skb, attribute) or something.
Yes, with the corresponding nla_total_size_64bit()
