Article View: linux.kernel.netdev
Article #17807[PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup()
From: Leonard Lausen
Date: Tue, 17 Nov 2026 11:08
Date: Tue, 17 Nov 2026 11:08
74 lines
12646 bytes
12646 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>
---
v4:
- Drop the preceding cached-exception fix; dst-based suppression remains
unchanged. The fib6_lookup() change itself is unchanged from v3.
Verified on the rebuilt v4 laptop kernel (7.4.0-rc2+ #6): all six added
checks pass in full normal and eight-second-delayed nft_fib.sh runs.
Both runs exit 0; twelve separate reject-route controls also pass.
V3 review:
https://lore.kernel.org/netdev/20261117091340.GA581197@shredder/T/#t
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 0ffd7b47a046..7efb0515b5c8 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.55.0
Technical Details
Message-ID:
<20261117110813.9894-3-leonard@lausen.nl>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365188-linux-kernel-netdev=dewy.ruReferences:
<20261117110813.9894-2-leonard@lausen.nl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-365188-linux-kernel-netdev=dewy.ru From: leonard@lausen.nl (Leonard Lausen) Newsgroups: linux.kernel.netdev Subject: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Date: Tue, 17 Nov 2026 11:08:11 +0000 Organization: Usenet Network Message-ID: <20261117110813.9894-3-leonard@lausen.nl> References: <20261117110813.9894-2-leonard@lausen.nl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2311210"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:C92NIdr7FcHsDtlC51w7IyvxQTg= sha256:TzKj/mwcZgo9cCzP6DgyAPaoW0bvxYR50YZEsbtyg54= sha1:4KkfuhXAtyAAH1SvcTc0pQ3ZMjI= sha256:AJqiw/SH8CNsCsxArnlPLCudPZ6Z8Whsf4+pbOBYYZg= 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 B3DAC114F15; Tue, 17 Nov 2026 14:08:51 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.15 X-Spam-Status: No, score=-3.15 tagged_above=-9999 required=6.31 tests=[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 i11eelWq0U4S; Tue, 17 Nov 2026 14:08:45 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-365188-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id 8E4EE114F16; Tue, 17 Nov 2026 14:08:37 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id AE72C6023E4; Tue, 17 Nov 2026 11:08:36 +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=1794913712; b=JsIQ1D2ODibCHsOCw9iuv0Yuad3LP/SaIfTXyCi5h6NX/fjA1nrCvzPblixyTNDNdn6p 5ySL5TAEjY0qN3Tb2pj8uxb0ryLQ3476r373a3iOWr3bYYhhPwf4VR/aHVSCudN4cu3pZ iGigqsw9gNwSfELZqEz2Q1RGeyGetf4zLTLmJl3pzDx+B1esl+WtRPPoo1Z7mDyv9jhZO yfKCzOuVSnBuH4D74+zOxqz7Mg8nWA5kz9XEmiwA3OYEgzWbxLieBoSDXlrvgy7iC0KcN FvXkJ3sWmOwD/IGju59uFN22BGOLdVnkYU3rXveuclXz2/og+3dGTFAqc6eSI11lTTA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794913712; 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=g2FT5J33g2gQI9Jq9qpJtj8sknYwea8FHdJe1wI2CJU=; b=B5Ly/DLr+t986ZYsUQovqV40d5qN1vh5pSrFC90G4AhKRMrZSO0KKoqfNi4ZcLQEYX8m TFvx1j9bJ1RStiRdF1+4KrZwiiuuxx7toIVRHx5TSTuJAF87A18pmMkPrAwZ95jNso/vD KztPByihsU8TFUSjUxCDRxPJ7yqZroqCw5e1mh8fAeWhYgNS/OjqbZCCKAhBUvJT78JzT izsaenEmfqvxtr7YKwn0g5eigkgc8Z8SyqDcgFMJ+3eJNMzfMwTcUYuPebfA7IopMvOun eDVUUxrL5ycYNaATBJpOGJrEXR40e1/X/XHnSGN2+VBjWZdyFuDTDONIoqocufbTMoQ== 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=lMgTZtdh; 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 8B32C606A8B1; Tue, 17 Nov 2026 11:08:32 +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=lMgTZtdh 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=1794913711; b=gYhaizF/aMgOv5NB0ppDkNaKJD4yGHwF2dCoeLaA6/+kA5oCqD5K3iCSI4i/afoUZdqp IwEO1Rmk4tRlDQJqOhFE4ooogxEldV3rUSSc0YUTH7NoSwBwrmLJdlzsNUVYP3l2SVywb 8saary2UPUecqM8TCBveRRobFWpk7gzu+mxZOK/DzJX+q3Y6Dm7pZ9RENUnuC2WXLApwI nsuPlrTKHQVJ9OlVkLurVpYBW//+kQilB12xEW6xTkRAHiuw90dGxorGKzExc7eZ15hpw pf4QCQmp8WYe1oBmfetIWnO27AIUIvEg+zkJKqB5eNxlGusYurZUFgs2yjikHA6tIig== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794913711; 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=g2FT5J33g2gQI9Jq9qpJtj8sknYwea8FHdJe1wI2CJU=; b=zPOI6pHXkXXk5y/SkWD1dPnk+sZG+5wY7XjD+drtKb1GXg/FWZkfvY6+McLUg37c4Ym7 cemhUSMySndc+hGyfGqnn+YQF3F7KAHP8XQV53JcdPKxugxAhZM7ogOPYEAG/Vtd5n1++ eVz45TTL8kQcjrq6/NQrFWqSjfBWFqHUwfUn4I6x4MYU3SRlu35qLTFVE0HphlCMAqDR3 G+nS/eKRZV2cGC1eLlaNUqYvOuRxyDfCtkrVlPpRa7G+r2Y/DLU7pjdRe9sGEBmUw7XDd g44c/rYXaBPl2neaXEp2Y2JDVgoAkXEX2ybQV6ZHwxI6qtLRfP7Xub+WRV7Hq83OfdQ== 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=lMgTZtdh; 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 3DFD5606A896 for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 11:08:31 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3DFD5606A896 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 60E7861038 for <netdev@vger.kernel.org>; Tue, 17 Nov 2026 12:08:28 +0100 (CET) X-Received: (qmail 22445 invoked by uid 990); 17 Nov 2026 11:08:28 -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; Tue, 17 Nov 2026 12:08:28 +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: <20261117110813.9894-2-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.999675) MID_CONTAINS_FROM(1) MIME_GOOD(-0.1) R_MISSING_CHARSET(0.5) X-Rspamd-Score: -5.599675 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lausen.nl; s=uberspace; h=from:to:cc:subject:date; bh=5AkPUOak53iMkPFFarJNAx9WrRA2KUnE60tZ659yQ/s=; b=lMgTZtdhISgEYNaXOqq81BCFsGYJnza6tVmV7S6SlGhwGhuA24uYv5K0oN1Oipn+s1ObsRva0h Y2L42VAsZnhPwczzjtORlEhEGbaILc+9kp++zba9CqheNdHXf9S8wWI8Gn+So/O7bEPNtjmh7Dcm Xv6cT7jFh+FCv4A3pIJgg6nm+11cAWFbPdM8/Dk5XaYhsz7xe3ltXfhDu7EZZGdasRmjfxEtS7O3 1BAjS2ugWY00DOZj5SX7c+cA+OiiV2C2wX3OwUT1FV1268aHRJSPbnzkFaTLIuiceCxi8f11XY3o DAWY2yH4GqS7W5O7Az1CoqbTgj+tEY15pFmp1DMGoyMyTAuAeuwooPRZ7GiDhMK+uv29CYncpwB0 ILl/lSZlZFWgifGsMb7QRO/KHNR54PQdsh3Dygnd+DhL7LDU/nxGlNWE6KxAhCmHlru9Agw0Udwy ++guyuXlxM4zyb/3taBROFe1B+1ROsesTYS5x57cLk3VymXLdowS13ASfDSGX9QOKZLUQ8VE6vTv Vj/de5tTQ1E64XnDnwkYpjul1uBauVmIXQhA/MUz4LaRBYAic4QAUYA46bPpe0GcxcDgf/LZmVHy QPupFhLCWjAbsvd7b74AmDM/WRDTpd8TksT82y5pqUf7lAhNvL4VNsk2qZXvkuAPC5k5W6iHDOPv g=