DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dekel Peled <dekelp@nvidia.com>
To: viacheslavo@nvidia.com, shahafs@nvidia.com, matan@nvidia.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/mlx5: fix IPv6 next proto validation
Date: Tue, 20 Oct 2020 15:09:20 +0300	[thread overview]
Message-ID: <fc7c2ef6fc37f4337ad7a0980e351d6ae92a7a19.1603195768.git.dekelp@nvidia.com> (raw)

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


             reply	other threads:[~2020-10-20 12:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-20 12:09 Dekel Peled [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc7c2ef6fc37f4337ad7a0980e351d6ae92a7a19.1603195768.git.dekelp@nvidia.com \
    --to=dekelp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=matan@nvidia.com \
    --cc=shahafs@nvidia.com \
    --cc=viacheslavo@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).