Re: Programmatically adding Map element into the map/set using libnftnl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks. I want to add an element to existing ipv6 map programmatically
in C using libnftnl. From the above example commit, the code specifies
how to add a map (which I assessed by working on the
nft-set-elem-add.c example previously, thanks for the datatypes.c hint
too). I tried

        nftnl_set_elem_set(e, NFTNL_SET_ELEM_KEY, "fe80::2", 16);
        nftnl_set_elem_set(e, NFTNL_SET_ELEM_DATA, "fe80::3", 16);

AND

        nftnl_set_elem_set(e, NFTNL_SET_ELEM_KEY, &(sa1.sin6_addr),
sizeof(sa1.sin6_addr));
        nftnl_set_elem_set(e, NFTNL_SET_ELEM_DATA, &(sa2.sin6_addr),
sizeof(sa2.sin6_addr));

but both didn't work. It showed same error i.e. "error: Invalid argument".

Cheers,
Khawar

On Wed, Nov 30, 2016 at 7:34 PM, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> On Wed, Nov 30, 2016 at 07:16:28PM +0000, Khawar Shehzad wrote:
>> Hi,
>> I hope everybody is fine.
>>
>> I want to do following programmatically in C using libnftnl.
>>
>>
>> _______________________________________________
>> "nft add element ip6 my_table my_map {fe80::2 : fe80::3 }"
>> _______________________________________________
>>
>> My example code is below, and it gives "error: Invalid argument"
>> error. My question is simple how can I add an IPv6 map into a set/map.
>> My map type is "type ipv6_addr : ipv6_addr".
>
> Just added an example for you at:
>
> http://git.netfilter.org/libnftnl/commit/?id=2d894a97c28e6c7c7f064d16bec0167d000e901c
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux