Skip to contentSkip to conversation

example: Parse and create netlink message using the new parsing functions.

PATCH Superseded Alvaro Neira Ayuso 1 participant 1 message Jan 26, 2015 netfilter

v3 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

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

---
[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
index fafcb76..e002d36 100644
@@ -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