nla_policy results in "sorry, unimplemented: non-trivial designated initializers not supported" during compile

Avery Rozar avery.rozar at insecure-it.com
Thu Jul 21 16:02:48 PDT 2016


For example in info.c from "iw" they build an nla_policy freq_policy[]
like this..

static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
   [NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 },
   [NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG },
   [NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG },
   [__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG },
   [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG },
   [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 },
};

Is the ".type" in "{ .type = NLA_U32 }" defined by "uint16_t type"?
Also the compile error points to the end of this freq_policy array. Is
it because I'm using a c file as an example and this would need to be
coded differently in c++?

Thanks.


On Thu, Jul 21, 2016 at 6:47 PM, David Ahern <dsa at cumulusnetworks.com> wrote:
> On 7/21/16 3:52 PM, Avery Rozar wrote:
>>
>> Please forgive my ignorance but I'm fairly new to c++ coming from
>> Python. I'm trying to build an nla_policy using the example here
>> (http://www.infradead.org/~tgr/libnl/doc/core.html "6.5.2").
>> What is ".type" referring to. Where is that defined? My IDE says it
>> can not resolve it, and when I compile I get "sorry, unimplemented:
>> non-trivial designated initializers not supported".
>> From what I've seen this error seems to stem from using g++ vs gcc. Is
>> this a c only example?
>
>
> are you referring to this one?
>
> struct nla_policy {
>         /** Type of attribute or NLA_UNSPEC */
>         uint16_t        type;
>
> It is in include/netlink/attr.h as the values for the type, NLA_XXXXX



More information about the libnl mailing list