Skip to contentSkip to conversation

parser_bison: explicit indication on export ruleset

PATCH New Pablo Neira Ayuso 1 participant 1 message Aug 23, 2016 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 parser_bison: explicit indication on export ruleset

This patch modifies the grammar to explicitly indicate what you want to export, eg.

 # nft export ruleset json

This leaves room to extend this later on to support other object types, such as integrating conntrack into nft.

This also leaves the syntax in consistent state wrt. other existing objects. The existing syntax is still preserved.

---
 src/parser_bison.y | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
src/parser_bison.y +7 -1
index e16b8a3..cd149e7 100644
@@ -882,7 +882,13 @@ rename_cmd		:	CHAIN		chain_spec	identifier
 			}
 			;
 
-export_cmd		:	export_format
+export_cmd		:	RULESET		export_format
+			{
+				struct handle h = { .family = NFPROTO_UNSPEC };
+				struct export *export = export_alloc($2);
+				$$ = cmd_alloc(CMD_EXPORT, CMD_OBJ_EXPORT, &h, &@$, export);
+			}
+			|	export_format
 			{
 				struct handle h = { .family = NFPROTO_UNSPEC };
 				struct export *export = export_alloc($1);
Signature · 1 line
2.1.4