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

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

 



Is there a way to flush all the elements in a set through command
line? e.g. using command line as

___________________________
nft flush set ip6 my_table my_set
___________________________


just like it can be done with rules in the chain etc.

When I try the above I get the following error:

BUG: invalid command object type 2
nft: rule.c:1245: do_command_flush: Assertion `0' failed.
Aborted (core dumped)



On Wed, Nov 30, 2016 at 10:17 PM, Khawar Shehzad
<shehzad.khawar@xxxxxxxxx> wrote:
> 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