example: Parse and create netlink message using the new parsing functions.
PATCH v3 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 v3]
* Rename the example to use another more clear.
* Change the help to explain better the use of this file.
examples/Makefile.am | 4 + examples/nft-ruleset-parse-file.c | 439 +++++++++++++++++++++++++++++++++++++ 2 files changed, 443 insertions(+) create mode 100644 examples/nft-ruleset-parse-file.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-parse-file \ 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_parse_file_SOURCES = nft-ruleset-parse-file.c +nft_ruleset_parse_file_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-parse-file.c new file +439 -0
439 lines not on this page · raw message
Signature · 1 line
1.7.10.4