Netfilter-Devel Archive mirror
 help / color / mirror / Atom feed
From: Phil Sutter <phil@nwl.cc>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] json: Accept more than two operands in binary expressions
Date: Wed, 20 Mar 2024 21:44:41 +0100	[thread overview]
Message-ID: <ZftKuZIJ_Bnd5dBg@orbyte.nwl.cc> (raw)
In-Reply-To: <ZfsaHoVscFBO73ib@calendula>

On Wed, Mar 20, 2024 at 06:17:18PM +0100, Pablo Neira Ayuso wrote:
> On Wed, Mar 20, 2024 at 03:58:06PM +0100, Phil Sutter wrote:
> > The most common use case is ORing flags like
> > 
> > | syn | ack | rst
> > 
> > but nft seems to be fine with less intuitive stuff like
> > 
> > | meta mark set ip dscp << 2 << 3
> 
> This is equivalent to:
> 
>   meta mark set ip dscp << 5
> 
> userspace is lacking the code to simplify this, just like it does for:
> 
>   meta mark set ip dscp | 0x8 | 0xf0
> 
> results in:
> 
>   meta mark set ip dscp | 0xf8

You're right, of course. Simplifying the input is a different task
though, I merely made sure that JSON input/output matches what regular
syntax supports as well.

Input optimization should happen in eval phase (or so) anyway and thus
independent of where input was parsed from.

Cheers, Phil

      reply	other threads:[~2024-03-20 20:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-20 14:58 [nft PATCH] json: Accept more than two operands in binary expressions Phil Sutter
2024-03-20 17:17 ` Pablo Neira Ayuso
2024-03-20 20:44   ` Phil Sutter [this message]

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=ZftKuZIJ_Bnd5dBg@orbyte.nwl.cc \
    --to=phil@nwl.cc \
    --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 read-only IMAP folder(s) and NNTP newsgroup(s).