[PATCH 3/3 nft,v2] expression: always print range expression numerically

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

 



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@xxxxxx>
Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
---
v2: Cast out all literal flags in ranges.
    Use NFT_CTX_OUTPUT_NUMERIC_ALL to enable all numerical flags.

 src/expression.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/expression.c b/src/expression.c
index 5ff469c561d5..62a6f890f814 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -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);
-- 
2.11.0




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

  Powered by Linux