From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id D851438EB for ; Thu, 29 Sep 2016 17:44:30 +0200 (CEST) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP; 29 Sep 2016 08:44:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,415,1470726000"; d="scan'208";a="14587618" Received: from sie-lab-212-109.ir.intel.com (HELO silpixa00389029.ir.intel.com) ([10.237.212.109]) by fmsmga005.fm.intel.com with ESMTP; 29 Sep 2016 08:44:23 -0700 From: Sergio Gonzalez Monroy To: dev@dpdk.org Cc: pablo.de.lara.guarch@intel.com Date: Thu, 29 Sep 2016 16:44:11 +0100 Message-Id: <1475163857-142366-6-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1475163857-142366-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1474616734-118291-1-git-send-email-sergio.gonzalez.monroy@intel.com> <1475163857-142366-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v3 5/9] examples/ipsec-secgw: check sp only when setup 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: Thu, 29 Sep 2016 15:44:32 -0000 Application will segfault if there is IPv4 or IPv6 and no SP/ACL rules for IPv4 or IPv6 respectively. Avoid checking the ACL/SP in such cases. Fixes: 906257e965b7 ("examples/ipsec-secgw: support IPv6") Signed-off-by: Sergio Gonzalez Monroy --- examples/ipsec-secgw/ipsec-secgw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c index 8b55534..9eee96f 100644 --- a/examples/ipsec-secgw/ipsec-secgw.c +++ b/examples/ipsec-secgw/ipsec-secgw.c @@ -388,7 +388,7 @@ inbound_sp_sa(struct sp_ctx *sp, struct sa_ctx *sa, struct traffic_type *ip, struct rte_mbuf *m; uint32_t i, j, res, sa_idx; - if (ip->num == 0) + if (ip->num == 0 || sp == NULL) return; rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res, @@ -463,7 +463,7 @@ outbound_sp(struct sp_ctx *sp, struct traffic_type *ip, struct rte_mbuf *m; uint32_t i, j, sa_idx; - if (ip->num == 0) + if (ip->num == 0 || sp == NULL) return; rte_acl_classify((struct rte_acl_ctx *)sp, ip->data, ip->res, -- 2.5.5