Article View: linux.kernel.netdev
Article #18980Re: [PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup()
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 06:03
Date: Thu, 19 Nov 2026 06:03
150 lines
13623 bytes
13623 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The new RTF_REJECT exemption in fib6_rule_suppress() and the
commit message's reason for it ("Do not suppress such routes so that…
- [Low] The commit message and Fixes: tag present this as a fix for the
nftables regression from commit 1c32b24c234b, but the code change has…
--
ipv6: Honor suppress_prefixlength in fib6_lookup()
This patch makes fib6_rule_suppress() honour suppress_prefixlength when
the lookup goes through fib6_lookup(). That path uses
fib6_rule_action_alt(), which never populates res->rt6. The new code
compares the FIB entry prefix length against suppress_prefixlen, and it
does not suppress results that carry RTF_REJECT.
Link: https://github.com/firewalld/firewalld/issues/1600
> Fixes: 1c32b24c234b ("netfilter: nft_fib_ipv6: switch to fib6_lookup")
[Severity: Low]
This isn't a code bug, but should the changelog and Fixes: tag cover the
other fib6_lookup() callers too?
The new branch in fib6_rule_suppress() runs for every fib6_lookup() call
while custom IPv6 rules exist, not only for nft_fib6_lookup(). At least
two other callers change behaviour.
The first is bpf_ipv6_fib_lookup() in net/core/filter.c. This is the
bpf_fib_lookup() helper without BPF_FIB_LOOKUP_DIRECT:
err = fib6_lookup(net, oif, &fl6, &res, strict);
The second is ip6_route_check_nh() in net/ipv6/route.c, which validates
the gateway when a route is added:
err = fib6_lookup(net, cfg->fc_ifindex, &fl6, &res, flags);
With a WireGuard-style "ip -6 rule add table main suppress_prefixlength 0",
bpf_fib_lookup() now returns the VPN table route. Before this patch it
returned the main table default route.
For the BPF helper, the missing suppression is older than 1c32b24c234b.
The custom rules path of fib6_lookup() came from 138118ec96cb (2018). It
was converted to fib6_result in effda4dd97e878 (2019).
fib6_rule_action_alt() has never set res->rt6, so the old suppress code
always returned false on this path.
The v3 notes say this message and Fixes tag were suggested in review.
Even so, stable backports that follow the 1c32b24c234b tag won't reach
older kernels where BPF users are affected.
Would it make sense to mention the BPF and route-add callers in the
changelog? Should there also be a Fixes: tag for the older commit?
> diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
> index 5e2a79a81bf35..2f43e4e48e0d0 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;
> + }
[Severity: Medium]
Is the RTF_REJECT exemption correct for RTN_THROW routes? The commit
message says:
Do not suppress such routes so that they continue to terminate the
lookup, as with ip6_route_output() and IPv4.
rtm_to_fib6_config() also sets RTF_REJECT on throw routes:
if (rtm->rtm_type == RTN_UNREACHABLE ||
rtm->rtm_type == RTN_BLACKHOLE ||
rtm->rtm_type == RTN_PROHIBIT ||
rtm->rtm_type == RTN_THROW)
cfg->fc_flags |= RTF_REJECT;
A throw route doesn't end the lookup in ip6_route_output(). This is what
__fib6_rule_action() does:
err = rt->dst.error;
if (err != -EAGAIN)
goto out;
fib6_prop[RTN_THROW] is -EAGAIN, so fib_rules_lookup() goes on to the
next rule. IPv4 does the same through fib_props[RTN_THROW].error.
In the fib6_lookup() path, fib6_rule_action_alt() only checks for
fib6_null_entry:
err = fib6_table_lookup(net, table, *oif, flp6, res, flags);
if (!err && res->f6i != net->ipv6.fib6_null_entry)
err = fib6_rule_saddr(net, rule, flags, flp6,
res->nh->fib_nh_dev);
else
err = -EAGAIN;
So a throw route gives err == 0. fib6_rule_suppress() then returns false
because of RTF_REJECT, and the rule walk stops with the throw route as
the result.
The callers then see:
__nft_fib6_eval_type() returns RTN_THROW
nft_fib6_eval() returns without setting an oif
bpf_ipv6_fib_lookup() returns BPF_FIB_LKUP_RET_NOT_FWDED
ip6_route_check_nh() returns -EHOSTUNREACH
In the same case, ip6_route_output() would use a later rule. An nft fib
rpfilter rule such as firewalld's "fib saddr . mark . iif oif missing
drop" can then drop legitimate packets.
The lookup already stopped at throw routes before this patch, because the
old suppress code always returned false here. For a throw route with
plen <= suppress_prefixlen, though, ip6_route_output() moves on to the
next rule. The new branch makes fib6_lookup() stop instead.
Would it be better for fib6_rule_action_alt() to return -EAGAIN when
res->fib6_type == RTN_THROW, as __fib6_rule_action() does?
Also, the selftest in "selftests: netfilter: cover IPv6 FIB prefix
suppression" covers blackhole, unreachable and prohibit, but not throw.
> +
> if (!rt)
> return false;
>
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116150132.9594-1-leonard%40lausen.nl
Technical Details
Message-ID:
<179506821413.3136.16876288075711504414@kernel.org>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366757-linux-kernel-netdev=dewy.ruReferences:
<20261116150132.9594-3-leonard@lausen.nl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-366757-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup() Date: Thu, 19 Nov 2026 06:03:34 +0000 Organization: Usenet Network Message-ID: <179506821413.3136.16876288075711504414@kernel.org> References: <20261116150132.9594-3-leonard@lausen.nl> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2802366"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:Y8PQKyK7AQ2NFWW+ci1ako6/rzI= sha256:z8jLVifsvEFL/MT8Fj6OGuNOKbHoIiEp+P9sIGrNvJE= sha1:rk9usNXajexewKxTseUtWjMfex8= sha256:x/lYq829uF+x/d3EDP8kv6BNYtuCKOPKvUV6x6CX7e8= 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 C15901154F4; Thu, 19 Nov 2026 09:04:04 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 (2048-bit key) header.d=kernel.org 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 EvUaLk57ZTBf; Thu, 19 Nov 2026 09:04:01 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-366757-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id AF5B8115505; Thu, 19 Nov 2026 09:03:52 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id F2BE216A416; Thu, 19 Nov 2026 06:03:41 +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=1795068221; b=0+eubZU0iVlnWrsYaFcQMGbBjLT/MwyQbnqHIVK8Lkr6kda1l+hA06SznK4j6f4cTYFs 6YB5qW9Tuc0EzLgzVpq0Gmdmh3Dyo52kUiqX09dlJ9w/wHC/6qx6Mgl4EK5F0BI9nxJqS fECFK4E/mmQ3EsUtajXor9rmR1lsAzA93gTQPhOIkPOETHY3paMLyezLSWuHeJA52gRVX 6S0xzTglCnpIOLweN3idxy0vZQvGxXAj5KGc3V4jYOccBiscxiuYHFlD3+TvdWgNUFxjR VJZthDP3Q07aek7Xkwudn2WANgSn2jLgItxfF++Qla9SBMaZtkRuCvUPSGQWWvA6m8g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795068221; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=U/cThibxsyF+VwaxQAJCQn1jL0f0MWqy045GOQuzyuM=; b=o8FE71rLUuSpzHkAZdp+HeOeBSiKuepLKNw0p4k3d+3rWj/eEtOLAML5jhauXhc4O7aN ni6hh5/kmZlv3G73/rbQDXoWUNXnfL1rMqIBjopsljOOFFxmJRrhPy9drV/LwY5rQtPVY PsLpX4AXOg6ucQmz0NkTGHbor4vijmyGy1mon6GdCycdDnWfe+UqOZ/R9UQC0NF0W6m6l rRYRgEonCfmHhhnapW2t+yAJTBh3hCWW/OTkzOG3c4BSRoAli6ZX/l/Inug+egR8mK2Yn ZgR1W5a1j34Eb481dkQ7/dYA5Qhxu7uaj9fLR0E9eY/UAiWwioBHDGFSyrsSOpzzcRA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ye9MJSlg; 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 C9269606A32A; Thu, 19 Nov 2026 06:03:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ye9MJSlg X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795068216; b=jeQzURXx4K5pJ6y3LD7PMmflBqR4PlYO5pWiEK7hLqkxntliCveq5M9u/Oc6AWTAfxry JPyN+VpVF6xFQliFgkxXrtAchL4cjE45MEuU08ZlIQvAZ3DkpxSwo0fVFp7+razQgdmM5 w4pAiZ/O6Xw2Ao2llZaNKbatbDEkAbAQj7Ssx+qbQIRKVFep+5tqhjfWDDQJNdU/0fh3g VkG5yoAvGrTjoxiZa+odQDEfzluFVpVaneR2Bqdz8jToQRahJAoyOnA96U+zo7cGDX259 /KSOS14QV5Bpp8FS4hbbSiTHZxKsz6xgguLTcOgKPNXZ3t/tTlzf/foFcZVNQIAd4Cg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795068216; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=U/cThibxsyF+VwaxQAJCQn1jL0f0MWqy045GOQuzyuM=; b=myUSTxLW/5DrGakvzl7dN8iUER/9Dj0gjbwgFbDYwbYZ3OTGt1Mjncqa/nGe62NCvYu1 ZEmWAW5L9tbs2wkO6IooErDL5Ghueb2lP8j8dyNK1PE+3+43HFmFIwQwr8QLKCTs+gCzr lG1VZk+iAI+r2hEDWSAbWdBuQgMvvCSeSiKxVqUHnxu224ujXx0eyv+sb5UQRedWHYonV RBn8BctMn4jOyyco8JNdb88M6sdniwMTqeZnf0xhnp9sNFM+3HC7c3zINgR5X5HmcvXn2 Pkw0L2LrHxAvrWukRrLstxvu2w1DjIxafc3wuuOxm0w6MGz+kuUPlBe3bhx2Rsqqwxg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ye9MJSlg; arc=none smtp.remote-ip=100.103.45.18 X-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 E36BC606A320; Thu, 19 Nov 2026 06:03:35 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E3DF1F000C5; Thu, 19 Nov 2026 06:03:34 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795068215; bh=U/cThibxsyF+VwaxQAJCQn1jL0f0MWqy045GOQuzyuM=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=Ye9MJSlgABhJiEBmlJP2nru0HDo196Dz68evEGBwiow5hO5P5+VznnJHisOB/hLW/ elH83ggvtFSuDrOSvTFLCkkSlAB2uHjAcYzLrIGCn5plW4tVe9vv8ZFCo2vHPRgYTV RWarEgV/ZCUWvy1t5agEnW+vlVFIJQpGei7OYd8jIooJPDyRkS6/T+9Bd1oCJ629zb Rtd/vLlW0GKf2MqL9fAyejdG+MZYX5vKTwFA1PTncjov2HxbA3cN6sxdZi3oE7HWiw XF4RZfa1g4vYwAiEYxQBolfA5128vgRpe3YkdDu/LLaY9iA7oQqI+Wi5GOf11fJxGL TxZMi5kPKT41g== X-Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, pablo@netfilter.org, fw@strlen.de, phil@nwl.cc, shuah@kernel.org, daniel@iogearbox.net, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org X-In-Reply-To: <20261116150132.9594-3-leonard@lausen.nl> X-sashiko-severity: Medium 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