From: Pablo Neira Ayuso <pablo@netfilter.org>
To: xelra <xelra@protonmail.com>
Cc: "netfilter-devel@vger.kernel.org"
<netfilter-devel@vger.kernel.org>, Phil Sutter <phil@nwl.cc>,
Florian Westphal <fw@strlen.de>
Subject: Re: [nft] 1.1.7: limit rate without burst breaks later tokens
Date: Wed, 4 Nov 2026 12:11:03 +0100 [thread overview]
Message-ID: <ausSx0uJvqau0txv@chamomile> (raw)
In-Reply-To: <VPAY0CnKhCaOKYE6oo_AU7sR5MaGIGzyPkXi00RlaucbyN78KYBqK73XfyJ-yyXQENIvvXeFJq_fNrYbJuW8LcqZvZyf4J3kr66jvsojxCU=@protonmail.com>
On Tue, Nov 03, 2026 at 08:58:25PM +0000, xelra wrote:
> Hi,
>
> nftables 1.1.7 fails to parse a rule with a "limit rate" that has no
> "burst", followed by "reject with tcp reset" and anything after it:
>
> $ cat repro.nft
> table inet t {
> chain c {
> tcp dport 1 limit rate 5/second reject with tcp reset comment "x"
> }
> }
> $ nft -c -f repro.nft
> repro.nft:3:59-59: Error: syntax error, unexpected junk
>
> Column 59 is the "c" of "comment", which the error lists among the
> tokens it expected.
>
> Without the comment, the next statement fails instead, at "lo" in
> "iif lo accept", even when it's on the next line. The rule parses fine
> with an explicit "burst 5 packets", without the limit, or with an icmpx
> reject instead of the tcp reset.
The scanner updates are bringing issues.
I would suggest a revert of these patches, and make a new release.
Then go back to the whiteboard to see if the scanner can be improved
in a different way.
Unless Phil prefers to go ahead a explore something in the opposite
direction and refine what is already in the tree.
> JUNK for a plain word means the scanner is in SCANSTATE_RATE there,
> the only exclusive start condition. My guess from reading
> scanner_pop_start_cond(): without a burst, bison's lookahead after the
> rate is scanned while SCANSTATE_RATE is active and pushes its own
> scope, so the rate and limit pops are deferred via flex_state_pop. The
> push/pop pairs of TCP and CMD_RESET in "reject with tcp reset" then use
> up that count, and the scanner falls back into SCANSTATE_RATE.
>
> 1.1.6 parses all of the above. Bisecting points to 9d105581b5f1
> ("scanner: Introduce SCANSTATE_RATE"), and current master
> (07be13393b00) fails the same way. The fix already in 1.1.7, "scanner:
> Accept all statements' first words in all scopes", doesn't cover this
> case.
>
> Workaround: an explicit burst, or the limit on a jump and the reject in
> its own chain.
>
>
prev parent reply other threads:[~2026-11-04 11:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 20:58 [nft] 1.1.7: limit rate without burst breaks later tokens xelra
2026-11-04 11:11 ` Pablo Neira Ayuso [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=ausSx0uJvqau0txv@chamomile \
--to=pablo@netfilter.org \
--cc=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=phil@nwl.cc \
--cc=xelra@protonmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.