Re: [PATCH net v2] ipv4: route: don't blackhole in-use routes when retiring fnhe routes
From: Ido Schimmel
Date: Mon Nov 09 2026 - 08:07:31 EST
On Thu, Nov 05, 2026 at 02:26:40PM -0400, Chase Hiltz wrote:
> When a route cached in a nexthop exception (fnhe) is replaced or
> flushed, rt_bind_exception() and fnhe_flush_routes() call
> dst_dev_put() on it. That sets dst->dev to blackhole_netdev and
> dst->input/output to dst_discard*(), but other CPUs can still be
> using the route, e.g. as a noref dst taken from the fnhe under RCU.
> Packets that reach dst_input() or dst_output() after that are dropped.
>
> If dst_dev_put() runs after a forwarded packet has entered ip_output(),
> ip_skb_dst_mtu() in __ip_finish_output() can return the MTU of
> blackhole_netdev (68), and ip_fragment() can then drop a DF packet and
> send ICMP_FRAG_NEEDED with mtu 68 to its source.
>
> Commit 5018c59607a5 ("ipv4: fix race condition between route lookup and
> invalidation") fixed the same race in rt_cache_route() by putting the
> old route on the uncached list instead of calling dst_dev_put(). Do the
> same for routes retired from an fnhe. rt_flush_dev() still moves them
> to blackhole_netdev when their device is unregistered.
>
> fnhe routes are also retired on fnhe expiry (ip_del_fnhe()) and
> eviction (fnhe_remove_oldest()). Those paths don't bump rt_genid, so
> without the obsolete marking ipv4_dst_check() could still accept the
> route. Keep marking retired routes DST_OBSOLETE_DEAD, as dst_dev_put()
> did, so that users that cached them, such as sockets, look up again.
>
> In a netns reproducer that forwards IPv4 traffic over an ip6tnl device,
> with an fnhe for the destination, while the FIB keeps changing, this
> patch stops the mtu 68 ICMPs and the drops.
>
> Fixes: 95c47f9cf5e0 ("ipv4: call dst_dev_put() properly")
> Reviewed-by: Eric Dumazet <edumazet@xxxxxxxxxx>
> Assisted-by: Claude Opus 5.5 <noreply@xxxxxxxxxxxxx>
The tag is deprecated since commit 1e035297ffda ("docs: remove
Assisted-by references"). Jakub / Paolo will probably strip it when
applying, so no need for v3 just for that.
> Signed-off-by: Chase Hiltz <me@xxxxxxxxxxx>
Reviewed-by: Ido Schimmel <idosch@xxxxxxxxxx>