]> git.ipfire.org Git - thirdparty/nftables.git/commit
xt: Print comment match data as well
authorPhil Sutter <phil@nwl.cc>
Fri, 23 Jan 2026 00:21:21 +0000 (01:21 +0100)
committerPhil Sutter <phil@nwl.cc>
Thu, 5 Feb 2026 15:15:17 +0000 (16:15 +0100)
commitece10aa3f8cc4da0ab105a3b4b2a3f62ce9ec992
treef4faafa602a3a5096832d77e597684b0267fc27d
parentf58b5ace1ec21f5bc366c00c249832e08145e092
xt: Print comment match data as well

In order to translate comment matches into the single nftables rule
comment, libxtables does not immediately (maybe mid-rule) print a
comment match's string but instead stores it into struct
xt_xlate::comment array for later.

Since xt_stmt_xlate() is called by a statement's .print callback which
can't communicate data back to caller, nftables has to print it right
away.

Since parser_bison accepts rule comments only at end of line though, the
output from above can't be restored anymore. Which is a bad idea to
begin with so accept this quirk and avoid refactoring the statement
printing API.

Signed-off-by: Phil Sutter <phil@nwl.cc>
src/xt.c