mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
Ido Schimmel
maintainerPATCH 1/1 mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
mlxsw needs to distinguish nexthops with a gateway from connected nexthops in order to write the former to the adjacency table of the device. The check used to rely on the fact that nexthops with a gateway have a 'link' scope whereas connected nexthops have a 'host' scope. This is no longer correct after commit 747c14307214 ("ip: fix dflt addr selection for connected nexthop").
Fix that by instead checking the address family of the gateway IP. This is a more direct way and also consistent with the IPv6 counterpart in mlxsw_sp_rt6_is_gateway().
---
Copied stable since Nicolas' patch has stable copied and I don't want stable trees to have his patch, but not mine. To make it clear how far this patch needs to be backported, I have included the same Fixes tag as him.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -1
@@ -5292,7 +5292,7 @@ static bool mlxsw_sp_fi_is_gateway(const struct mlxsw_sp *mlxsw_sp, {const struct fib_nh *nh =fib_info_nh (fi,0 ); -return nh->fib_nh_scope ==RT_SCOPE_LINK || +return nh->fib_nh_gw_family ||mlxsw_sp_nexthop4_ipip_type (mlxsw_sp, nh,NULL ); }
Signature · 1 line
2.36.1
Le 19/07/2022 à 14:26, Ido Schimmel a écrit :
Quoted 11 lines
mlxsw needs to distinguish nexthops with a gateway from connected nexthops in order to write the former to the adjacency table of the device. The check used to rely on the fact that nexthops with a gateway have a 'link' scope whereas connected nexthops have a 'host' scope. This is no longer correct after commit
747c14307214("ip: fix dflt addr selection for connected nexthop").Fix that by instead checking the address family of the gateway IP. This is a more direct way and also consistent with the IPv6 counterpart in
mlxsw_sp_rt6_is_gateway().
Quoted 5 lines
Fixes 747c14307214 ("ip: fix dflt addr selection for connected nexthop")Fixes 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")Signed-off-by Ido Schimmel <[email protected]>Reviewed-by Amit Cohen <[email protected]>
Quoted 16 lines · Ido Schimmel
mlxsw needs to distinguish nexthops with a gateway from connected nexthops in order to write the former to the adjacency table of the device. The check used to rely on the fact that nexthops with a gateway have a 'link' scope whereas connected nexthops have a 'host' scope. This is no longer correct after commit
747c14307214("ip: fix dflt addr selection for connected nexthop").Fix that by instead checking the address family of the gateway IP. This is a more direct way and also consistent with the IPv6 counterpart in
mlxsw_sp_rt6_is_gateway().Fixes 747c14307214 ("ip: fix dflt addr selection for connected nexthop")Fixes 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")Signed-off-by Ido Schimmel <[email protected]>Reviewed-by Amit Cohen <[email protected]>
Quoted 9 lines
---
Copied stable since Nicolas' patch has stable copied and I don't want stable trees to have his patch, but not mine. To make it clear how far this patch needs to be backported, I have included the same Fixes tag as him.--- drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
This patch was applied to netdev/net.git (master) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (master)
by David S. Miller <[email protected]>:
Quoted 8 lines · On Tue, 19 Jul 2022 15:26:26 +0300 you wrote:
mlxsw needs to distinguish nexthops with a gateway from connected nexthops in order to write the former to the adjacency table of the device. The check used to rely on the fact that nexthops with a gateway have a 'link' scope whereas connected nexthops have a 'host' scope. This is no longer correct after commit
747c14307214("ip: fix dflt addr selection for connected nexthop").[...]
Here is the summary with links:
- [net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
https://git.kernel.org/netdev/net/c/e5ec6a251338
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html