Re: [PATCH net v4 1/2] ipv6: Honor suppress_prefixlength in fib6_lookup()

From: Ido Schimmel

Date: Fri Nov 20 2026 - 10:36:09 EST


On Fri, Nov 20, 2026 at 11:10:50AM +0000, netdev-bot+sashiko@xxxxxxxxxx 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.