]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
json: Print range expressions numerically
authorPhil Sutter <phil@nwl.cc>
Tue, 11 Sep 2018 20:14:26 +0000 (22:14 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 13 Sep 2018 08:42:35 +0000 (10:42 +0200)
This applies the same change as in commit 85b1e3c0052ef ("src: Always
print range expressions numerically") to JSON output for consistency.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Florian Westphal <fw@strlen.de>
src/json.c

index c0fc42263c1a0ba3c615460c1f7231753672de08..1708f22dda4085406f0f18834762bac4f32bd409 100644 (file)
@@ -393,9 +393,15 @@ json_t *relational_expr_json(const struct expr *expr, struct output_ctx *octx)
 
 json_t *range_expr_json(const struct expr *expr, struct output_ctx *octx)
 {
-       return json_pack("{s:[o, o]}", "range",
+       json_t *root;
+
+       octx->numeric += NFT_NUMERIC_ALL + 1;
+       root = json_pack("{s:[o, o]}", "range",
                         expr_print_json(expr->left, octx),
                         expr_print_json(expr->right, octx));
+       octx->numeric -= NFT_NUMERIC_ALL + 1;
+
+       return root;
 }
 
 json_t *meta_expr_json(const struct expr *expr, struct output_ctx *octx)