Netdev List
 help / color / mirror / Atom feed
From: Leonard Lausen <leonard@lausen.nl>
To: netdev@vger.kernel.org
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
Subject: [PATCH net v3 1/3] ipv6: Use the FIB prefix length when suppressing cached routes
Date: Mon, 16 Nov 2026 15:01:28 +0000	[thread overview]
Message-ID: <20261116150132.9594-2-leonard@lausen.nl> (raw)
In-Reply-To: <20261116150132.9594-1-leonard@lausen.nl>

fib6_rule_suppress() compares suppress_prefixlen with rt6i_dst.plen.
PMTU and redirect exceptions have a /128 destination prefix even when
their parent FIB route is a default route. Consequently, a cached
exception bypasses suppress_prefixlength 0 and stops the rule lookup
instead of continuing to a later table.

Use the parent FIB entry's destination prefix length when available.
The rule lookup already holds the RCU read lock needed to read rt->from.
Retain the existing prefix check if the destination has lost its parent.
Interface-group checks and destination reference handling are unchanged.

Reproduced with a PMTU exception created by an ICMPv6 Packet Too Big,
without kernel instrumentation. Verified with the namespace reproducer
and nft_fib.sh on the rebuilt v7.4-rc2-based kernel.

Fixes: 7764a45a8f1f ("fib_rules: add .suppress operation")
Signed-off-by: Leonard Lausen <leonard@lausen.nl>
---
v3:
- New separate fix for the cached-exception issue identified in review.
- Reproduced with ICMPv6 Packet Too Big and verified on the rebuilt
  kernel with the reproducer and all seven nft_fib.sh cases.

v2: https://lore.kernel.org/netdev/20261115114434.10343-2-leonard@lausen.nl/

 net/ipv6/fib6_rules.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/fib6_rules.c b/net/ipv6/fib6_rules.c
index 0ffd7b47a046..5e2a79a81bf3 100644
--- a/net/ipv6/fib6_rules.c
+++ b/net/ipv6/fib6_rules.c
@@ -285,6 +285,8 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
 	struct fib6_result *res = arg->result;
 	struct rt6_info *rt = res->rt6;
 	struct net_device *dev = NULL;
+	struct fib6_info *from;
+	int plen;
 
 	if (!rt)
 		return false;
@@ -292,10 +294,13 @@ INDIRECT_CALLABLE_SCOPE bool fib6_rule_suppress(struct fib_rule *rule,
 	if (rt->rt6i_idev)
 		dev = rt->rt6i_idev->dev;
 
+	from = rcu_dereference(rt->from);
+	plen = from ? from->fib6_dst.plen : rt->rt6i_dst.plen;
+
 	/* do not accept result if the route does
 	 * not meet the required prefix length
 	 */
-	if (rt->rt6i_dst.plen <= rule->suppress_prefixlen)
+	if (plen <= rule->suppress_prefixlen)
 		goto suppress_route;
 
 	/* do not accept result if the route uses a device
-- 
2.55.0


  reply	other threads:[~2026-11-16 15:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 15:01 [PATCH net v3 0/3] ipv6: Honor prefix suppression for FIB lookups and cached routes Leonard Lausen
2026-11-16 15:01 ` Leonard Lausen [this message]
2026-11-16 15:01 ` [PATCH net v3 2/3] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen
2026-11-16 15:01 ` [PATCH net v3 3/3] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen
2026-11-17  9:13 ` [PATCH net v3 0/3] ipv6: Honor prefix suppression for FIB lookups and cached routes Ido Schimmel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261116150132.9594-2-leonard@lausen.nl \
    --to=leonard@lausen.nl \
    --cc=coreteam@netfilter.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=fw@strlen.de \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox