Received: from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc [91.216.245.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E86930E83D for ; Tue, 25 Nov 2025 13:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.216.245.30 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764075841; cv=none; b=PsqXydrseZhcKIHP8Ad5rYfYD2PeZa/SynKX4iTeiRw2ZJzcU5jX/oDRi46n28cjiWMJjtHYn5kp1AoE44ZCAdrvD5ScpbD1o/WIMOuu5ige9g1/X7N+OOSotzjATXz13pWBn0EU7kb+AYWpHOXGB4Q+UvBhCX9idA0hSW21LWA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764075841; c=relaxed/simple; bh=ipS22481l4G1jcBaZj2Jg/i3RfM/u7AAI/YIszhut7Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=afILIGx+Qw5kM0gwqR5U2u5wP9eL9FcUrBf6EmNgyCDVIdHxnwNJpgpxahUQCWtZxspYmLMp9+eiws2NKXo6yMZzd70g7AtGa3PkqvzgKlxMZ8pVqf6D3IOsza9sLmUP87w0a1h3T8FaRYdicxV+apEWRPuqfQHtop9ieJeGVZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc; arc=none smtp.client-ip=91.216.245.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=strlen.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc Received: by Chamillionaire.breakpoint.cc (Postfix, from userid 1003) id 54D5A60466; Tue, 25 Nov 2025 14:03:51 +0100 (CET) From: Florian Westphal To: Cc: Florian Westphal Subject: [PATCH nft] tests: shell: bad_rule_graphs: add chain linked from different hooks Date: Tue, 25 Nov 2025 14:03:33 +0100 Message-ID: <20251125130338.6858-1-fw@strlen.de> X-Mailer: git-send-email 2.51.2 Precedence: bulk X-Mailing-List: netfilter-devel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- .../testcases/transactions/bad_rule_graphs | 68 +++++++++++++ .../dumps/bad_rule_graphs.json-nft | 98 +++++++++++++++++-- .../transactions/dumps/bad_rule_graphs.nft | 17 +++- 3 files changed, 173 insertions(+), 10 deletions(-) diff --git a/tests/shell/testcases/transactions/bad_rule_graphs b/tests/shell/testcases/transactions/bad_rule_graphs index 53047c3c229f..1f36bad80792 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 - <