[libnftables PATCH 3/7] table: remove the properties node in Json output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Álvaro Neira Ayuso <alvaroneay@xxxxxxxxx>

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

Signed-off-by: Alvaro Neira Ayuso <alvaroneay@xxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux