All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
@ 2022-07-19 12:26 Ido Schimmel
  2022-07-19 12:58 ` Nicolas Dichtel
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Ido Schimmel @ 2022-07-19 12:26 UTC (permalink / raw)
  To: netdev
  Cc: davem, kuba, pabeni, edumazet, petrm, amcohen, nicolas.dichtel,
	dsahern, mlxsw, Ido Schimmel, stable

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().

Cc: stable@vger.kernel.org
Fixes: 747c14307214 ("ip: fix dflt addr selection for connected nexthop")
Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Amit Cohen <amcohen@nvidia.com>
---
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(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
index 23d526f13f1c..abc0096a20a9 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c
@@ -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);
 }
 
-- 
2.36.1


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

* Re: [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
  2022-07-19 12:26 [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication Ido Schimmel
@ 2022-07-19 12:58 ` Nicolas Dichtel
  2022-07-19 18:03 ` David Ahern
  2022-07-20 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Nicolas Dichtel @ 2022-07-19 12:58 UTC (permalink / raw)
  To: Ido Schimmel, netdev
  Cc: davem, kuba, pabeni, edumazet, petrm, amcohen, dsahern, mlxsw, stable


Le 19/07/2022 à 14:26, Ido Schimmel a écrit :
> 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().
> 
> Cc: stable@vger.kernel.org
> Fixes: 747c14307214 ("ip: fix dflt addr selection for connected nexthop")
> Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Amit Cohen <amcohen@nvidia.com>
Reviewed-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

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

* Re: [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
  2022-07-19 12:26 [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication Ido Schimmel
  2022-07-19 12:58 ` Nicolas Dichtel
@ 2022-07-19 18:03 ` David Ahern
  2022-07-20 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: David Ahern @ 2022-07-19 18:03 UTC (permalink / raw)
  To: Ido Schimmel, netdev
  Cc: davem, kuba, pabeni, edumazet, petrm, amcohen, nicolas.dichtel,
	mlxsw, stable

On 7/19/22 6:26 AM, Ido Schimmel 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").
> 
> 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().
> 
> Cc: stable@vger.kernel.org
> Fixes: 747c14307214 ("ip: fix dflt addr selection for connected nexthop")
> Fixes: 597cfe4fc339 ("nexthop: Add support for IPv4 nexthops")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
> Reviewed-by: Amit Cohen <amcohen@nvidia.com>
> ---
> 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(-)
> 

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



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

* Re: [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication
  2022-07-19 12:26 [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication Ido Schimmel
  2022-07-19 12:58 ` Nicolas Dichtel
  2022-07-19 18:03 ` David Ahern
@ 2022-07-20 10:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-07-20 10:10 UTC (permalink / raw)
  To: Ido Schimmel
  Cc: netdev, davem, kuba, pabeni, edumazet, petrm, amcohen,
	nicolas.dichtel, dsahern, mlxsw, stable

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

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!
-- 
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:[~2022-07-20 10:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-19 12:26 [PATCH net] mlxsw: spectrum_router: Fix IPv4 nexthop gateway indication Ido Schimmel
2022-07-19 12:58 ` Nicolas Dichtel
2022-07-19 18:03 ` David Ahern
2022-07-20 10:10 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.