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

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

 



Thanks Pablo, that helped a lot.


On Wed, Nov 30, 2016 at 9:27 PM, Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx> wrote:
> On Wed, Nov 30, 2016 at 09:14:34PM +0100, Pablo Neira Ayuso wrote:
>> On Wed, Nov 30, 2016 at 07:46:05PM +0000, Khawar Shehzad wrote:
>> > 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".
>>
>> Oh, those examples are broken. Batch header and trailing are missing,
>> I'm going to fix this.
>
> Just fixed examples to add set element:
>
> http://git.netfilter.org/libnftnl/commit/?id=6a32dbd4cd56c8fede6044a447469fbd0e35c10a
> http://git.netfilter.org/libnftnl/commit/?id=cc1b5986f5379c17c97ff9fb7064aceddf0b87ed
--
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