History

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

Ido Schimmel committed 4 years ago

Commit e5ec6a21 parent c0f47c21 file · +1 −1Browse files

Unified · Split

drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c+1−1
@@ -5384,7 +5384,7 @@ static bool mlxsw_sp_fi_is_gateway(const struct mlxsw_sp *mlxsw_sp, · 5383 unmodified lines
5384{5384{
5385 const struct fib_nh *nh = fib_info_nh(fi, 0);5385 const struct fib_nh *nh = fib_info_nh(fi, 0);
5386 5386
5387 return nh->fib_nh_scope == RT_SCOPE_LINK ||5387 return nh->fib_nh_gw_family ||
5388 mlxsw_sp_nexthop4_ipip_type(mlxsw_sp, nh, NULL);5388 mlxsw_sp_nexthop4_ipip_type(mlxsw_sp, nh, NULL);
5389}5389}
5390 5390