On 2022-07-08, at 21:18:24 +0300, Serg wrote: > I am trying to integrate my userspace tool with nftables directly, i.e. > without executing nft utility. > > However, I failed to find any libnftnl-related documentation, so I tried to > play with examples located at > <https://git.netfilter.org/libnftnl/tree/examples>. I tried to run > nft-set-elem-add.c, but every time I got `error: Invalid argument'. Could > you help me troubleshoot this issue, please? > > Some details about my system to help reproduce this issue: > > 0. Clone master branch from git.netfilter.org > > 1. nftables rules are: > > # nft add table ip table_example > # nft 'add set ip table_example set_example { type ipv4_addr; }' > > 2. My linux kernel version is 5.15.32 > > 3. Run the following command: > > $ sudo ./nft-set-elem-add ip table_example set_example nft-set-elem-add attempts to add two 16-bit integer values to the set. You have defined the set with type `ipv4_addr`. Try `inet_service` instead: $ sudo nft add table ip table_example $ sudo nft add set ip table_example set_example \{ type inet_service\; \} $ sudo nft list table ip table_example table ip table_example { set set_example { type inet_service } } $ sudo ./examples/nft-set-elem-add ip table_example set_example $ sudo nft list table ip table_example table ip table_example { set set_example { type inet_service elements = { 256, 512 } } } J.
Attachment:
signature.asc
Description: PGP signature