From patchwork Tue Oct 20 12:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 81595 X-Patchwork-Delegate: rasland@nvidia.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CAB31A04DC; Tue, 20 Oct 2020 14:10:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6744BBBDA; Tue, 20 Oct 2020 14:10:44 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 8EACFBAE6 for ; Tue, 20 Oct 2020 14:10:42 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from dekelp@nvidia.com) with SMTP; 20 Oct 2020 15:10:39 +0300 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.228.134.250]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09KCAdHl003325; Tue, 20 Oct 2020 15:10:39 +0300 From: Dekel Peled To: viacheslavo@nvidia.com, shahafs@nvidia.com, matan@nvidia.com Cc: dev@dpdk.org Date: Tue, 20 Oct 2020 15:09:20 +0300 Message-Id: X-Mailer: git-send-email 1.7.1 Subject: [dpdk-dev] [PATCH] net/mlx5: fix IPv6 next proto validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 Acked-by: Ori Kam --- 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 "