* [PATCH net] ipv6: Align behavior across nexthops during path selection
@ 2025-04-08 8:43 Ido Schimmel
2025-04-08 14:02 ` Willem de Bruijn
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2025-04-08 8:43 UTC (permalink / raw)
To: netdev
Cc: davem, kuba, pabeni, edumazet, dsahern, horms,
willemdebruijn.kernel, Ido Schimmel
A nexthop is only chosen when the calculated multipath hash falls in the
nexthop's hash region (i.e., the hash is smaller than the nexthop's hash
threshold) and when the nexthop is assigned a non-negative score by
rt6_score_route().
Commit 4d0ab3a6885e ("ipv6: Start path selection from the first
nexthop") introduced an unintentional difference between the first
nexthop and the rest when the score is negative.
When the first nexthop matches, but has a negative score, the code will
currently evaluate subsequent nexthops until one is found with a
non-negative score. On the other hand, when a different nexthop matches,
but has a negative score, the code will fallback to the nexthop with
which the selection started ('match').
Align the behavior across all nexthops and fallback to 'match' when the
first nexthop matches, but has a negative score.
Fixes: 3d709f69a3e7 ("ipv6: Use hash-threshold instead of modulo-N")
Fixes: 4d0ab3a6885e ("ipv6: Start path selection from the first nexthop")
Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Closes: https://lore.kernel.org/netdev/67efef607bc41_1ddca82948c@willemb.c.googlers.com.notmuch/
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
net/ipv6/route.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ab12b816ab94..210b84cecc24 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -470,10 +470,10 @@ void fib6_select_path(const struct net *net, struct fib6_result *res,
goto out;
hash = fl6->mp_hash;
- if (hash <= atomic_read(&first->fib6_nh->fib_nh_upper_bound) &&
- rt6_score_route(first->fib6_nh, first->fib6_flags, oif,
- strict) >= 0) {
- match = first;
+ if (hash <= atomic_read(&first->fib6_nh->fib_nh_upper_bound)) {
+ if (rt6_score_route(first->fib6_nh, first->fib6_flags, oif,
+ strict) >= 0)
+ match = first;
goto out;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv6: Align behavior across nexthops during path selection
2025-04-08 8:43 [PATCH net] ipv6: Align behavior across nexthops during path selection Ido Schimmel
@ 2025-04-08 14:02 ` Willem de Bruijn
2025-04-08 15:17 ` David Ahern
2025-04-10 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2025-04-08 14:02 UTC (permalink / raw)
To: Ido Schimmel, netdev
Cc: davem, kuba, pabeni, edumazet, dsahern, horms,
willemdebruijn.kernel, Ido Schimmel
Ido Schimmel wrote:
> A nexthop is only chosen when the calculated multipath hash falls in the
> nexthop's hash region (i.e., the hash is smaller than the nexthop's hash
> threshold) and when the nexthop is assigned a non-negative score by
> rt6_score_route().
>
> Commit 4d0ab3a6885e ("ipv6: Start path selection from the first
> nexthop") introduced an unintentional difference between the first
> nexthop and the rest when the score is negative.
>
> When the first nexthop matches, but has a negative score, the code will
> currently evaluate subsequent nexthops until one is found with a
> non-negative score. On the other hand, when a different nexthop matches,
> but has a negative score, the code will fallback to the nexthop with
> which the selection started ('match').
>
> Align the behavior across all nexthops and fallback to 'match' when the
> first nexthop matches, but has a negative score.
>
> Fixes: 3d709f69a3e7 ("ipv6: Use hash-threshold instead of modulo-N")
> Fixes: 4d0ab3a6885e ("ipv6: Start path selection from the first nexthop")
> Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Closes: https://lore.kernel.org/netdev/67efef607bc41_1ddca82948c@willemb.c.googlers.com.notmuch/
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv6: Align behavior across nexthops during path selection
2025-04-08 8:43 [PATCH net] ipv6: Align behavior across nexthops during path selection Ido Schimmel
2025-04-08 14:02 ` Willem de Bruijn
@ 2025-04-08 15:17 ` David Ahern
2025-04-10 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2025-04-08 15:17 UTC (permalink / raw)
To: Ido Schimmel, netdev
Cc: davem, kuba, pabeni, edumazet, horms, willemdebruijn.kernel
On 4/8/25 2:43 AM, Ido Schimmel wrote:
> A nexthop is only chosen when the calculated multipath hash falls in the
> nexthop's hash region (i.e., the hash is smaller than the nexthop's hash
> threshold) and when the nexthop is assigned a non-negative score by
> rt6_score_route().
>
> Commit 4d0ab3a6885e ("ipv6: Start path selection from the first
> nexthop") introduced an unintentional difference between the first
> nexthop and the rest when the score is negative.
>
> When the first nexthop matches, but has a negative score, the code will
> currently evaluate subsequent nexthops until one is found with a
> non-negative score. On the other hand, when a different nexthop matches,
> but has a negative score, the code will fallback to the nexthop with
> which the selection started ('match').
>
> Align the behavior across all nexthops and fallback to 'match' when the
> first nexthop matches, but has a negative score.
>
> Fixes: 3d709f69a3e7 ("ipv6: Use hash-threshold instead of modulo-N")
> Fixes: 4d0ab3a6885e ("ipv6: Start path selection from the first nexthop")
> Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Closes: https://lore.kernel.org/netdev/67efef607bc41_1ddca82948c@willemb.c.googlers.com.notmuch/
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> ---
> net/ipv6/route.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
Reviewed-by: David Ahern <dsahern@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv6: Align behavior across nexthops during path selection
2025-04-08 8:43 [PATCH net] ipv6: Align behavior across nexthops during path selection Ido Schimmel
2025-04-08 14:02 ` Willem de Bruijn
2025-04-08 15:17 ` David Ahern
@ 2025-04-10 1:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-04-10 1:10 UTC (permalink / raw)
To: Ido Schimmel
Cc: netdev, davem, kuba, pabeni, edumazet, dsahern, horms,
willemdebruijn.kernel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Tue, 8 Apr 2025 11:43:16 +0300 you wrote:
> A nexthop is only chosen when the calculated multipath hash falls in the
> nexthop's hash region (i.e., the hash is smaller than the nexthop's hash
> threshold) and when the nexthop is assigned a non-negative score by
> rt6_score_route().
>
> Commit 4d0ab3a6885e ("ipv6: Start path selection from the first
> nexthop") introduced an unintentional difference between the first
> nexthop and the rest when the score is negative.
>
> [...]
Here is the summary with links:
- [net] ipv6: Align behavior across nexthops during path selection
https://git.kernel.org/netdev/net/c/6933cd471486
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-10 1:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-08 8:43 [PATCH net] ipv6: Align behavior across nexthops during path selection Ido Schimmel
2025-04-08 14:02 ` Willem de Bruijn
2025-04-08 15:17 ` David Ahern
2025-04-10 1:10 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox