DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix IPv6 next proto validation
@ 2020-10-20 12:09 Dekel Peled
  2020-10-20 13:19 ` [dpdk-dev] [PATCH V2 1/1] " Eli Britstein
  0 siblings, 1 reply; 7+ messages in thread
From: Dekel Peled @ 2020-10-20 12:09 UTC (permalink / raw)
  To: viacheslavo, shahafs, matan; +Cc: dev

Previous patch added validation of the IPv6 next proto field, in order
to overcome a known limitation.
One of the values checked is IPPROTO_HOPOPTS, which is currently defined
as value 0.
The same value 0 is received when next proto field is not specified for
matching, or has mask 0.

This patch updates the validation, to make sure next proto is not 0
before validating it.

Fixes: 55e4c1d1ba73 ("net/mlx5: enforce limitation on IPv6 next proto")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c56dac8..74af207 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1987,12 +1987,13 @@ struct mlx5_flow_tunnel_info {
 						  "multiple tunnel "
 						  "not supported");
 	}
-	if (next_proto == IPPROTO_HOPOPTS  ||
-	    next_proto == IPPROTO_ROUTING  ||
-	    next_proto == IPPROTO_FRAGMENT ||
-	    next_proto == IPPROTO_ESP	   ||
-	    next_proto == IPPROTO_AH	   ||
-	    next_proto == IPPROTO_DSTOPTS)
+	if (next_proto &&
+	    (next_proto == IPPROTO_HOPOPTS  ||
+	     next_proto == IPPROTO_ROUTING  ||
+	     next_proto == IPPROTO_FRAGMENT ||
+	     next_proto == IPPROTO_ESP      ||
+	     next_proto == IPPROTO_AH	    ||
+	     next_proto == IPPROTO_DSTOPTS))
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "IPv6 proto (next header) should "
-- 
1.8.3.1


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

* [dpdk-dev] [PATCH V2 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-20 12:09 [dpdk-dev] [PATCH] net/mlx5: fix IPv6 next proto validation Dekel Peled
@ 2020-10-20 13:19 ` Eli Britstein
  2020-10-20 13:49   ` Eli Britstein
  2020-10-21 14:22   ` Matan Azrad
  0 siblings, 2 replies; 7+ messages in thread
From: Eli Britstein @ 2020-10-20 13:19 UTC (permalink / raw)
  To: dev; +Cc: Dekel Peled, Ori Kam, Eli Britstein

Previous patch added validation of the IPv6 next proto field, in order
to overcome a known limitation.
One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
If proto field is not specified for matching, or mask=0, as in the
following, a wrong validation takes place.
flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions
drop / end
Fix the validation only on proto asked by the user.

Fixes: 55e4c1d1ba73 ("net/mlx5: enforce limitation on IPv6 next proto")

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Dekel Peled <dekelp@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index c56dac89f9..e0ca8e06b1 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1977,7 +1977,7 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "IPv6 cannot follow L2/VLAN layer "
 					  "which ether type is not IPv6");
-	if (mask && spec)
+	if (mask && mask->hdr.proto && spec)
 		next_proto = mask->hdr.proto & spec->hdr.proto;
 	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
 		if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6)
-- 
2.28.0.546.g385c171


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

* Re: [dpdk-dev] [PATCH V2 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-20 13:19 ` [dpdk-dev] [PATCH V2 1/1] " Eli Britstein
@ 2020-10-20 13:49   ` Eli Britstein
  2020-10-21 14:22   ` Matan Azrad
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Britstein @ 2020-10-20 13:49 UTC (permalink / raw)
  To: dev
  Cc: Dekel Peled, Ori Kam, Matan Azrad, Shahaf Shuler,
	Slava Bogdanovich Ovsiienko

++

On 10/20/2020 4:19 PM, Eli Britstein wrote:
> Previous patch added validation of the IPv6 next proto field, in order
> to overcome a known limitation.
> One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
> If proto field is not specified for matching, or mask=0, as in the
> following, a wrong validation takes place.
> flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions
> drop / end
> Fix the validation only on proto asked by the user.
>
> Fixes: 55e4c1d1ba73 ("net/mlx5: enforce limitation on IPv6 next proto")
>
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Dekel Peled <dekelp@nvidia.com>
> ---
>   drivers/net/mlx5/mlx5_flow.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index c56dac89f9..e0ca8e06b1 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1977,7 +1977,7 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
>   					  RTE_FLOW_ERROR_TYPE_ITEM, item,
>   					  "IPv6 cannot follow L2/VLAN layer "
>   					  "which ether type is not IPv6");
> -	if (mask && spec)
> +	if (mask && mask->hdr.proto && spec)
>   		next_proto = mask->hdr.proto & spec->hdr.proto;
>   	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
>   		if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6)

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

* Re: [dpdk-dev] [PATCH V2 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-20 13:19 ` [dpdk-dev] [PATCH V2 1/1] " Eli Britstein
  2020-10-20 13:49   ` Eli Britstein
@ 2020-10-21 14:22   ` Matan Azrad
  2020-10-22  8:26     ` [dpdk-dev] [PATCH V3 " Eli Britstein
  1 sibling, 1 reply; 7+ messages in thread
From: Matan Azrad @ 2020-10-21 14:22 UTC (permalink / raw)
  To: Eli Britstein, dev; +Cc: Dekel Peled, Ori Kam, Eli Britstein



From: Eli Britstein
> Previous patch added validation of the IPv6 next proto field, in order to
> overcome a known limitation.
> One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
> If proto field is not specified for matching, or mask=0, as in the following, a
> wrong validation takes place.
> flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions drop /
> end Fix the validation only on proto asked by the user.
> 
> Fixes: 55e4c1d1ba73 ("net/mlx5: enforce limitation on IPv6 next proto")
> 
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Dekel Peled <dekelp@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index c56dac89f9..e0ca8e06b1 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1977,7 +1977,7 @@ mlx5_flow_validate_item_ipv6(const struct
> rte_flow_item *item,
>  					  RTE_FLOW_ERROR_TYPE_ITEM,
> item,
>  					  "IPv6 cannot follow L2/VLAN layer "
>  					  "which ether type is not IPv6");
> -	if (mask && spec)
> +	if (mask && mask->hdr.proto && spec)

If you want to be sure os specific proto only you need to check mask->hdr.proto==0xFF, no?

>  		next_proto = mask->hdr.proto & spec->hdr.proto;
>  	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
>  		if (next_proto == IPPROTO_IPIP || next_proto ==
> IPPROTO_IPV6)
> --
> 2.28.0.546.g385c171


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

* [dpdk-dev] [PATCH V3 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-21 14:22   ` Matan Azrad
@ 2020-10-22  8:26     ` Eli Britstein
  2020-10-22 10:01       ` Raslan Darawsheh
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Britstein @ 2020-10-22  8:26 UTC (permalink / raw)
  To: dev
  Cc: Dekel Peled, Ori Kam, Matan Azrad, Raslan Darawsheh,
	Slava Ovsiienko, Shahaf Shuler, Asaf Penso, Eli Britstein

Previous patch added validation of the IPv6 next proto field, in order
to overcome a known limitation.
One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
If proto field is not specified for matching, or mask=0, as in the
following, a wrong validation takes place.
flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions
drop / end
Fix the validation only on proto asked by the user.

Fixes: 92be60e1b541 ("net/mlx5: enforce limitation on IPv6 next proto")

Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 22fb4ee60a..d7243a878b 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1979,8 +1979,8 @@ mlx5_flow_validate_item_ipv6(const struct rte_flow_item *item,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "IPv6 cannot follow L2/VLAN layer "
 					  "which ether type is not IPv6");
-	if (mask && spec)
-		next_proto = mask->hdr.proto & spec->hdr.proto;
+	if (mask && mask->hdr.proto == UINT8_MAX && spec)
+		next_proto = spec->hdr.proto;
 	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
 		if (next_proto == IPPROTO_IPIP || next_proto == IPPROTO_IPV6)
 			return rte_flow_error_set(error, EINVAL,
-- 
2.28.0.546.g385c171


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

* Re: [dpdk-dev] [PATCH V3 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-22  8:26     ` [dpdk-dev] [PATCH V3 " Eli Britstein
@ 2020-10-22 10:01       ` Raslan Darawsheh
  2020-10-22 16:38         ` Ferruh Yigit
  0 siblings, 1 reply; 7+ messages in thread
From: Raslan Darawsheh @ 2020-10-22 10:01 UTC (permalink / raw)
  To: Eli Britstein, dev
  Cc: Dekel Peled, Ori Kam, Matan Azrad, Slava Ovsiienko,
	Shahaf Shuler, Asaf Penso, Eli Britstein

Hi,

> -----Original Message-----
> From: Eli Britstein <elibr@nvidia.com>
> Sent: Thursday, October 22, 2020 11:26 AM
> To: dev@dpdk.org
> Cc: Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Matan
> Azrad <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>; Slava
> Ovsiienko <viacheslavo@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
> Asaf Penso <asafp@nvidia.com>; Eli Britstein <elibr@nvidia.com>
> Subject: [PATCH V3 1/1] net/mlx5: fix IPv6 next proto validation
> 
> Previous patch added validation of the IPv6 next proto field, in order
> to overcome a known limitation.
> One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
> If proto field is not specified for matching, or mask=0, as in the
> following, a wrong validation takes place.
> flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions
> drop / end
> Fix the validation only on proto asked by the user.
> 
> Fixes: 92be60e1b541 ("net/mlx5: enforce limitation on IPv6 next proto")
> 
> Signed-off-by: Eli Britstein <elibr@nvidia.com>
> Acked-by: Dekel Peled <dekelp@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 22fb4ee60a..d7243a878b 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -1979,8 +1979,8 @@ mlx5_flow_validate_item_ipv6(const struct
> rte_flow_item *item,
>  					  RTE_FLOW_ERROR_TYPE_ITEM,
> item,
>  					  "IPv6 cannot follow L2/VLAN layer "
>  					  "which ether type is not IPv6");
> -	if (mask && spec)
> -		next_proto = mask->hdr.proto & spec->hdr.proto;
> +	if (mask && mask->hdr.proto == UINT8_MAX && spec)
> +		next_proto = spec->hdr.proto;
>  	if (item_flags & MLX5_FLOW_LAYER_IPV6_ENCAP) {
>  		if (next_proto == IPPROTO_IPIP || next_proto ==
> IPPROTO_IPV6)
>  			return rte_flow_error_set(error, EINVAL,
> --
> 2.28.0.546.g385c171


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh

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

* Re: [dpdk-dev] [PATCH V3 1/1] net/mlx5: fix IPv6 next proto validation
  2020-10-22 10:01       ` Raslan Darawsheh
@ 2020-10-22 16:38         ` Ferruh Yigit
  0 siblings, 0 replies; 7+ messages in thread
From: Ferruh Yigit @ 2020-10-22 16:38 UTC (permalink / raw)
  To: Raslan Darawsheh, Eli Britstein, dev
  Cc: Dekel Peled, Ori Kam, Matan Azrad, Slava Ovsiienko,
	Shahaf Shuler, Asaf Penso

On 10/22/2020 11:01 AM, Raslan Darawsheh wrote:
> Hi,
> 
>> -----Original Message-----
>> From: Eli Britstein <elibr@nvidia.com>
>> Sent: Thursday, October 22, 2020 11:26 AM
>> To: dev@dpdk.org
>> Cc: Dekel Peled <dekelp@nvidia.com>; Ori Kam <orika@nvidia.com>; Matan
>> Azrad <matan@nvidia.com>; Raslan Darawsheh <rasland@nvidia.com>; Slava
>> Ovsiienko <viacheslavo@nvidia.com>; Shahaf Shuler <shahafs@nvidia.com>;
>> Asaf Penso <asafp@nvidia.com>; Eli Britstein <elibr@nvidia.com>
>> Subject: [PATCH V3 1/1] net/mlx5: fix IPv6 next proto validation
>>
>> Previous patch added validation of the IPv6 next proto field, in order
>> to overcome a known limitation.
>> One of the values checked is IPPROTO_HOPOPTS, which is defined as 0.
>> If proto field is not specified for matching, or mask=0, as in the
>> following, a wrong validation takes place.
>> flow create 0 ingress pattern eth / ipv6 has_frag_ext is 0 / end actions
>> drop / end
>> Fix the validation only on proto asked by the user.
>>
>> Fixes: 92be60e1b541 ("net/mlx5: enforce limitation on IPv6 next proto")
>>
>> Signed-off-by: Eli Britstein <elibr@nvidia.com>
>> Acked-by: Dekel Peled <dekelp@nvidia.com>
>> Acked-by: Matan Azrad <matan@nvidia.com>
> 
> 
> Patch applied to next-net-mlx,
> 

Squashed into relevant commit in next-net, thanks.

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

end of thread, other threads:[~2020-10-22 16:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 12:09 [dpdk-dev] [PATCH] net/mlx5: fix IPv6 next proto validation Dekel Peled
2020-10-20 13:19 ` [dpdk-dev] [PATCH V2 1/1] " Eli Britstein
2020-10-20 13:49   ` Eli Britstein
2020-10-21 14:22   ` Matan Azrad
2020-10-22  8:26     ` [dpdk-dev] [PATCH V3 " Eli Britstein
2020-10-22 10:01       ` Raslan Darawsheh
2020-10-22 16:38         ` Ferruh Yigit

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git