From patchwork Wed Mar 27 09:33:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ananyev, Konstantin" X-Patchwork-Id: 51770 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 01A5658EC; Wed, 27 Mar 2019 10:33:41 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id BEB6C532C for ; Wed, 27 Mar 2019 10:33:36 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 02:33:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="331090266" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2019 02:33:34 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: akhil.goyal@nxp.com, Konstantin Ananyev Date: Wed, 27 Mar 2019 09:33:27 +0000 Message-Id: <20190327093329.12521-2-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190327093329.12521-1-konstantin.ananyev@intel.com> References: <20190327093329.12521-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH 1/3] examples/ipsec-secgw: fix invalid out-of-bound check 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" Fixes: 7622291b641d ("examples/ipsec-secgw: allow to specify neighbour MAC address") Coverity issue: 336791 Signed-off-by: Konstantin Ananyev Acked-by: Akhil Goyal --- examples/ipsec-secgw/ipsec-secgw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index b253eea2b..ffbd00b08 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -1439,7 +1439,7 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr) int add_dst_ethaddr(uint16_t port, const struct ether_addr *addr) { - if (port > RTE_DIM(ethaddr_tbl)) + if (port >= RTE_DIM(ethaddr_tbl)) return -EINVAL; ethaddr_tbl[port].dst = ETHADDR_TO_UINT64(addr); From patchwork Wed Mar 27 09:33:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ananyev, Konstantin" X-Patchwork-Id: 51771 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DCB105A44; Wed, 27 Mar 2019 10:33:43 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 6006F532C for ; Wed, 27 Mar 2019 10:33:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 02:33:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="331090273" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2019 02:33:35 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: akhil.goyal@nxp.com, Konstantin Ananyev Date: Wed, 27 Mar 2019 09:33:28 +0000 Message-Id: <20190327093329.12521-3-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190327093329.12521-1-konstantin.ananyev@intel.com> References: <20190327093329.12521-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH 2/3] examples/ipsec_secgw: fix possible NULL dereference 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" Fixes: 3e5f4625dc17 ("examples/ipsec-secgw: make data-path to use IPsec library") Coverity issue: 336844 Signed-off-by: Konstantin Ananyev --- examples/ipsec-secgw/ipsec_process.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/examples/ipsec-secgw/ipsec_process.c b/examples/ipsec-secgw/ipsec_process.c index e403c461a..3f9cacb8f 100644 --- a/examples/ipsec-secgw/ipsec_process.c +++ b/examples/ipsec-secgw/ipsec_process.c @@ -217,16 +217,11 @@ ipsec_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf) pg = grp + i; sa = pg->id.ptr; - /* no valid SA found */ - if (sa == NULL) - k = 0; - ips = &sa->ips; - satp = rte_ipsec_sa_type(ips->sa); /* no valid HW session for that SA, try to create one */ - if (ips->crypto.ses == NULL && - fill_ipsec_session(ips, ctx, sa) != 0) + if (sa == NULL || (ips->crypto.ses == NULL && + fill_ipsec_session(ips, ctx, sa) != 0)) k = 0; /* process packets inline */ @@ -234,6 +229,8 @@ ipsec_process(struct ipsec_ctx *ctx, struct ipsec_traffic *trf) sa->type == RTE_SECURITY_ACTION_TYPE_INLINE_PROTOCOL) { + satp = rte_ipsec_sa_type(ips->sa); + /* * This is just to satisfy inbound_sa_check() * and get_hop_for_offload_pkt(). From patchwork Wed Mar 27 09:33:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Ananyev, Konstantin" X-Patchwork-Id: 51772 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 822535B2A; Wed, 27 Mar 2019 10:33:46 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 0092B532C for ; Wed, 27 Mar 2019 10:33:37 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2019 02:33:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,276,1549958400"; d="scan'208";a="331090278" Received: from sivswdev08.ir.intel.com ([10.237.217.47]) by fmsmga006.fm.intel.com with ESMTP; 27 Mar 2019 02:33:36 -0700 From: Konstantin Ananyev To: dev@dpdk.org Cc: akhil.goyal@nxp.com, Konstantin Ananyev Date: Wed, 27 Mar 2019 09:33:29 +0000 Message-Id: <20190327093329.12521-4-konstantin.ananyev@intel.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190327093329.12521-1-konstantin.ananyev@intel.com> References: <20190327093329.12521-1-konstantin.ananyev@intel.com> Subject: [dpdk-dev] [PATCH 3/3] examples/ipsec-secgw: fix typo in test script 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" Fix typo in run_test.sh Fixes: 929784452094 ("examples/ipsec-secgw: add scripts for functional test") Signed-off-by: Konstantin Ananyev Acked-by: Akhil Goyal --- examples/ipsec-secgw/test/run_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ipsec-secgw/test/run_test.sh b/examples/ipsec-secgw/test/run_test.sh index d8c4b6625..3a1a7d4b4 100644 --- a/examples/ipsec-secgw/test/run_test.sh +++ b/examples/ipsec-secgw/test/run_test.sh @@ -66,7 +66,7 @@ while [[ ${st} -eq 0 ]]; do fi done -if [[ ${run4} -eq 0 && {run6} -eq 0 ]]; then +if [[ ${run4} -eq 0 && ${run6} -eq 0 ]]; then exit 127 fi