Blob Blame History Raw
From: Roi Dayan <roid@nvidia.com>
Date: Sun, 1 Aug 2021 15:47:46 +0300
Subject: net/mlx5e: Avoid creating tunnel headers for local route
Patch-mainline: v5.14-rc6
Git-commit: c623c95afa56bf4bf64e4f58742dc94616ef83db
References: git-fixes

It could be local and remote are on the same machine and the route
result will be a local route which will result in creating encap id
with src/dst mac address of 0.

Fixes: a54e20b4fcae ("net/mlx5e: Add basic TC tunnel set action for SRIOV offloads")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c |    5 +++++
 1 file changed, 5 insertions(+)

--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -104,6 +104,11 @@ static int mlx5e_route_lookup_ipv4(struc
 	if (IS_ERR(rt))
 		return PTR_ERR(rt);
 
+	if (rt->rt_type != RTN_UNICAST) {
+		ip_rt_put(rt);
+		return -ENETUNREACH;
+	}
+
 	if (mlx5_lag_is_multipath(mdev) && rt->rt_gw_family != AF_INET) {
 		ip_rt_put(rt);
 		return -ENETUNREACH;