From cb86c1691c6900881b43229c07779412ffc48154 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Gonzalez Date: Thu, 23 Jan 2014 17:42:34 +0000 Subject: ruleset: add XML/JSON export This patch adds the following operation: :~# nft export 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 Signed-off-by: Patrick McHardy --- src/scanner.l | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/scanner.l') 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; -- cgit v1.2.3