diff options
-rw-r--r-- | src/set.c | 22 |
1 files changed, 15 insertions, 7 deletions
@@ -410,19 +410,15 @@ int nft_set_nlmsg_parse(const struct nlmsghdr *nlh, struct nft_set *s) EXPORT_SYMBOL(nft_set_nlmsg_parse); #ifdef JSON_PARSING -int nft_jansson_parse_set(struct nft_set *s, json_t *tree, - struct nft_parse_err *err) +static int nft_jansson_parse_set_info(struct nft_set *s, json_t *tree, + struct nft_parse_err *err) { - json_t *root, *array, *json_elem; + json_t *root = tree, *array, *json_elem; uint32_t flags, key_type, key_len, data_type, data_len, policy, size; int family, i; const char *name, *table; struct nft_set_elem *elem; - root = nft_jansson_get_node(tree, "set", err); - if (root == NULL) - return -1; - name = nft_jansson_parse_str(root, "name", err); if (name == NULL) return -1; @@ -503,6 +499,18 @@ int nft_jansson_parse_set(struct nft_set *s, json_t *tree, return 0; } + +int nft_jansson_parse_set(struct nft_set *s, json_t *tree, + struct nft_parse_err *err) +{ + json_t *root; + + root = nft_jansson_get_node(tree, "set", err); + if (root == NULL) + return -1; + + return nft_jansson_parse_set_info(s, root, err); +} #endif static int nft_set_json_parse(struct nft_set *s, const void *json, |