Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] In include/net/net_namespace.h, this patch changes
rt_genid_bump_ipv6() from void to int.
--
ipv6: make rt_genid_bump_ipv6() a plain counter increment
This patch replaces the fib6_flush_trees() walk behind
rt_genid_bump_ipv6() with an increment of net->ipv6.fib6_sernum. The
increment wraps to 1 so the value is never 0. It also drops the
__fib6_flush_trees pointer and its export, fib6_new_sernum(), and the
sernum handling in fib6_cleaner.
> diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
> index 4a4d72080acdc..f39baf51bcc5d 100644
> --- a/include/net/net_namespace.h
> +++ b/include/net/net_namespace.h
> @@ -556,18 +556,30 @@ static inline int rt_genid_ipv6(const struct net *net)
> {
> return atomic_read(&net->ipv6.fib6_sernum);
> }
> -#endif
>
> -static inline void rt_genid_bump_ipv4(struct net *net)
> +/* Invalidate every cached IPv6 dst in @net. Returns the new generation,
> + * which is never 0.
> + */
> +static inline int rt_genid_bump_ipv6(struct net *net)
> {
> - atomic_inc(&net->ipv4.rt_genid);
> + int new, old = atomic_read(&net->ipv6.fib6_sernum);
> +
> + do {
> + new = old < INT_MAX ? old + 1 : 1;
> + } while (!atomic_try_cmpxchg(&net->ipv6.fib6_sernum, &old, new));
> +
> + return new;
> }
> +#else
> +static inline int rt_genid_bump_ipv6(struct net *net)
> +{
> + return 0;
> +}
> +#endif
[Severity: Low]
This isn't a bug, but the new comment on rt_genid_bump_ipv6() says the
return value is never 0. The !CONFIG_IPV6 stub added just below returns
exactly 0.
No current caller is affected. The callers that use the return value
are fib6_update_sernum(), fib6_update_sernum_upto_root() and fib6_add()
in net/ipv6/ip6_fib.c, which only builds with IPv6. Every other caller
ignores the result: rt_genid_bump_all(), xfrm_policy.c, nexthop.c,
addrconf.c and fib6_rules.c.
The later patch in the series, "ipv6: stamp dsts with the generation
sampled before the FIB lookup", adds rt_genid_ipv6_sample() but leaves
this comment and the stub unchanged.
Would it be clearer for the comment to say the non-zero guarantee holds
only with CONFIG_IPV6? Another option is to have the stub return a
non-zero value, so a future caller outside IPv6 can't rely on 0 meaning
something.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org