new file mode 100644
@@ -0,0 +1 @@
+{ "chain": {"name": "input","handle": 1,"bytes": 1375696,"packets": 4136,"family": "ip","table": "filter","use": 0,"type": "filter","hooknum": "NF_INET_LOCAL_IN","prio": 0,"policy": "accept"}}
new file mode 100644
@@ -0,0 +1 @@
+{ "chain": {"name": "forward","handle": 2,"bytes": 0,"packets": 0,"family": "ip","table": "filter","use": 0,"type": "filter","hooknum": "NF_INET_FORWARD","prio": 0,"policy": "accept"}}
new file mode 100644
@@ -0,0 +1 @@
+{ "chain": {"name": "output","handle": 3,"bytes": 454786,"packets": 2681,"family": "ip","table": "filter","use": 0,"type": "filter","hooknum": "NF_INET_LOCAL_OUT","prio": 0,"policy": "accept"}}
new file mode 100644
@@ -0,0 +1 @@
+{ "chain": {"name": "chain1","handle": 4,"bytes": 0,"packets": 0,"family": "ip","table": "filter","use": 0}}
@@ -24,6 +24,7 @@ static int test_json(const char *filename)
#ifdef JSON_PARSING
int ret = -1;
struct nft_table *t = NULL;
+ struct nft_chain *c = NULL;
json_t *root;
json_error_t error;
char *json = NULL;
@@ -47,6 +48,14 @@ static int test_json(const char *filename)
nft_table_free(t);
}
+ } else if (json_object_get(root, "chain") != NULL) {
+ c = nft_chain_alloc();
+ if (c != NULL) {
+ if (nft_chain_parse(c, NFT_CHAIN_PARSE_JSON, json) == 0)
+ ret = 0;
+
+ nft_chain_free(c);
+ }
}
return ret;