Netdev List
 help / color / mirror / Atom feed
From: Ralf Lici <ralf@mandelbit.com>
To: David Ahern <dsahern@kernel.org>
Cc: netdev@vger.kernel.org, David Ahern <dahern@nvidia.com>
Subject: Re: [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup
Date: Tue, 24 Nov 2026 17:35:52 +0100	[thread overview]
Message-ID: <20261124163553.783988-1-ralf@mandelbit.com> (raw)
In-Reply-To: <20261123212623.106153-1-dsahern@kernel.org>

Hi David,

On Mon, 23 Nov 2026 14:26:02 -0700, David Ahern <dsahern@kernel.org> wrote:
> Known trade-off: any FIB change in a netns now invalidates every cached
> IPv6 dst in it, not just those under the affected node; stale dsts are
> rebuilt lazily on their next use.
[...]
> Ralf: Patch 7 is alternative to your patch that adds the cookie to the
> APIs. Instead the result struct contains the genid before the lookup is
> done. Adding it to the fib6_result seems simpler and accomplishes the
> end goal everywhere.
>

Carrying the sample in fib6_result avoids growing the API, but
validating against the netns generation also changes what a FIB change
invalidates: every route added or removed anywhere in the netns
invalidates every cached IPv6 dst in it. I considered this before the
RFC and discarded it as a potential regression against the current
model, since the IPv6 FIB was designed to limit invalidations to the
affected nodes, as 8f34e53b60b3 ("ipv6: Use global sernum for dst
validation with nexthop objects") puts it:

  With the per-node counter only dst_entries based on fib entries under
  the node are invalidated when changes are made to the routes -
  limiting the scope of invalidations.

On v1 you wrote [1]:

> That said, I have very limited time to work on a proposal. If this set
> cannot converge on an acceptable solution in a few days, then I will
> have to move on.

I hope v5 [2] (that I just sent) is the convergence we were both looking
for. It follows your direction, with validity in the dst, the sample
carried in fib6_result and every holder covered without changes, but
stamps the dst with the fn_sernum of the route's node, sampled during
the lookup, and keeps the netns generation only for nexthop-object dsts,
as today.

It also avoids three problems I found in v2: a lookup can reuse a pcpu
or exception dst that another lookup rebuilt after the route it selected
changed, a stale exception is treated as a miss (so any FIB change in
the netns stops learned PMTUs and redirects from being used), and
fib6_ifup and fib6_ifdown still advance the generation before
rt6_multipath_rebalance (which 2/4 of [2] fixes).

But moving validity into the dst also raises lifetime questions that any
version of this approach has to answer: pcpu dsts replaced while still
held, including as children of xfrm bundles, and exceptions, which can
neither be re-stamped nor be kept valid as they are. v5 covers the
validation of pcpu dsts, still releases replaced ones with dst_dev_put
and leaves exceptions on the holder's cookie for now. I'd welcome your
input on how to take the rest further.

[1] https://lore.kernel.org/netdev/2354d63e-1ba5-4655-8cea-2918fa0ee51f@kernel.org/
[2] https://lore.kernel.org/netdev/cover.1795537128.git.ralf@mandelbit.com/

Thanks.

-- 
Ralf Lici
Mandelbit Srl

      parent reply	other threads:[~2026-11-24 16:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 21:26 [RFC net-next v2 0/7] ipv6: validate dsts against the netns route generation at lookup David Ahern
2026-11-23 21:26 ` [RFC net-next v2 1/7] ipv6: validate dsts against the netns route generation David Ahern
2026-11-23 21:26 ` [RFC net-next v2 2/7] ipv6: invalidate the failing dst in ip6_link_failure() David Ahern
2026-11-23 21:26 ` [RFC net-next v2 3/7] nexthop: factor out nh_has_f6i() David Ahern
2026-11-23 21:26 ` [RFC net-next v2 4/7] nexthop: bump the IPv6 route generation on group changes David Ahern
2026-11-23 21:26 ` [RFC net-next v2 5/7] ipv6: scope exception invalidation to the affected nexthop David Ahern
2026-11-23 21:26 ` [RFC net-next v2 6/7] ipv6: make rt_genid_bump_ipv6() a plain counter increment David Ahern
2026-11-23 21:26 ` [RFC net-next v2 7/7] ipv6: stamp dsts with the generation sampled before the FIB lookup David Ahern
2026-11-24 16:35 ` Ralf Lici [this message]

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=20261124163553.783988-1-ralf@mandelbit.com \
    --to=ralf@mandelbit.com \
    --cc=dahern@nvidia.com \
    --cc=dsahern@kernel.org \
    --cc=netdev@vger.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