Article View: linux.kernel.netdev
Article #17284[PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup()
From: Leonard Lausen
Date: Mon, 16 Nov 2026 15:01
Date: Mon, 16 Nov 2026 15:01
70 lines
12475 bytes
12475 bytes
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 <leonard@lausen.nl>
---
v3:
- Use the suggested message and Fixes tag for the nftables regression.
- Remove Assisted-by, keep the original initializer, update the comment.
- The cached-exception issue is fixed independently in patch 1.
v2: https://lore.kernel.org/netdev/20261115114434.10343-2-leonard@lausen.nl/
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 5e2a79a81bf3..2f43e4e48e0d 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -288,6 +288,12 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
struct fib6_info *from;
int plen;
+ 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.55.0
Technical Details
Message-ID:
<20261116150132.9594-3-leonard@lausen.nl>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364490-linux-kernel-netdev=dewy.ruReferences:
<20261116150132.9594-1-leonard@lausen.nl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364490-linux-kernel-netdev=dewy.ru From: leonard@lausen.nl (Leonard Lausen) Newsgroups: linux.kernel.netdev Subject: [PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup() Date: Mon, 16 Nov 2026 15:01:29 +0000 Organization: Usenet Network Message-ID: <20261116150132.9594-3-leonard@lausen.nl> References: <20261116150132.9594-1-leonard@lausen.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2092741"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:223kgsb4GxyaN7f6ezKZ07tNgOo= sha256:dngDVsuIpUwN9z1rpZ17PQ/51aS7nt9cEDqqwE40+io= sha1:zYY/bRb3CV19CKNhaDPVDL+XhDc= sha256:ewsIhiN5ZRB62byxq/jKizWVuWct7xPvKO1v7urs5t8= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id E2971114C81; Mon, 16 Nov 2026 18:02:37 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (4096-bit key) header.d=lausen.nl X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id I2u1fLKbV_bN; Mon, 16 Nov 2026 18:02:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364490-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lausen.nl X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 427EE114C9E; Mon, 16 Nov 2026 18:02:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 470AA2E1E2; Mon, 16 Nov 2026 15:02:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794841314; b=0nfcE+2wEPR9YKI9vWNzltBR0pdH+F2GhZ6hqy9I3/Hyw6fThYncCTL7vBH7enzFOehZ pV5IXiL9Jyly6A7F1HswdeKRlkPciolREQj12O8GDfc76JBgQ0q+qSbGoUZ5mNCuwJ2Xa dWoe+yJZyWnscSDGav7EJEJioSy5NC7hhP7p6UU952eea3xOH/3iOzd67OZ4kQd5SAYrM jkiXWZtU0/XwtKct8VFMG48IJrHQH9mvaihhkkNhM81hV/Q7Lrtae3hJVVTaBLBqG8Xmr UMa9v3vpMEUvKvTH/1V/DtlNY51SLbuFFDpMxOzeofgjhfKC1/wO3bA4BJQN4b8SvYg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794841314; h=X-Original-To:Received:DMARC-Filter:Received:Received:Received:From: To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Bar:X-Rspamd-Report:X-Rspamd-Score: DKIM-Signature; bh=Wo4nNIcoh0LXFWMtrIhyrynbD6vLJoBNHUpOAURFHxk=; b=GezyD8kWarA3i5vZWjV1PA761lDG59WAo2u7O5PGz96E2AUs+w+YrnRqSZ+fNChEzCp9 UGUfkp8PS9/xdmhV8s/7/w6mokY6pJFouQEGjiT18CzFhORRp5e3PGNBzgX0uPunTrcgO 6wO0akNIrEFXae3ZTg0oKLn6qlH1pnSILoBTo2zjI4t50RJTY2IhHXehghdqb4uxGrGuh hiqgmLASmUaNri9m4egWQg9kgnj3/J0b72Mf0xgyms/UuhdcGiQzJc63uyN7eZSL6jvPo 3HSkEuNiXQ9oFwSjvmnIJL1d7qSPDm2G1aMGjSt64ggtNI56LGtZRn6v96I/M0owjwg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lausen.nl header.i=@lausen.nl header.a=rsa-sha256 header.s=uberspace header.b=AyaU0cxX; dmarc=pass header.from=lausen.nl; spf=pass smtp.mailfrom=lausen.nl; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6911E606A8B6; Mon, 16 Nov 2026 15:01:54 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (4096-bit key) header.d=lausen.nl header.i=@lausen.nl header.a=rsa-sha256 header.s=uberspace header.b=AyaU0cxX X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.143.172.20 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794841313; b=o14wTd7KriyRqH1Hkmd81Kbp4t54/fG23wUdMt2yJI0U4XZ5CCPZ3KqHc9Pi+1zHbal0 st8N+TVcetvLUICYrZyzODYJC1BJkvWMJK1CImoqFn/LNNgBN50y3CBgE5CTCnI5bdVqD hsp8AvVNm4WfXDogkLDVo6MubftNM2bKSBGIhnegg57wUY7l5XreDoivyw16DaYpUXOHc I6zQfarHYrDrkP9+s7CcYcWriWlnDP3XwvSNegF1oH3F0vU+wxAC9oJ6pVgpMpwVe9AB6 jPTwNPwvyQv0vr89qIdslX7KR21dTJS8tJfRgotXAJspiBZaZsNKXorwb8L1D6V5pKg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794841313; h=DMARC-Filter:Received:Received:Received:From:To:Cc:Subject:Date: Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:X-Rspamd-Bar:X-Rspamd-Report:X-Rspamd-Score: DKIM-Signature; bh=Wo4nNIcoh0LXFWMtrIhyrynbD6vLJoBNHUpOAURFHxk=; b=PVGvWAHF7nxRGDhYHIdugt1MAvbTumR/Fiz8Vt2BTdBKOs30sL6DrZmLEGSfDKov5Q5Y nKx/+xEREl31YS8Z+uwzsUjNbKhOOejs4SgROb1oDZ7+/FEbcSFgeeBK3c+ACIwhlvA4u iLVN/VmmPpemTDuIBBTcsPEVlovuQ79pdm0+Bk9etPrufK47J42qLxdKOKw36zRXrcQgK x80O/s0yForvkA933Fp+CFslLQU1eA2elaAb6NSU03qexAw+A6bYIHHFHK1qWXgXI2ghn aqDhe4lOSrrkK3VDMVqHPhLOowNykoRF65jx6FD6XFilm0rSj3kx1uNjk0gddCA62zg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lausen.nl; spf=pass smtp.mailfrom=lausen.nl; dkim=pass header.d=lausen.nl header.i=@lausen.nl header.a=rsa-sha256 header.s=uberspace header.b=AyaU0cxX; arc=none smtp.remote-ip=95.143.172.20 X-Received: from mailgate01.uberspace.is (mailgate01.uberspace.is [95.143.172.20]) (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 19D88606A894 for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 15:01:52 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 19D88606A894 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lausen.nl X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lausen.nl X-Received: from devico.uberspace.de (devico.uberspace.de [185.26.156.185]) by mailgate01.uberspace.is (Postfix) with ESMTPS id 0E05C6115B for <netdev@vger.kernel.org>; Mon, 16 Nov 2026 16:01:45 +0100 (CET) X-Received: (qmail 22922 invoked by uid 990); 16 Nov 2026 15:01:44 -0000 X-Authentication-Results: devico.uberspace.de; auth=pass (plain) X-Received: from unknown (HELO unknown) (::1) by devico.uberspace.de (Haraka/3.1.1) with ESMTPSA; Mon, 16 Nov 2026 16:01:44 +0100 X-Cc: leonard@lausen.nl, David Ahern <dsahern@kernel.org>, Ido Schimmel <idosch@nvidia.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>, Pablo Neira Ayuso <pablo@netfilter.org>, Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>, Shuah Khan <shuah@kernel.org>, Daniel Borkmann <daniel@iogearbox.net>, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: git-send-email 2.55.0 X-In-Reply-To: <20261116150132.9594-1-leonard@lausen.nl> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-Rspamd-Bar: ----- X-Rspamd-Report: REPLY(-4) BAYES_HAM(-2.999968) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.599968 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lausen.nl; s=uberspace; h=from:to:cc:subject:date; bh=FdClypnVvZxUzIm2CqkbBUoQEUR5XIG05mWhickNlvY=; b=AyaU0cxXd6WpBcT1PB6zWYQe6hkqKxWn3HzBpNxgZz1md4X/h2Y8WNNtC9/pWgorclJngM/tue 4sBBq9JPlaeGfmMhjCnwjGbFJ4PEHUmnva4OlF08bvLfBYNlROyKFLt2p3UfQ68uIEKJl8mGaUx+ HaLtg7GMWOsu+xERGcphtiyaU8FEtnmt88kl25clK34ZQJPgjP214lGnHQaB8JmusgQDSM3JbnP6 kkP64FLaSwyzZKuXAYXZ12iEYVFt4AqwJPZSiCI79l662GhglOAsPoC5dDBMxQ9ST8TDR2ucDjyx fk7hlfbmCrZvzUwZnS+G9HZ+iupx4p8dL7iM0IJPiD2C8zdPXhFpieJkGqvmRoi/uldLEZqjCOGw 14UlaXFojx6NOrXyzz9E2iCTGZm1PKWlqg6qZbD0YMgDSXqcXTfatOof7vdlXDeHvZSN+10b1sIe +vLKTNoVRMdqtup/7Zk566qHh7CSR2ZjBMOLqVNrXr+BO73YhKnBxONPnLiHdfpFm4mwzs6cO4us vjFjOoWF58eFalKTwg0CmDAoSWG7Qv5CRcHgBIXn6K3dloz3L3ZLwxZW7sBa0OB4XfnJgvwckYO/ in6WkEaFvAFZBTLe3sRuFDTkN3hMEL34ySWC0DdjUJ+8pSGcvjeyIxkywyTNY+OAnz3aHGzY143R Y=