example: Parse and create netlink message using the new parsing functions.
PATCH v2 4/5 example: Parse and create netlink message using the new parsing functions.
With this example, we can parse the elements in the ruleset and create the netlink message with the action associated. For example:
- Flush ruleset
- Add, delete or flush tables/chains
- Add, delete sets
- Add, delete set elements
- Add, delete, replace or prepend rules
Signed-off-by Alvaro Neira Ayuso <[email protected]>
---
[changes in v2]
* Unset the handle in rules if we want to add or insert it.
examples/Makefile.am | 4 + examples/nft-ruleset-cmd.c | 439 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 443 insertions(+) create mode 100644 examples/nft-ruleset-cmd.c
examples/Makefile.am +4 -0
@@ -22,6 +22,7 @@ check_PROGRAMS = nft-table-add \ nft-set-elem-get \ nft-set-elem-del \ nft-ruleset-get \ + nft-ruleset-cmd \ nft-compat-get nft_table_add_SOURCES = nft-table-add.c
@@ -90,5 +91,8 @@ nft_set_elem_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} nft_ruleset_get_SOURCES = nft-ruleset-get.c nft_ruleset_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} +nft_ruleset_cmd_SOURCES = nft-ruleset-cmd.c +nft_ruleset_cmd_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS} + nft_compat_get_SOURCES = nft-compat-get.c nft_compat_get_LDADD = ../src/libnftnl.la ${LIBMNL_LIBS}
examples/nft-ruleset-cmd.c new file +439 -0
439 lines not on this page · raw message
Signature · 1 line
1.7.10.4