[libnl-tiny PATCH] attr: add NLA_S8

Felix Fietkau nbd at nbd.name
Thu Mar 30 03:03:13 PDT 2023


On 30.03.23 11:47, Nick wrote:
> 
> On 3/30/23 11:43, Nick wrote:
>>
>> On 3/19/23 20:25, Hauke Mehrtens wrote:
>>> 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 
>>>
>>>
>> So I have to add all enum types?
> libnl is also not having all types:
> https://github.com/thom311/libnl/blob/main/include/netlink/attr.h#L33-L51
You can leave out entries at the end you don't need, but the values must 
match. So please add everything in between until you reach NLA_S8.
While you're at it, it might be a good idea to add at least the other 
NLA_S* types as well.

- Felix



More information about the openwrt-devel mailing list