diff options
author | Álvaro Neira Ayuso <alvaroneay@gmail.com> | 2013-07-31 15:21:27 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2013-07-31 16:46:34 +0200 |
commit | 2a99ca448411afe1a9f34293e8395f719c7803c9 (patch) | |
tree | 651caea22d0411ce9ccfd8fcec6ea3543b5b8aa8 /tests/nft-parsing-test.c | |
parent | 6670f8f3645fc3d271094a493880e7f06961f674 (diff) |
tests: chain: add json parsing support
Test the functions for parsing chains in JSON.
Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'tests/nft-parsing-test.c')
-rw-r--r-- | tests/nft-parsing-test.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/nft-parsing-test.c b/tests/nft-parsing-test.c index 0734f07..e111fd0 100644 --- a/tests/nft-parsing-test.c +++ b/tests/nft-parsing-test.c @@ -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; |