netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Arturo Borrero Gonzalez <arturo@debian.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [nft PATCH] evaluate: prevent using sets in payload statements
Date: Wed, 24 May 2017 17:48:20 +0200	[thread overview]
Message-ID: <20170524154820.GC24697@salvia> (raw)
In-Reply-To: <149563146450.21555.7985467199304693684.stgit@nfdev2.cica.es>

On Wed, May 24, 2017 at 03:11:04PM +0200, Arturo Borrero Gonzalez wrote:
> Prevent this assert:
> 
> % nft [..] tcp dport set { 0 , 1 }
> BUG: unknown expression type set reference
> nft: netlink_linearize.c:696: netlink_gen_expr: Assertion `0' failed.
> Aborted
> 
> We can't use a set here because we will not known what value to use.
> 
> With this patch, this is produced:
> 
> % nft [..] tcp dport set {1, 2 }
> <cmdline>:1:19-27: Error: you cannot use a set here
> add rule ip nat c tcp dport set {1, 2 }
>                   ^^^^^^^^^~~~~~~~~~~~~
> % nft [..] tcp dport set @s
> <cmdline>:1:19-27: Error: you cannot reference a set here
> add rule ip nat c tcp dport set @s
>                   ^^^^^^^^^~~~~~~~
> 
> Using maps is still allowed:
> 
> % nft [..] tcp dport set numgen inc mod 2 map { 0 : 4040 , 1 : 4050 }

Good catch.

I think we should reject this more generically, ie.

nft add rule x y meta mark set {1, 2 }

  reply	other threads:[~2017-05-24 15:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-24 13:11 [nft PATCH] evaluate: prevent using sets in payload statements Arturo Borrero Gonzalez
2017-05-24 15:48 ` Pablo Neira Ayuso [this message]
2017-05-24 15:49   ` Pablo Neira Ayuso

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=20170524154820.GC24697@salvia \
    --to=pablo@netfilter.org \
    --cc=arturo@debian.org \
    --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).