From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380459; b=QUTsHOnrdoitqzhx6MOhMNnYftdFKvZjNcWU3/0fIAX3sKArAR9+sS8Pn6uJhvdlS7Kp 7QhC/4j94Sttlb38Cg34eiTGEkNeihC7Q3lGkADdnQx2f053tLMr9JnLPsK4hy4VVF2nw /A54AdDAn7eRjOQx80kmU7Im7nURVnIG2Gz23flVYFJiX86AFfDU7Pft2xJ+GI/W5iq8W 2FjHVMgOrgGOr6TSfCXM5WqYfFrxa6O/EZiGgWR7cy+dQ1nIZA+fAVApi3O8xJh5B/Gzv Za5yxVyapwnHeuxvh+yDYfiFwhaJfVWUfZBFWOIsbY/6y86b1VQ5hxbwaxxKiY741OA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380459; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=EZAlPAiJa1sG0tHkQfG4q9P+64yJSip7hQ0k3uKs/Jw=; b=yuceOnonv/ChiiW9t+29uC0PbBXLWcvp7H05Q0GBotwFaY9XtV7PQNv2VCMBqCPmALnp qhD+Y1EGQTJgxxQJRig4+BUiT3+N/2lrTGmxguwDL6dsbn3wyyZ0M2s3J4sQXZazmKXy0 hq1MBD6GYl2BQ+6aze+H06vYyfaiWq2oH3RcI/92a+izin5Bt7svIbjDgLY5arf1nR/sF DlwCRMDmLZsLQKZGf32Hsc3VyZxcbhBEyu66mvJU3RXqSH53QaCXAV5B2tPLJRj+LRXaG NZKwLjpMUKTwJ9I9XwYJ1Wv6bALYnqPrqAPk/VWa36JGib358sJ9XwHqhXms5epwVSQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YQzZgRvN; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E4303606A699; Fri, 4 Dec 2026 10:34:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=YQzZgRvN Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58D261F00936; Fri, 4 Dec 2026 10:34:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380458; bh=EZAlPAiJa1sG0tHkQfG4q9P+64yJSip7hQ0k3uKs/Jw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=YQzZgRvNWS+ZzHTRVft0NPb0LDiXAtdOVWyY3j5QJgzFb/FTDO3s+Eex7Qki/Z/Ct pE8lG8OAeDERH3ugdry8IeffCBU2wl/6ERAaFy9lBH4FOtGBKg+xtFxXiXyT1BDysX FT0k+RDbmHTKaZWHZUvz+7NFqvrcYuHHTmkt0P4E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Leonard Lausen , Ido Schimmel , Paolo Abeni , Sasha Levin Subject: [PATCH 7.3 265/742] ipv6: Honor suppress_prefixlength in fib6_lookup() Date: Fri, 4 Dec 2026 19:02:09 +0900 Message-ID: <20261204100642.101312745@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Leonard Lausen [ Upstream commit 94df5595e31bf4502fe5195748ca55164ac763f0 ] When custom FIB rules are configured, fib6_lookup() performs the lookup via fib6_rule_action_alt() which calls fib6_table_lookup() and only populates the f6i, nh, fib6_flags and fib6_type fields of the FIB result. However, fib6_rule_suppress() only examines the rt6 field, which is only populated when the lookup is performed via one of the callers of fib6_rule_lookup() such as ip6_route_output(). As a result, fib6_lookup() ignores suppress_prefixlength. This was not a problem for nftables until commit 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup") switched the FIB expression from ip6_route_lookup() / nf_ip6_route() to fib6_lookup(). Since then, with a rule that suppresses the default route in the main table before looking up a VPN table (as commonly configured for WireGuard), the FIB expression returns the suppressed default route instead of the VPN route. Strict reverse path filtering then drops replies received over the VPN. Fix by evaluating suppress_prefixlength against the prefix length of the FIB entry when the lookup is performed via fib6_lookup(). fib_rules_lookup() only invokes the suppress callback when the rule action returns 0. Unlike __fib6_rule_action(), fib6_rule_action_alt() returns 0 for reject routes and instead sets RTF_REJECT in the result. Do not suppress such routes so that they continue to terminate the lookup, as with ip6_route_output() and IPv4. Check the flags in the result rather than in the FIB entry so that blackhole nexthop objects are also covered. suppress_ifgroup is not handled since fib6_table_lookup() does not perform multipath selection and the nexthop it returns might not be the one that is eventually used. Observed during WireGuard use and reproduced on unmodified v7.4-rc2, without instrumentation or error injection. Verified with namespace probes and nft_fib.sh on the rebuilt v7.4-rc2-based kernel. Fixes: 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup") Link: https://github.com/firewalld/firewalld/issues/1600 Signed-off-by: Leonard Lausen Reviewed-by: Ido Schimmel Link: https://patch.msgid.link/20261117110813.9894-3-leonard@lausen.nl Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv6/fib6_rules.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c index 0ffd7b47a0460..7efb0515b5c8b 100644 --- a/net/ipv6/fib6_rules.c +++ b/net/ipv6/fib6_rules.c @@ -286,6 +286,12 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule, struct rt6_info *rt = res->rt6; struct net_device *dev = NULL; + if (arg->lookup_ptr == fib6_table_lookup) { + /* fib6_table_lookup() returns 0 for reject routes. */ + return !(res->fib6_flags & RTF_REJECT) && + res->f6i->fib6_dst.plen <= rule->suppress_prefixlen; + } + if (!rt) return false; -- 2.53.0