net/mlx5: fix MPLS item validation
Checks
Commit Message
Update the mlx5_flow_validate_item_mpls() function to allow
MPLS over UDP as well as MPLS over IP.
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: orika@mellanox.com
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
drivers/net/mlx5/mlx5_flow.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
PSB
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Dekel Peled
> Sent: Monday, November 12, 2018 11:20 AM
> To: Yongseok Koh <yskoh@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>
> Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix MPLS item validation
>
> Update the mlx5_flow_validate_item_mpls() function to allow
> MPLS over UDP as well as MPLS over IP.
>
> Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
> Cc: orika@mellanox.com
>
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> ---
> drivers/net/mlx5/mlx5_flow.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 21d65f4..0db862b 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1626,7 +1626,9 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
> const struct rte_flow_item_mpls *mask = item->mask;
> int ret;
>
> - if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS)
> + /* MPLS over IP and MPLS over UDP is allowed */
> + if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS &&
> + target_protocol != IPPROTO_UDP)
I don' t think this is the solution.
First before MPLS we can have GRE so this also need to be tested.
Second I don't think that the validation should use the target_protocol
since it holds value that is not relevant to the question. For example if
a user inserted the following rule eth / ipv4 proto = udp / mpls
The flow will be O.K which clearly it is not.
> return rte_flow_error_set(error, EINVAL,
> RTE_FLOW_ERROR_TYPE_ITEM,
> item,
> "protocol filtering not compatible"
> --
> 1.8.3.1
Best,
Ori
@@ -1626,7 +1626,9 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
const struct rte_flow_item_mpls *mask = item->mask;
int ret;
- if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS)
+ /* MPLS over IP and MPLS over UDP is allowed */
+ if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS &&
+ target_protocol != IPPROTO_UDP)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ITEM, item,
"protocol filtering not compatible"