netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] expression: fix printing of binary operation
Date: Wed, 15 Jan 2014 11:28:25 +0000	[thread overview]
Message-ID: <20140115112825.GE17728@macbook.localnet> (raw)
In-Reply-To: <20140115112506.GA10697@localhost>

On Wed, Jan 15, 2014 at 12:25:06PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Jan 15, 2014 at 11:21:29AM +0000, Patrick McHardy wrote:
> > On Wed, Jan 15, 2014 at 12:09:27PM +0100, Pablo Neira Ayuso wrote:
> > > This patch adds a special print function for the relational case in
> > > which == is assumed, so it's not printed. It also fixes the output of
> > > binary operations from:
> > > 
> > > & 0x00000003 0x00000001
> > > 
> > > to:
> > > 
> > > and 0x00000003 == 0x00000001
> > > 
> > > diff --git a/src/expression.c b/src/expression.c
> > > index 6da5c10..452b0d7 100644
> > > --- a/src/expression.c
> > > +++ b/src/expression.c
> > > @@ -411,7 +411,9 @@ static void binop_expr_print(const struct expr *expr)
> > >  		printf(" %s ", expr_op_symbols[expr->op]);
> > >  	else
> > >  		printf(" ");
> > > +
> > >  	expr_print(expr->right);
> > > +	printf(" ==");
> > 
> > That doesn't look right, binops can also occur outside of relational
> > expressions. I'd suggest to special case OP_EQ and not print it by
> > default unless the LHS is an EXPR_BINOP.
> 
> Indeed, this can be !=.

Yep, that as well. The patch I just sent should handle it correctly.

  reply	other threads:[~2014-01-15 11:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 11:09 [PATCH 1/2 nft RFC] expression: default to print binary operations using nominal representation Pablo Neira Ayuso
2014-01-15 11:09 ` [PATCH 2/2] expression: fix printing of binary operation Pablo Neira Ayuso
2014-01-15 11:21   ` Patrick McHardy
2014-01-15 11:25     ` Pablo Neira Ayuso
2014-01-15 11:28       ` Patrick McHardy [this message]
2014-01-15 11:27     ` Patrick McHardy
2014-01-15 11:41       ` Pablo Neira Ayuso
2014-01-15 11:49         ` Patrick McHardy
2014-01-15 11:59           ` Pablo Neira Ayuso
2014-01-15 11:18 ` [PATCH 1/2 nft RFC] expression: default to print binary operations using nominal representation Patrick McHardy
2014-01-15 11:32   ` Arturo Borrero Gonzalez
2014-01-15 11:36     ` 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=20140115112825.GE17728@macbook.localnet \
    --to=kaber@trash.net \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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).