net/mlx5: Avoid forwarding to other eswitch uplink
authorEli Cohen <eli@mellanox.com>
Thu, 12 Mar 2020 15:20:32 +0000 (17:20 +0200)
committerSaeed Mahameed <saeedm@mellanox.com>
Wed, 18 Mar 2020 02:41:41 +0000 (19:41 -0700)
Do not allow forwarding of encapsulated traffic received from one eswtich's
uplink to another eswtich's uplink.

Signed-off-by: Eli Cohen <eli@mellanox.com>
Reviewed-by: Oz Shlomo <ozsh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c

index 608d0e07c3082562c121a7c754e16a3021de2080..b45c3f46570bdc5b38f4d177afadd17c1b1c92d2 100644 (file)
@@ -66,6 +66,9 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
              mlx5e_is_uplink_rep(netdev_priv(*out_dev))))
                return -EOPNOTSUPP;
 
+       if (mlx5e_eswitch_uplink_rep(priv->netdev) && *out_dev != priv->netdev)
+               return -EOPNOTSUPP;
+
        return 0;
 }