]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expression: always print range expression numerically
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 29 Oct 2018 20:50:49 +0000 (21:50 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 30 Oct 2018 09:30:00 +0000 (10:30 +0100)
Otherwise we end up displaying things that we cannot parse as input.
Moreover, in a range, it's relevant to the user the values that are
enclosed in the range, so let's print this numerically.

Fixes: baa4e0e3fa5f ("src: add NFT_CTX_OUTPUT_NUMERIC_PROTO")
Reported-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/expression.c

index 5ff469c561d54ce0745dde9acb4552b262985e04..62a6f890f814e46263028a0b34b1959e5a060cd7 100644 (file)
@@ -662,8 +662,10 @@ static void range_expr_print(const struct expr *expr, struct output_ctx *octx)
 {
        unsigned int flags = octx->flags;
 
-       octx->flags &= ~NFT_CTX_OUTPUT_SERVICE;
-       octx->flags |= NFT_CTX_OUTPUT_NUMERIC_PROTO;
+       octx->flags &= ~(NFT_CTX_OUTPUT_SERVICE |
+                        NFT_CTX_OUTPUT_REVERSEDNS |
+                        NFT_CTX_OUTPUT_GUID);
+       octx->flags |= NFT_CTX_OUTPUT_NUMERIC_ALL;
        expr_print(expr->left, octx);
        nft_print(octx, "-");
        expr_print(expr->right, octx);