From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id A4A0A2C65 for ; Fri, 6 May 2016 18:31:51 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 06 May 2016 09:31:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,587,1455004800"; d="scan'208";a="800515733" Received: from sie-lab-212-209.ir.intel.com (HELO silpixa00377983.ir.intel.com) ([10.237.212.209]) by orsmga003.jf.intel.com with ESMTP; 06 May 2016 09:31:46 -0700 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Fri, 6 May 2016 17:31:38 +0100 Message-Id: <1462552302-5852-6-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.4.11 In-Reply-To: <1462552302-5852-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1462552302-5852-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH 5/9] examples/ipsec-secgw: fix no sa found case X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 May 2016 16:31:52 -0000 The application only checks that an SA shoudln't be NULL through ASSERT (only when debugging is enabled) without properly dealing with the case of not having an SA for the processed packet. If no SA is found, drop the packet. Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Sergio Gonzalez Monroy --- examples/ipsec-secgw/ipsec.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c index 797663b..53af875 100644 --- a/examples/ipsec-secgw/ipsec.c +++ b/examples/ipsec-secgw/ipsec.c @@ -110,6 +110,11 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, struct ipsec_sa *sa; for (i = 0; i < nb_pkts; i++) { + if (unlikely(sas[i] == NULL)) { + rte_pktmbuf_free(pkts[i]); + continue; + } + rte_prefetch0(sas[i]); rte_prefetch0(pkts[i]); @@ -117,8 +122,6 @@ ipsec_enqueue(ipsec_xform_fn xform_func, struct ipsec_ctx *ipsec_ctx, sa = sas[i]; priv->sa = sa; - IPSEC_ASSERT(sa != NULL); - priv->cop.type = RTE_CRYPTO_OP_TYPE_SYMMETRIC; rte_prefetch0(&priv->sym_cop); -- 2.5.5