net/mlx5: fix ipv6 type icmp6 header rewrite actions

Message ID 1582026774-10127-1-git-send-email-shirik@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix ipv6 type icmp6 header rewrite actions |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/travis-robot warning Travis build: failed
ci/Intel-compilation fail apply issues

Commit Message

Shiri Kuzin Feb. 18, 2020, 11:52 a.m. UTC
  ICMPv6 header contains the checksum field, that includes the IP
addresses from IP header.

The ConnectX-5 hardware does not support ICMPv6 checksum calculation
and in case of IP header modification the checksum will contain
the wrong value.

The patch rejects the header modification actions related to IP
addresses if ICMPv6 protocol is detected in pattern.
This issue was also partly fixed in commit [1] which rejects
flows with the pattern "ipv6 proto is 58".

[1] commit b1632bd0c1e3 ("net/mlx5: fix ICMPv6 header rewrite actions")

Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
Cc: stable@dpdk.org

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Raslan Darawsheh Feb. 19, 2020, 11:52 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Shiri Kuzin <shirik@mellanox.com>
> Sent: Tuesday, February 18, 2020 1:53 PM
> To: dev@dpdk.org
> Cc: Matan Azrad <matan@mellanox.com>; Raslan Darawsheh
> <rasland@mellanox.com>; Slava Ovsiienko <viacheslavo@mellanox.com>;
> stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix ipv6 type icmp6 header rewrite actions
> 
> ICMPv6 header contains the checksum field, that includes the IP
> addresses from IP header.
> 
> The ConnectX-5 hardware does not support ICMPv6 checksum calculation
> and in case of IP header modification the checksum will contain
> the wrong value.
> 
> The patch rejects the header modification actions related to IP
> addresses if ICMPv6 protocol is detected in pattern.
> This issue was also partly fixed in commit [1] which rejects
> flows with the pattern "ipv6 proto is 58".
> 
> [1] commit b1632bd0c1e3 ("net/mlx5: fix ICMPv6 header rewrite actions")
> 
> Fixes: 4bb14c83df95 ("net/mlx5: support modify header using Direct Verbs")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> Acked-by: Matan Azrad <matan@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index a9bb0b4..e5862bd 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -4621,6 +4621,7 @@ struct field_modify_info modify_tcp[] = {
>  							    error);
>  			if (ret < 0)
>  				return ret;
> +			item_ipv6_proto = IPPROTO_ICMPV6;
>  			last_item = MLX5_FLOW_LAYER_ICMP6;
>  			break;
>  		case RTE_FLOW_ITEM_TYPE_TAG:
> --
> 1.8.3.1


Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index a9bb0b4..e5862bd 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -4621,6 +4621,7 @@  struct field_modify_info modify_tcp[] = {
 							    error);
 			if (ret < 0)
 				return ret;
+			item_ipv6_proto = IPPROTO_ICMPV6;
 			last_item = MLX5_FLOW_LAYER_ICMP6;
 			break;
 		case RTE_FLOW_ITEM_TYPE_TAG: