aboutsummaryrefslogtreecommitdiff
path: root/example/ipsec_crypto/odp_ipsec_stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'example/ipsec_crypto/odp_ipsec_stream.c')
-rw-r--r--example/ipsec_crypto/odp_ipsec_stream.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/example/ipsec_crypto/odp_ipsec_stream.c b/example/ipsec_crypto/odp_ipsec_stream.c
index db4130fe7..e53dbce0d 100644
--- a/example/ipsec_crypto/odp_ipsec_stream.c
+++ b/example/ipsec_crypto/odp_ipsec_stream.c
@@ -425,6 +425,13 @@ odp_bool_t verify_ipv4_packet(stream_db_entry_t *stream,
/* Find IPsec headers if any and compare against entry */
hdr_len = locate_ipsec_headers(ip, &ah, &esp);
+ /* Verify if the packet is IPsec encapsulated or is cleartext as
+ * expected
+ */
+ if (((stream->output.entry && (!ah && !esp))) ||
+ (stream->input.entry && (ah || esp)))
+ return FALSE;
+
/* Cleartext packet */
if (!ah && !esp)
goto clear_packet;