summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>2016-06-09 09:42:46 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2016-06-21 12:09:18 +0200
commit85f847672767062584e0fe9a9b603d90e5b058d0 (patch)
tree076f053c0d535351825fb74737ab756852c4bee3 /examples
parentc64278c0c18bd87242ff3fd12891a095cecdbf58 (diff)
downloaddpdk-85f847672767062584e0fe9a9b603d90e5b058d0.zip
dpdk-85f847672767062584e0fe9a9b603d90e5b058d0.tar.gz
dpdk-85f847672767062584e0fe9a9b603d90e5b058d0.tar.xz
examples/ipsec-secgw: fix no SA found case
The application only ASSERTS that an SA is not NULL (only when debugging is enabled) without properly dealing with the case of not having an SA for the processed packet. Behavior should be such as if no SA is found, drop the packet. Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application") Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/ipsec-secgw/ipsec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/ipsec-secgw/ipsec.c b/examples/ipsec-secgw/ipsec.c
index 90a9a86..ccc840f 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;
- RTE_ASSERT(sa != NULL);
-
priv->cop.type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
rte_prefetch0(&priv->sym_cop);