Netdev List
 help / color / mirror / Atom feed
From: Ido Schimmel <idosch@nvidia.com>
To: netdev-bot+sashiko@kernel.org
Cc: leonard@lausen.nl, netdev@vger.kernel.org, dsahern@kernel.org,
	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
Subject: Re: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup()
Date: Fri, 20 Nov 2026 17:35:35 +0200	[thread overview]
Message-ID: <20261120153535.GA2287760@shredder> (raw)
In-Reply-To: <179517305064.3136.1004033364873817896@kernel.org>

On Fri, Nov 20, 2026 at 11:10:50AM +0000, netdev-bot+sashiko@kernel.org wrote:
> [Severity: Medium]
> 
> Does the RTF_REJECT exemption also catch 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.
> 
> But rtm_to_fib6_config() sets RTF_REJECT for throw routes as well:
> 
>     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;
> 
> On the fib6_lookup() path, fib6_rule_action_alt() returns 0 for any
> matched entry other than 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 fib_rules_lookup() calls fib6_rule_suppress(). This branch returns
> false because RTF_REJECT is set, and the rule walk stops with an
> RTN_THROW result.
> 
> On the ip6_route_output() path, __fib6_rule_action() returns
> rt->dst.error, which comes from fib6_prop[RTN_THROW] = -EAGAIN. IPv4
> fib_table_lookup() returns fib_props[RTN_THROW].error = -EAGAIN. In both
> cases fib_rules_lookup() goes on to the next rule, so a throw route never
> ends the lookup there.
> 
> For example, take "throw default" in the main table with a "table main
> suppress_prefixlength 0" rule. ip6_route_output() would continue to the
> next rule, but fib6_lookup() stops at the throw route.
> 
> nft_fib6_eval_type() then reports RTN_THROW, and nft_fib6_eval() returns
> no oif:
> 
>     if (ret || res.fib6_flags & (RTF_REJECT | RTF_ANYCAST | RTF_LOCAL))
>             return;
> 
> That can lead to strict RPF drops. bpf_ipv6_fib_lookup() also returns
> BPF_FIB_LKUP_RET_NOT_FWDED even though a later rule would match.
> 
> The throw handling in fib6_rule_action_alt() predates this patch.
> However, before 1c32b24c234b the nft code used ip6_route_lookup() and
> nf_ip6_route(), which handled throw routes correctly. The reject-route
> checks described in the notes seem to cover only blackhole, unreachable
> and prohibit routes.
> 
> Could fib6_rule_action_alt() return -EAGAIN when res->fib6_type ==
> RTN_THROW? The RTF_REJECT exemption here would then cover only routes
> that really end the lookup.

Already addressed in:

https://lore.kernel.org/netdev/20261119165758.GA2050378@shredder/

It's a pre-existing issue and one that is unlikely to bother anyone,
unlike the issue being fixed by this patch.

  reply	other threads:[~2026-11-20 15:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 11:08 [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Leonard Lausen
2026-11-17 11:08 ` [PATCH net v4 1/2] " Leonard Lausen
2026-11-17 16:12   ` Ido Schimmel
2026-11-20 11:10   ` netdev-bot+sashiko
2026-11-20 15:35     ` Ido Schimmel [this message]
2026-11-17 11:08 ` [PATCH net v4 2/2] selftests: netfilter: cover IPv6 FIB prefix suppression Leonard Lausen
2026-11-20 11:10   ` netdev-bot+sashiko
2026-11-17 12:56 ` [PATCH net v4 0/2] ipv6: Honor suppress_prefixlength in fib6_lookup() Pablo Neira Ayuso
2026-11-17 13:01   ` Leonard Lausen
2026-11-17 13:07     ` Pablo Neira Ayuso
2026-11-17 15:24       ` Ido Schimmel
2026-11-17 16:30         ` Paolo Abeni

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=20261120153535.GA2287760@shredder \
    --to=idosch@nvidia.com \
    --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=kuba@kernel.org \
    --cc=leonard@lausen.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev-bot+sashiko@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