diff mbox series

[RFC] security: add option to configure tunnel header verification

Message ID 20210705123007.19492-1-ktejasree@marvell.com (mailing list archive)
State New
Delegated to: akhil goyal
Headers show
Series [RFC] security: add option to configure tunnel header verification | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Tejasree Kondoj July 5, 2021, 12:30 p.m. UTC
Add option to indicate whether outer header verification
need to be done as part of inbound IPsec processing.

With inline IPsec processing, SA lookup would be happening
in the Rx path of rte_ethdev. When rte_flow is configured to
support more than one SA, SPI would be used to lookup SA.
In such cases, additional verification would be required to
ensure duplicate SPIs are not getting processed in the inline path.

For lookaside cases, the same option can be used by application
to offload tunnel verification to the PMD.

These verifications would help in averting possible DoS attacks.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 lib/security/rte_security.h | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
diff mbox series

Patch

diff --git a/lib/security/rte_security.h b/lib/security/rte_security.h
index 88d31de0a6..c67de78baf 100644
--- a/lib/security/rte_security.h
+++ b/lib/security/rte_security.h
@@ -55,6 +55,20 @@  enum rte_security_ipsec_tunnel_type {
 	/**< Outer header is IPv6 */
 };
 
+/**
+ * IPSEC tunnel header verification mode
+ *
+ * Controls how outer IP header is verified in inbound.
+ */
+enum rte_security_ipsec_tunnel_verify_mode {
+	RTE_SECURITY_IPSEC_TUNNEL_VERIFY_DEFAULT = 0,
+	/**< Verify only SPI */
+	RTE_SECURITY_IPSEC_TUNNEL_VERIFY_DST_ADDR,
+	/**< Verify SPI and destination IP address */
+	RTE_SECURITY_IPSEC_TUNNEL_VERIFY_SRC_DST_ADDR,
+	/**< Verify SPI, source and destination IP addresses */
+};
+
 /**
  * Security context for crypto/eth devices
  *
@@ -181,6 +195,9 @@  struct rte_security_ipsec_sa_options {
 	 * * 0: Disable per session security statistics collection for this SA.
 	 */
 	uint32_t stats : 1;
+
+	/** Verify tunnel header in inbound */
+	enum rte_security_ipsec_tunnel_verify_mode tunnel_hdr_verify;
 };
 
 /** IPSec security association direction */