From: Florian Westphal <fw@strlen.de>
To: netfilter-devel@vger.kernel.org
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH nft] expr: do not suppress OP_EQ when RHS is bitmask type
Date: Mon, 17 Mar 2014 23:08:38 +0100 [thread overview]
Message-ID: <1395094118-32580-1-git-send-email-fw@strlen.de> (raw)
bitmask types default to flagcmp now, thus do not suppress OP_EQ. Else,
rule filter output tcp flags syn
rule filter output tcp flags == syn
are both displayed as 'flags syn'.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
src/expression.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/expression.c b/src/expression.c
index 1313925..fa14d99 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -514,13 +514,21 @@ static void binop_arg_print(const struct expr *op, const struct expr *arg)
printf(")");
}
+static bool must_print_eq_op(const struct expr *expr)
+{
+ if (expr->right->dtype->basetype != NULL &&
+ expr->right->dtype->basetype->type == TYPE_BITMASK)
+ return true;
+
+ return expr->left->ops->type == EXPR_BINOP;
+}
+
static void binop_expr_print(const struct expr *expr)
{
binop_arg_print(expr, expr->left);
if (expr_op_symbols[expr->op] &&
- (expr->op != OP_EQ ||
- expr->left->ops->type == EXPR_BINOP))
+ (expr->op != OP_EQ || must_print_eq_op(expr)))
printf(" %s ", expr_op_symbols[expr->op]);
else
printf(" ");
--
1.8.1.5
next reply other threads:[~2014-03-17 22:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-17 22:08 Florian Westphal [this message]
2014-04-04 8:17 ` [PATCH nft] expr: do not suppress OP_EQ when RHS is bitmask type Pablo Neira Ayuso
2014-04-04 8:33 ` Florian Westphal
2014-04-04 9:44 ` Pablo Neira Ayuso
2014-04-04 12:09 ` Patrick McHardy
2014-04-04 14:04 ` Pablo Neira Ayuso
2014-04-04 14:24 ` Patrick McHardy
2014-04-04 15:23 ` Pablo Neira Ayuso
2014-04-04 15:39 ` Florian Westphal
2014-04-04 12:07 ` Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1395094118-32580-1-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).