security: allow application to specify UDP ports to PMD
diff mbox series

Message ID 20200903064206.16208-1-ktejasree@marvell.com
State Deferred
Delegated to: akhil goyal
Headers show
Series
  • security: allow application to specify UDP ports to PMD
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS

Commit Message

Tejasree Kondoj Sept. 3, 2020, 6:42 a.m. UTC
Add UDP source and destination ports in ipsec_xform to allow application
to specify ports to be used for IPsec UDP encapsulation as they are
dynamically changed by NAT in between. Also adding an extra flag to
indicate whether PMD needs to perform encapsulation header verification
in case of inbound. In case of inline IPsec implementation, verification
of outer IP headers and UDP encapsulation headers need to be handled
in the PMD. For lookaside IPsec, application can optionally offload
this to the PMD.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
---
 lib/librte_security/rte_security.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Akhil Goyal Sept. 10, 2020, 7:09 p.m. UTC | #1
Hi Tejasree,

> Add UDP source and destination ports in ipsec_xform to allow application
> to specify ports to be used for IPsec UDP encapsulation as they are
> dynamically changed by NAT in between. Also adding an extra flag to
> indicate whether PMD needs to perform encapsulation header verification
> in case of inbound. In case of inline IPsec implementation, verification
> of outer IP headers and UDP encapsulation headers need to be handled
> in the PMD. For lookaside IPsec, application can optionally offload
> this to the PMD.
> 
> Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> ---

I think we should add some usage of these newly added params 
- either in app/test or in examples/ipsec-secgw

Regards,
Akhil
Tejasree Kondoj Sept. 21, 2020, 9:13 a.m. UTC | #2
Hi Akhil,

Please see inline.

Thanks
Tejasree

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Friday, September 11, 2020 12:39 AM
> To: Tejasree Kondoj <ktejasree@marvell.com>; Radu Nicolau
> <radu.nicolau@intel.com>
> Cc: Narayana Prasad Raju Athreya <pathreya@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; dev@dpdk.org
> Subject: [EXT] RE: [PATCH] security: allow application to specify UDP ports to
> PMD
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi Tejasree,
> 
> > Add UDP source and destination ports in ipsec_xform to allow
> > application to specify ports to be used for IPsec UDP encapsulation as
> > they are dynamically changed by NAT in between. Also adding an extra
> > flag to indicate whether PMD needs to perform encapsulation header
> > verification in case of inbound. In case of inline IPsec
> > implementation, verification of outer IP headers and UDP encapsulation
> > headers need to be handled in the PMD. For lookaside IPsec,
> > application can optionally offload this to the PMD.
> >
> > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> > ---
> 
> I think we should add some usage of these newly added params
> - either in app/test or in examples/ipsec-secgw

[Tejasree] You mean adding test case in either of the above apps or addition of PMD implementation also? Also is the proposal sounds fine?

> 
> Regards,
> Akhil
Akhil Goyal Sept. 21, 2020, 9:30 a.m. UTC | #3
Hi Tejasree,

> > > Add UDP source and destination ports in ipsec_xform to allow
> > > application to specify ports to be used for IPsec UDP encapsulation as
> > > they are dynamically changed by NAT in between. Also adding an extra
> > > flag to indicate whether PMD needs to perform encapsulation header
> > > verification in case of inbound. In case of inline IPsec
> > > implementation, verification of outer IP headers and UDP encapsulation
> > > headers need to be handled in the PMD. For lookaside IPsec,
> > > application can optionally offload this to the PMD.
> > >
> > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> > > ---
> >
> > I think we should add some usage of these newly added params
> > - either in app/test or in examples/ipsec-secgw
> 
> [Tejasree] You mean adding test case in either of the above apps or addition of
> PMD implementation also? Also is the proposal sounds fine?
> 
I would say both, so that the newly added parameters are tested.
I am ok with the proposal with a minor comment,

We can have udp_src_port and udp_dst_port directly into rte_security_ipsec_xform
Instead of adding a new struct rte_security_ipsec_udp_encapsulation.

Regards,
Akhil
Tejasree Kondoj Sept. 21, 2020, 12:03 p.m. UTC | #4
Please see inline.

Thanks
Tejasree

> -----Original Message-----
> From: Akhil Goyal <akhil.goyal@nxp.com>
> Sent: Monday, September 21, 2020 3:01 PM
> To: Tejasree Kondoj <ktejasree@marvell.com>; Radu Nicolau
> <radu.nicolau@intel.com>
> Cc: Narayana Prasad Raju Athreya <pathreya@marvell.com>; Anoob Joseph
> <anoobj@marvell.com>; dev@dpdk.org
> Subject: [EXT] RE: [PATCH] security: allow application to specify UDP ports to
> PMD
> 
> External Email
> 
> ----------------------------------------------------------------------
> Hi Tejasree,
> 
> > > > Add UDP source and destination ports in ipsec_xform to allow
> > > > application to specify ports to be used for IPsec UDP
> > > > encapsulation as they are dynamically changed by NAT in between.
> > > > Also adding an extra flag to indicate whether PMD needs to perform
> > > > encapsulation header verification in case of inbound. In case of
> > > > inline IPsec implementation, verification of outer IP headers and
> > > > UDP encapsulation headers need to be handled in the PMD. For
> > > > lookaside IPsec, application can optionally offload this to the PMD.
> > > >
> > > > Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
> > > > ---
> > >
> > > I think we should add some usage of these newly added params
> > > - either in app/test or in examples/ipsec-secgw
> >
> > [Tejasree] You mean adding test case in either of the above apps or
> > addition of PMD implementation also? Also is the proposal sounds fine?
> >
> I would say both, so that the newly added parameters are tested.
> I am ok with the proposal with a minor comment,
> 
> We can have udp_src_port and udp_dst_port directly into
> rte_security_ipsec_xform Instead of adding a new struct
> rte_security_ipsec_udp_encapsulation.
 
[Tejasree] Okay. We'll defer the patch for now.
Will add usage of the params and address the comment later.

> 
> Regards,
> Akhil

Patch
diff mbox series

diff --git a/lib/librte_security/rte_security.h b/lib/librte_security/rte_security.h
index 16839e539..670bdeb6b 100644
--- a/lib/librte_security/rte_security.h
+++ b/lib/librte_security/rte_security.h
@@ -130,6 +130,13 @@  struct rte_security_ipsec_sa_options {
 	 */
 	uint32_t udp_encap : 1;
 
+	/** Verify tunnel header and UDP encapsulation ports in inbound
+	 *
+	 * * 1: Match outer header source, destination addresses and UDP ports
+	 * * 0: Do not match outer IP addresses and UDP ports
+	 */
+	uint32_t encap_hdr_verify : 1;
+
 	/** Copy DSCP bits
 	 *
 	 * * 1: Copy IPv4 or IPv6 DSCP bits from inner IP header to
@@ -190,6 +197,16 @@  enum rte_security_ipsec_sa_direction {
 	/**< Verify digest and decrypt */
 };
 
+/**
+ * UDP encapsulation ports
+ */
+struct rte_security_ipsec_udp_encapsulation {
+	uint16_t src_port;
+	/**< UDP source port */
+	uint16_t dst_port;
+	/**< UDP destination port */
+};
+
 /**
  * IPsec security association configuration data.
  *
@@ -216,6 +233,8 @@  struct rte_security_ipsec_xform {
 	/**< Anti replay window size to enable sequence replay attack handling.
 	 * replay checking is disabled if the window size is 0.
 	 */
+	struct rte_security_ipsec_udp_encapsulation udp_encap;
+	/**< UDP encapsulation ports */
 };
 
 /**