Patchwork [libnftables,2/2] Add code for testing the new functions for exporting rules to JSON Format

login
register
mail settings
Submitter Alvaro Neira
Date June 27, 2013, 7:56 p.m.
Message ID <20130627195626.13980.61479.stgit@Ph0enix>
Download mbox | patch
Permalink /patch/255128/
State Accepted
Headers show

Comments

Alvaro Neira - June 27, 2013, 7:56 p.m.
From: Álvaro Neira Ayuso <alvaroneay@gmail.com>

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
 examples/nft-rule-get.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira - June 29, 2013, 10:02 a.m.
Also applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/examples/nft-rule-get.c b/examples/nft-rule-get.c
index 5bf41f5..2404f27 100644
--- a/examples/nft-rule-get.c
+++ b/examples/nft-rule-get.c
@@ -54,8 +54,11 @@  int main(int argc, char *argv[])
 	struct nft_rule *t = NULL;
 	int ret;
 
-	if (argc == 2 && strcmp(argv[1], "xml") == 0 )
+	if (argc == 2 && strcmp(argv[1], "xml") == 0 ){
 		type = NFT_RULE_O_XML;
+	}else if (argc == 2 && strcmp(argv[1], "json") == 0 ){
+		type = NFT_RULE_O_JSON;
+	}
 
 	/* XXX requires table, chain and handle attributes for selective get */