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

From: Ido Schimmel

Date: Tue Nov 17 2026 - 11:13:39 EST


On Tue, Nov 17, 2026 at 11:08:11AM +0000, Leonard Lausen wrote:
> 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.

Simply deriving the 'ifgroup' from the first nexthop device would be
consistent with IPv4 and it only matters if someone is not putting all
the nexthop devices of a route in the same 'ifgroup', which would be
weird. I suspect 'suppress_ifgroup' is hardly used.

Anyway, this can be deferred to net-next.

>
> 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@xxxxxxxxx>

Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>