Netdev List
 help / color / mirror / Atom feed
* [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown
@ 2026-11-26  8:13 Ralf Lici
  2026-11-26  8:18 ` netdev-bot+sinfo
  2026-11-26 15:40 ` David Ahern
  0 siblings, 2 replies; 4+ messages in thread
From: Ralf Lici @ 2026-11-26  8:13 UTC (permalink / raw)
  To: netdev
  Cc: Ralf Lici, David Ahern, Ido Schimmel, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Willem de Bruijn,
	Simon Horman, Sagarika Sharma, Kuniyuki Iwashima, Xia Yan,
	linux-kernel

fib6_ifup and fib6_ifdown update the node serial before calling
rt6_multipath_rebalance. A lookup that runs between the two can select a
nexthop using the old ECMP upper bounds and read the new serial as its
cookie. The cached dst then passes dst_check although it was selected
from the old state, until the next relevant change.

Update the serial after rt6_multipath_rebalance, so that it is published
only after the routing state it describes. fib6_new_sernum allocates the
serial with a fully ordered atomic_try_cmpxchg, which orders the
rebalance before the serial update. The invalidation scope is unchanged:
fib6_ifup still updates the node and its ancestors, fib6_ifdown only the
node.

Validating dsts against the generation sampled before the lookup, as
proposed in "ipv6: validate cached dsts against the netns route
generation", relies on this order as well: a lookup that reads the new
generation must also observe the routing change it describes.

Reported by Sashiko while reviewing an earlier version of this change.

Fixes: d7dedee184e7 ("ipv6: Calculate hash thresholds for IPv6 nexthops")
Fixes: 4bc852006b62 ("ipv6: update route serial number on NETDEV_CHANGE")
Link: https://lore.kernel.org/netdev/cover.1795642432.git.dahern@nvidia.com/
Signed-off-by: Ralf Lici <ralf@mandelbit.com>
Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
---
Split out of v5 of "ipv6: tie dst validation to the lookup that
returned the dst", which is withdrawn in favour of the series in the
Link above:
https://lore.kernel.org/netdev/cover.1795537128.git.ralf@mandelbit.com/

 net/ipv6/route.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1b2dcc066e19..194432f1fd66 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -4911,8 +4911,8 @@ static int fib6_ifup(struct fib6_info *rt, void *p_arg)
 	if (rt != net->ipv6.fib6_null_entry && !rt->nh &&
 	    rt->fib6_nh->fib_nh_dev == arg->dev) {
 		rt->fib6_nh->fib_nh_flags &= ~arg->nh_flags;
-		fib6_update_sernum_upto_root(net, rt);
 		rt6_multipath_rebalance(rt);
+		fib6_update_sernum_upto_root(net, rt);
 	}
 
 	return 0;
@@ -5015,8 +5015,8 @@ static int fib6_ifdown(struct fib6_info *rt, void *p_arg)
 			}
 			rt6_multipath_nh_flags_set(rt, dev, RTNH_F_DEAD |
 						   RTNH_F_LINKDOWN);
-			fib6_update_sernum(net, rt);
 			rt6_multipath_rebalance(rt);
+			fib6_update_sernum(net, rt);
 		}
 		return -2;
 	case NETDEV_CHANGE:
@@ -5024,8 +5024,8 @@ static int fib6_ifdown(struct fib6_info *rt, void *p_arg)
 		    rt->fib6_flags & (RTF_LOCAL | RTF_ANYCAST))
 			break;
 		rt->fib6_nh->fib_nh_flags |= RTNH_F_LINKDOWN;
-		fib6_update_sernum(net, rt);
 		rt6_multipath_rebalance(rt);
+		fib6_update_sernum(net, rt);
 		break;
 	}
 

base-commit: ef3e21c61baa74e39a49b75318bd4541562ec43f
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown
  2026-11-26  8:13 [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown Ralf Lici
@ 2026-11-26  8:18 ` netdev-bot+sinfo
  2026-11-26  8:24   ` Ralf Lici
  2026-11-26 15:40 ` David Ahern
  1 sibling, 1 reply; 4+ messages in thread
From: netdev-bot+sinfo @ 2026-11-26  8:18 UTC (permalink / raw)
  To: Ralf Lici
  Cc: netdev, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
	Sagarika Sharma, Kuniyuki Iwashima, Xia Yan, linux-kernel

Hi!

This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:

 - Whether the issue was actually triggered, or is only theoretical
   (e.g. found by LLM and not proven at runtime). If it was triggered
   please include the symptoms, like the stack trace or kernel messages.

Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.

*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
-- 
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown
  2026-11-26  8:18 ` netdev-bot+sinfo
@ 2026-11-26  8:24   ` Ralf Lici
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Lici @ 2026-11-26  8:24 UTC (permalink / raw)
  To: netdev-bot+sinfo
  Cc: netdev, David Ahern, Ido Schimmel, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Willem de Bruijn, Simon Horman,
	Sagarika Sharma, Kuniyuki Iwashima, Xia Yan, linux-kernel

On Thu, 26 Nov 2026 08:18:35 +0000, netdev-bot+sinfo@kernel.org wrote:
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
>  - Whether the issue was actually triggered, or is only theoretical
>    (e.g. found by LLM and not proven at runtime). If it was triggered
>    please include the symptoms, like the stack trace or kernel messages.
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> -- 
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
>

I've actually specified this in the commit message:

Reported by Sashiko while reviewing an earlier version of this change.

-- 
Ralf Lici
Mandelbit Srl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown
  2026-11-26  8:13 [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown Ralf Lici
  2026-11-26  8:18 ` netdev-bot+sinfo
@ 2026-11-26 15:40 ` David Ahern
  1 sibling, 0 replies; 4+ messages in thread
From: David Ahern @ 2026-11-26 15:40 UTC (permalink / raw)
  To: Ralf Lici, netdev
  Cc: Ido Schimmel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Willem de Bruijn, Simon Horman, Sagarika Sharma,
	Kuniyuki Iwashima, Xia Yan, linux-kernel

On 11/26/26 1:13 AM, Ralf Lici wrote:
> fib6_ifup and fib6_ifdown update the node serial before calling
> rt6_multipath_rebalance. A lookup that runs between the two can select a
> nexthop using the old ECMP upper bounds and read the new serial as its
> cookie. The cached dst then passes dst_check although it was selected
> from the old state, until the next relevant change.
> 
> Update the serial after rt6_multipath_rebalance, so that it is published
> only after the routing state it describes. fib6_new_sernum allocates the
> serial with a fully ordered atomic_try_cmpxchg, which orders the
> rebalance before the serial update. The invalidation scope is unchanged:
> fib6_ifup still updates the node and its ancestors, fib6_ifdown only the
> node.
> 
> Validating dsts against the generation sampled before the lookup, as
> proposed in "ipv6: validate cached dsts against the netns route
> generation", relies on this order as well: a lookup that reads the new
> generation must also observe the routing change it describes.
> 
> Reported by Sashiko while reviewing an earlier version of this change.
> 
> Fixes: d7dedee184e7 ("ipv6: Calculate hash thresholds for IPv6 nexthops")
> Fixes: 4bc852006b62 ("ipv6: update route serial number on NETDEV_CHANGE")
> Link: https://lore.kernel.org/netdev/cover.1795642432.git.dahern@nvidia.com/
> Signed-off-by: Ralf Lici <ralf@mandelbit.com>
> Reviewed-by: Xia Yan <yanxia@cmss.chinamobile.com>
> ---
> Split out of v5 of "ipv6: tie dst validation to the lookup that
> returned the dst", which is withdrawn in favour of the series in the
> Link above:
> https://lore.kernel.org/netdev/cover.1795537128.git.ralf@mandelbit.com/
> 
>  net/ipv6/route.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-11-26 15:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  8:13 [PATCH net] ipv6: advance the serial after rebalancing in fib6_ifup and fib6_ifdown Ralf Lici
2026-11-26  8:18 ` netdev-bot+sinfo
2026-11-26  8:24   ` Ralf Lici
2026-11-26 15:40 ` David Ahern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox