On Tuesday 03 May 2016 14:47:19 Andrew Lunn wrote:
> On Tue, May 03, 2016 at 02:26:34PM +0200, Sven Eckelmann wrote:
> > On Tuesday 03 May 2016 14:20:46 Andrew Lunn wrote:
> > [...]
> > > There does not seem to be a way to say that BATADV_ATTR_VERSION is
> > > also an NLA_STRING.
> > 
> > Please check "policy" in the link I gave you.
> 
> I did. And i still don't get how you can check the type.
> 
>   Andrew

   struct nla_policy {
            uint16_t        type;
            uint16_t        minlen;
            uint16_t        maxlen;
   };

there is an entry for type, minlen and maxlen. The type member is to check for
the type. Here is an example how to check the type from batctl:

    static struct nla_policy info_data_link_policy[IFLA_MAX + 1] = {
        [IFLA_LINKINFO] = { .type = NLA_NESTED },
            [IFLA_LINK] = { .type = NLA_U32 },
    };
    [...]
        ret = nlmsg_parse(n, sizeof(struct ifinfomsg), tb, IFLA_MAX,
                          info_data_link_policy);

Kind regards,
        Sven

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to