summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-09-11 22:14:26 +0200
committerFlorian Westphal <fw@strlen.de>2018-09-13 10:42:35 +0200
commitcbbdb960a262d8df86a2dfaa1b56c0182e97f3ed (patch)
tree5a9b4f7c7c99156a09e2e2c8cc91c44bb45ab0ee /src
parent758f8bd61bcad7809d776881bc1f8de0b2fab2e2 (diff)
json: Print range expressions numerically
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>
Diffstat (limited to 'src')
-rw-r--r--src/json.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/json.c b/src/json.c
index c0fc4226..1708f22d 100644
--- a/src/json.c
+++ b/src/json.c
@@ -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)