From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1396FA04F1; Fri, 13 Dec 2019 12:50:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32F9C374C; Fri, 13 Dec 2019 12:50:07 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 5C97A2BC8 for ; Fri, 13 Dec 2019 12:50:05 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Dec 2019 03:50:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,309,1571727600"; d="scan'208";a="220906488" Received: from silpixa00390850.ir.intel.com (HELO silpixa00390850.ger.corp.intel.com) ([10.237.222.84]) by fmsmga001.fm.intel.com with ESMTP; 13 Dec 2019 03:50:03 -0800 From: Savinay Dharmappa To: dev@dpdk.org Cc: konstantin.ananyev@intel.com Date: Fri, 13 Dec 2019 11:49:55 +0000 Message-Id: <20191213114956.12062-1-savinay.dharmappa@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191212091435.4398-1-savinay.dharmappa@intel.com> References: <20191212091435.4398-1-savinay.dharmappa@intel.com> Subject: [dpdk-dev] [PATCH v2] examples/ipsec-secgw: return on encountering algo as NULL 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" if algo is NULL set the status to error and return. This change prevent crashing of ipsec-secgw application when a specific cipher/auth/aead algo are not supported by application. Fixes: 0d547ed03717 ("examples/ipsec-secgw: support configuration file") Signed-off-by: Savinay Dharmappa Acked-by: Konstantin Ananyev --- examples/ipsec-secgw/sa.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c index 7f046e3ed..c75a5a15f 100644 --- a/examples/ipsec-secgw/sa.c +++ b/examples/ipsec-secgw/sa.c @@ -314,6 +314,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->cipher_algo = algo->algo; rule->block_size = algo->block_size; rule->iv_len = algo->iv_len; @@ -378,6 +381,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->auth_algo = algo->algo; rule->auth_key_len = algo->key_len; rule->digest_len = algo->digest_len; @@ -433,6 +439,9 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, APP_CHECK(algo != NULL, status, "unrecognized " "input \"%s\"", tokens[ti]); + if (status->status < 0) + return; + rule->aead_algo = algo->algo; rule->cipher_key_len = algo->key_len; rule->digest_len = algo->digest_len; -- 2.17.1