netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Balazs Scheidler <balazs.scheidler@balabit.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: nftables: parser conflict between tokens & symbols
Date: Mon, 29 Jun 2015 16:57:25 +0200	[thread overview]
Message-ID: <20150629145725.GD2324@breakpoint.cc> (raw)
In-Reply-To: <20150626124423.GB5835@bzorp>

Balazs Scheidler <balazs.scheidler@balabit.com> wrote:
> I've noticed that our set of keywords in nftables is pretty rich and
> this can cause conflicts in the grammar when a keyword is also used
> as a symbol.
> For instance, we do have a "redirect" expression and "redirect" as
> a word is also used as an ICMP message type.
> 
> # here is the redirect expression in action, which works:
> $ nft add rule tcp dport 80 redirect to 8080
> 
> # here's an ICMP rule that works
> $ nft add rule filter input icmp type echo-request accept
> 
> # here's an ICMP rule that should work, but it doesn't
> $ nft add rule filter input icmp type redirect accept
> 
> The root cause is that "redirect" is now recognized as a token, whereas the
> icmp type is expecting a STRING token.

While we're at it, there are other issues, f.e.:

ct label saddr
ct label == saddr

won't work since saddr is considered to be the SADDR token.
Similar issues for other places where we accept arbitrary symbol names.

I think the above might be fixable via

|       CT      ct_key  error
{
	yychar = STRING;
...

But of course that won't fix up all cases, e.g.
ct label == saddr would still not work since we encounter
the error (unexpected token) after a relational expression.

Does anyone have better ideas other than plastering parser with error
handlers...?

  reply	other threads:[~2015-06-29 14:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26 12:44 nftables: parser conflict between tokens & symbols Balazs Scheidler
2015-06-29 14:57 ` Florian Westphal [this message]
2015-06-29 18:09   ` Pablo Neira Ayuso
2015-06-29 18:15     ` Patrick McHardy
2015-06-29 18:03 ` 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=20150629145725.GD2324@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=balazs.scheidler@balabit.com \
    --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).