[nft PATCH 3/4] json: Print range expressions numerically

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 src/json.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/json.c b/src/json.c
index c0fc42263c1a0..1708f22dda408 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)
-- 
2.18.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux