summaryrefslogtreecommitdiffstats
path: root/src/scanner.l
diff options
context:
space:
mode:
authorArturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>2014-01-23 17:42:34 +0000
committerPatrick McHardy <kaber@trash.net>2014-01-23 17:42:34 +0000
commitcb86c1691c6900881b43229c07779412ffc48154 (patch)
tree4017d9fa5d34d883f2c432d84e91ce86df53c879 /src/scanner.l
parent2f61f093c3149465f2a68764b25c817adbe87fcd (diff)
ruleset: add XML/JSON export
This patch adds the following operation: :~# nft export <xml|json> The XML/JSON output is provided raw by libnftnl, thus without format. In case of XML, you can give format with the `xmllint' tool from libxml2-tools: :~# nft list ruleset xml | xmllint --format - In case of JSON, you can use `json_pp' from perl standar package: :~# nft list ruleset json | json_pp A format field is added in struct cmd, and it will be reused in the import operation. Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'src/scanner.l')
-rw-r--r--src/scanner.l4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/scanner.l b/src/scanner.l
index f133f237..47ab1e23 100644
--- a/src/scanner.l
+++ b/src/scanner.l
@@ -255,6 +255,7 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"list" { return LIST; }
"flush" { return FLUSH; }
"rename" { return RENAME; }
+"export" { return EXPORT; }
"position" { return POSITION; }
@@ -411,6 +412,9 @@ addrstring ({macaddr}|{ip4addr}|{ip6addr})
"proto-src" { return PROTO_SRC; }
"proto-dst" { return PROTO_DST; }
+"xml" { return XML; }
+"json" { return JSON; }
+
{addrstring} {
yylval->string = xstrdup(yytext);
return STRING;