xt: Fix fallback printing for extensions matching keywords
Phil Sutter
reviewerPATCH 1/1 xt: Fix fallback printing for extensions matching keywords
Yet another Bison workaround: Instead of the fancy error message, an incomprehensible syntax error is emitted:
| # iptables-nft -A FORWARD -p tcp -m osf --genre linux | # nft list ruleset | nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:29-31: Error: syntax error, unexpected osf, expecting string | meta l4proto tcp xt match osf counter packets 0 bytes 0 | ^^^
Avoid this by quoting the extension name when printing:
| # nft list ruleset | sudo ./src/nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:20-33: Error: unsupported xtables compat expression, use iptables-nft with this ruleset | meta l4proto tcp xt match "osf" counter packets 0 bytes 0 | ^^^^^^^^^^^^^^
Fixes 79195a8cc9e9d ("xt: Rewrite unsupported compat expression dumping")
Fixes e41c53ca5b043 ("xt: Fall back to generic printing from translation")
Signed-off-by Phil Sutter <[email protected]>
--- src/parser_bison.y | 2 +- src/xt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
src/parser_bison.y +1 -1
@@ -2992,7 +2992,7 @@ stmt : verdict_stmt | xt_stmt close_scope_xt ; -xt_stmt : XT STRING STRING +xt_stmt : XT STRING string { $$ = NULL; xfree($2);
src/xt.c +1 -1
@@ -116,7 +116,7 @@ void xt_stmt_xlate(const struct stmt *stmt, struct output_ctx *octx)xfree (entry);#endif if (!rc) -nft_print (octx,"xt %s %s" , +nft_print (octx,"xt %s \"%s\"" , typename[stmt->xt.type], stmt->xt.name); }
Signature · 1 line
2.38.0
Pablo Neira Ayuso
maintainerQuoted 10 lines · Phil Sutter
Yet another Bison workaround: Instead of the fancy error message, an incomprehensible syntax error is emitted:
| # iptables-nft -A FORWARD -p tcp -m osf --genre linux | # nft list ruleset | nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:29-31: Error: syntax error, unexpected osf, expecting string | meta l4proto tcp xt match osf counter packets 0 bytes 0 | ^^^
Quoted 7 lines
Avoid this by quoting the extension name when printing:
| # nft list ruleset | sudo ./src/nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:20-33: Error: unsupported xtables compat expression, use iptables-nft with this ruleset | meta l4proto tcp xt match "osf" counter packets 0 bytes 0 | ^^^^^^^^^^^^^^
LGTM.
Phil Sutter
reviewerQuoted 18 lines · Phil Sutter
Yet another Bison workaround: Instead of the fancy error message, an incomprehensible syntax error is emitted:
| # iptables-nft -A FORWARD -p tcp -m osf --genre linux | # nft list ruleset | nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:29-31: Error: syntax error, unexpected osf, expecting string | meta l4proto tcp xt match osf counter packets 0 bytes 0 | ^^^Avoid this by quoting the extension name when printing:
| # nft list ruleset | sudo ./src/nft -f - | # Warning: table ip filter is managed by iptables-nft, do not touch! | /dev/stdin:4:20-33: Error: unsupported xtables compat expression, use iptables-nft with this ruleset | meta l4proto tcp xt match "osf" counter packets 0 bytes 0 | ^^^^^^^^^^^^^^
Quoted 3 lines
Fixes 79195a8cc9e9d ("xt: Rewrite unsupported compat expression dumping")Fixes e41c53ca5b043 ("xt: Fall back to generic printing from translation")Signed-off-by Phil Sutter <[email protected]>
Patch applied.