[libnl-tiny PATCH] attr: add NLA_S8

Hauke Mehrtens hauke at hauke-m.de
Sun Mar 19 12:25:14 PDT 2023


On 3/15/23 14:37, Nick Hainke wrote:
> NLA_S8 is used by newer hostapd versions.
> 
> Signed-off-by: Nick Hainke <vincent at systemli.org>
> ---
>   attr.c                 |  1 +
>   include/netlink/attr.h | 35 +++++++++++++++++++++++++++++++++++
>   2 files changed, 36 insertions(+)
> 
> diff --git a/attr.c b/attr.c
> index eae91e5..abde67f 100644
> --- a/attr.c
> +++ b/attr.c
> @@ -437,6 +437,7 @@ static uint16_t nla_attr_minlen[NLA_TYPE_MAX+1] = {
>   	[NLA_U32]	= sizeof(uint32_t),
>   	[NLA_U64]	= sizeof(uint64_t),
>   	[NLA_STRING]	= 1,
> +	[NLA_S8]	= sizeof(int8_t),
>   };
>   
>   static int validate_nla(struct nlattr *nla, int maxtype,
> diff --git a/include/netlink/attr.h b/include/netlink/attr.h
> index 3e3047f..3a5d53d 100644
> --- a/include/netlink/attr.h
> +++ b/include/netlink/attr.h
> @@ -45,6 +45,7 @@ enum {
>   	NLA_FLAG,	/**< Flag */
>   	NLA_MSECS,	/**< Micro seconds (64bit) */
>   	NLA_NESTED,	/**< Nested attributes */
> +	NLA_S8,
>   	__NLA_TYPE_MAX,
>   };

I think this has to match the kernel definitions of the same enum.
https://elixir.bootlin.com/linux/v6.1.20/source/include/net/netlink.h#L178

Please add the other definitions added in this commit too:
https://github.com/thom311/libnl/commit/6263a11bfcd033a88583faa719d3911850f0c4f5

I think you should also add all the nla_put_s* and nla_get_s* 
definitions for s8, s16, s32 and s64. libnl-tiny adds them to the header 
only so they do not make the binary bigger when they are not used.

Hauke



More information about the openwrt-devel mailing list