Linux Netfilter development
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: "Jan Kończak" <jan.konczak@cs.put.poznan.pl>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nft] parser_bison: on syntax errors, output expected tokens
Date: Thu, 4 Dec 2025 23:37:33 +0100	[thread overview]
Message-ID: <aTINLRJlBUIox3pC@strlen.de> (raw)
In-Reply-To: <1950751.CQOukoFCf9@imladris>

Jan Kończak <jan.konczak@cs.put.poznan.pl> wrote:
> Now, on syntax erros, e.g., 'nft create fable filter', the user sees:
>    Error: syntax error, unexpected string
>    create fable filter
>           ^^^^^
> The patch builds an error message that lists what the parser expects
> to see, in that case it would print:
>    Error: syntax error, unexpected string
>    expected any of: synproxy, table, chain, set, element, map,
>    flowtable, ct, counter, limit, quota, secmark
>    create fable filter
>           ^^^^^

Thanks, this looks great.
Just a note that there might be slight delay with this getting applied
because we'd like to make a new release soon.

> Heed that the list of possible items on the parser's side is not
> always consistent with expectations.
> For instance, lexer/parser recognizes 'l4proto' in this command:
>    nft add rule ip F I meta l4proto tcp
> as a generic '%token <string> STRING', while 'iifname' in 
>    nft add rule ip F I meta iifname eth0
> is recognized as a '%token IIFNAME'
> In such case the parser is only able to say that right after 'meta'
> it expects 'iifname' or 'string', rather than 'iifname' and 'l4proto'.

Yes, thats fine.

We should move this to flex keywords, this STRING hack dates back to
the pre-flex-start-conditions era where adding new meta keywords might
have broken existing rulesets.

  reply	other threads:[~2025-12-04 22:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04 21:54 [PATCH nft] parser_bison: on syntax errors, output expected tokens Jan Kończak
2025-12-04 22:37 ` Florian Westphal [this message]
2025-12-13 12:32   ` Jan Kończak
2026-01-16 13:07 ` Florian Westphal

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=aTINLRJlBUIox3pC@strlen.de \
    --to=fw@strlen.de \
    --cc=jan.konczak@cs.put.poznan.pl \
    --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