From: Florian Westphal Date: Tue, 25 Nov 2025 13:03:33 +0000 (+0100) Subject: tests: shell: bad_rule_graphs: add chain linked from different hooks X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d181bb815117b6a9f42d965db15227135866830f;p=thirdparty%2Fnftables.git tests: shell: bad_rule_graphs: add chain linked from different hooks On a kernel with broken (never upstreamed) patch this fails with: Accepted bad ruleset with jump from filter type to masquerade (3) and Accepted bad ruleset with jump from prerouting to masquerade ... because bogus optimisation suppresses re-validation of 'n2', even though it becomes reachable from an invalid base chain (filter, but n2 has nat-only masquerade expression). Another broken corner-case is validation of the different hook types: When it becomes reachable from nat:prerouting in addition to the allowed nat:postrouting the validation step must fail. Improve test coverage to ensure future optimisations catch this. Signed-off-by: Florian Westphal --- diff --git a/tests/shell/testcases/transactions/bad_rule_graphs b/tests/shell/testcases/transactions/bad_rule_graphs index 53047c3c..1f36bad8 100755 --- a/tests/shell/testcases/transactions/bad_rule_graphs +++ b/tests/shell/testcases/transactions/bad_rule_graphs @@ -259,4 +259,72 @@ $NFT "add rule t c9 tcp dport 80 tproxy to :20000 meta mark set 1 accept" good_ruleset $? "add tproxy expression to c9" check_bad_expr +$NFT -f - <