netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alvaro Neira <alvaroneay@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: eric@regit.org
Subject: [libnftables PATCH 3/7] table: remove the properties node in Json output
Date: Wed, 31 Jul 2013 15:21:06 +0200	[thread overview]
Message-ID: <20130731132105.29730.12385.stgit@Ph0enix> (raw)
In-Reply-To: <20130731132051.29730.53717.stgit@Ph0enix>

From: Álvaro Neira Ayuso <alvaroneay@gmail.com>

I have removed the properties node from table because it's a node without relevant information

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
---
 src/table.c                   |   12 ++----------
 tests/jsonfiles/01-table.json |    2 +-
 tests/jsonfiles/02-table.json |    2 +-
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/table.c b/src/table.c
index 526f3e7..402e8c1 100644
--- a/src/table.c
+++ b/src/table.c
@@ -300,12 +300,6 @@ static int nft_table_json_parse(struct nft_table *t, char *json)
 
 	nft_table_attr_set_str(t, NFT_TABLE_ATTR_NAME, strdup(str));
 
-	root = json_object_get(root, "properties");
-	if (root == NULL) {
-		errno = EINVAL;
-		goto err;
-	}
-
 	str = nft_jansson_value_parse_str(root, "family");
 	if (str == NULL)
 		goto err;
@@ -360,10 +354,8 @@ static int nft_table_snprintf_json(char *buf, size_t size, struct nft_table *t)
 	return snprintf(buf, size,
 			"{\"table\" : {"
 			"\"name\" : \"%s\","
-			"\"properties\" : {"
-				"\"family\" : \"%s\","
-				"\"table_flags\" : %d"
-				"}"
+			"\"family\" : \"%s\","
+			"\"table_flags\" : %d"
 			"}"
 			"}" ,
 			t->name, nft_family2str(t->family), t->table_flags);
diff --git a/tests/jsonfiles/01-table.json b/tests/jsonfiles/01-table.json
index 9afc014..a5ba38b 100644
--- a/tests/jsonfiles/01-table.json
+++ b/tests/jsonfiles/01-table.json
@@ -1 +1 @@
-{"table" : {"name" : "filter","properties" : {"family" : "ip","table_flags" : 0}}}
+{"table" : {"name" : "filter","family" : "ip","table_flags" : 0}}
diff --git a/tests/jsonfiles/02-table.json b/tests/jsonfiles/02-table.json
index b66ec52..f1171a1 100644
--- a/tests/jsonfiles/02-table.json
+++ b/tests/jsonfiles/02-table.json
@@ -1 +1 @@
-{"table" : {"name" : "filter2","properties" : {"family" : "ip6","table_flags" : 0}}}
+{"table" : {"name" : "filter2","family" : "ip6","table_flags" : 0}}

--
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

  parent reply	other threads:[~2013-07-31 13:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-31 13:20 [libnftables PATCH 1/7] chain: change policy2str function to nft_verdict2str function Alvaro Neira
2013-07-31 13:20 ` [libnftables PATCH 2/7] jansson: Add helper function for building the tree Alvaro Neira
2013-07-31 13:21 ` Alvaro Neira [this message]
2013-07-31 13:21 ` [libnftables PATCH 4/7] chain: remove the properties node in Json output Alvaro Neira
2013-07-31 13:21 ` [libnftables PATCH 5/7] chain:Add json parser support Alvaro Neira
2013-07-31 13:21 ` [libnftables PATCH 6/7] test:chain:test json parsing support Alvaro Neira
2013-07-31 13:21 ` [libnftables PATCH 7/7] examples: Add nft-chain-json-add Alvaro Neira
2013-07-31 17:14 ` [libnftables PATCH 1/7] chain: change policy2str function to nft_verdict2str function Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130731132105.29730.12385.stgit@Ph0enix \
    --to=alvaroneay@gmail.com \
    --cc=eric@regit.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).