DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug
@ 2023-11-22  7:58 supeng2087
  2023-11-22  8:22 ` David Marchand
  2024-10-07 19:39 ` Stephen Hemminger
  0 siblings, 2 replies; 7+ messages in thread
From: supeng2087 @ 2023-11-22  7:58 UTC (permalink / raw)
  To: dev; +Cc: supeng

From: supeng <supeng@cmss.chinamobile.com>

Inbound direction, sad_lookup function will call cmp_sa_key to compare packet outer ip info with local sa.  Local sa src ip should equal packet dst ip,  Local sa dst ip should  equal src ip.
---
 examples/ipsec-secgw/sad.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sad.h b/examples/ipsec-secgw/sad.h
index 3224b6252c..e1fa8a26f6 100644
--- a/examples/ipsec-secgw/sad.h
+++ b/examples/ipsec-secgw/sad.h
@@ -33,12 +33,12 @@ cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
 	if ((sa_type == TRANSPORT) ||
 			/* IPv4 check */
 			(is_v4 && (sa_type == IP4_TUNNEL) &&
-			(sa->src.ip.ip4 == ipv4->src_addr) &&
-			(sa->dst.ip.ip4 == ipv4->dst_addr)) ||
+			(sa->src.ip.ip4 == ipv4->dst_addr) &&
+			(sa->dst.ip.ip4 == ipv4->src_addr)) ||
 			/* IPv6 check */
 			(!is_v4 && (sa_type == IP6_TUNNEL) &&
-			(!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
-			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
+			(!memcmp(sa->src.ip.ip6.ip6, ipv6->dst_addr, 16)) &&
+			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->src_addr, 16))))
 		return 1;
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug
@ 2023-11-22  7:11 supeng
  0 siblings, 0 replies; 7+ messages in thread
From: supeng @ 2023-11-22  7:11 UTC (permalink / raw)
  To: dev; +Cc: radu.nicolau, supeng

From: supeng <supeng@cmss.chinamobile.com>

Inbound direction, sad_lookup function will call cmp_sa_key to compare packet outer ip info with local sa.  Local sa src ip should equal packet dst ip,  Local sa dst ip should  equal src ip.
---
 examples/ipsec-secgw/sad.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sad.h b/examples/ipsec-secgw/sad.h
index 3224b6252c..e1fa8a26f6 100644
--- a/examples/ipsec-secgw/sad.h
+++ b/examples/ipsec-secgw/sad.h
@@ -33,12 +33,12 @@ cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
 	if ((sa_type == TRANSPORT) ||
 			/* IPv4 check */
 			(is_v4 && (sa_type == IP4_TUNNEL) &&
-			(sa->src.ip.ip4 == ipv4->src_addr) &&
-			(sa->dst.ip.ip4 == ipv4->dst_addr)) ||
+			(sa->src.ip.ip4 == ipv4->dst_addr) &&
+			(sa->dst.ip.ip4 == ipv4->src_addr)) ||
 			/* IPv6 check */
 			(!is_v4 && (sa_type == IP6_TUNNEL) &&
-			(!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
-			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
+			(!memcmp(sa->src.ip.ip6.ip6, ipv6->dst_addr, 16)) &&
+			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->src_addr, 16))))
 		return 1;
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug
@ 2023-11-22  6:57 supeng
  0 siblings, 0 replies; 7+ messages in thread
From: supeng @ 2023-11-22  6:57 UTC (permalink / raw)
  To: dev; +Cc: radu.nicolau, supeng

From: supeng <supeng@cmss.chinamobile.com>

Inbound direction, sad_lookup function will call cmp_sa_key to compare packet outer ip info with local sa.  Local sa src ip should equal packet dst ip,  Local sa dst ip should  equal src ip.
---
 examples/ipsec-secgw/sad.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sad.h b/examples/ipsec-secgw/sad.h
index 3224b6252c..e1fa8a26f6 100644
--- a/examples/ipsec-secgw/sad.h
+++ b/examples/ipsec-secgw/sad.h
@@ -33,12 +33,12 @@ cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
 	if ((sa_type == TRANSPORT) ||
 			/* IPv4 check */
 			(is_v4 && (sa_type == IP4_TUNNEL) &&
-			(sa->src.ip.ip4 == ipv4->src_addr) &&
-			(sa->dst.ip.ip4 == ipv4->dst_addr)) ||
+			(sa->src.ip.ip4 == ipv4->dst_addr) &&
+			(sa->dst.ip.ip4 == ipv4->src_addr)) ||
 			/* IPv6 check */
 			(!is_v4 && (sa_type == IP6_TUNNEL) &&
-			(!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
-			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
+			(!memcmp(sa->src.ip.ip6.ip6, ipv6->dst_addr, 16)) &&
+			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->src_addr, 16))))
 		return 1;
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug
@ 2023-11-22  6:51 supeng
  0 siblings, 0 replies; 7+ messages in thread
From: supeng @ 2023-11-22  6:51 UTC (permalink / raw)
  To: dev; +Cc: radu.nicolau, supeng

From: supeng <supeng@cmss.chinamobile.com>

Inbound direction, sad_lookup function will call cmp_sa_key to compare packet outer ip info with local sa.  Local sa src ip should equal packet dst ip,  Local sa dst ip should  equal src ip.
---
 examples/ipsec-secgw/sad.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sad.h b/examples/ipsec-secgw/sad.h
index 3224b6252c..e1fa8a26f6 100644
--- a/examples/ipsec-secgw/sad.h
+++ b/examples/ipsec-secgw/sad.h
@@ -33,12 +33,12 @@ cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
 	if ((sa_type == TRANSPORT) ||
 			/* IPv4 check */
 			(is_v4 && (sa_type == IP4_TUNNEL) &&
-			(sa->src.ip.ip4 == ipv4->src_addr) &&
-			(sa->dst.ip.ip4 == ipv4->dst_addr)) ||
+			(sa->src.ip.ip4 == ipv4->dst_addr) &&
+			(sa->dst.ip.ip4 == ipv4->src_addr)) ||
 			/* IPv6 check */
 			(!is_v4 && (sa_type == IP6_TUNNEL) &&
-			(!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
-			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
+			(!memcmp(sa->src.ip.ip6.ip6, ipv6->dst_addr, 16)) &&
+			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->src_addr, 16))))
 		return 1;
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug
@ 2023-11-22  6:49 supeng
  0 siblings, 0 replies; 7+ messages in thread
From: supeng @ 2023-11-22  6:49 UTC (permalink / raw)
  To: dev; +Cc: radu.nicolau, akhil.goyal, supeng

From: supeng <supeng@cmss.chinamobile.com>

Inbound direction, sad_lookup function will call cmp_sa_key to compare packet outer ip info with local sa.  Local sa src ip should equal packet dst ip,  Local sa dst ip should  equal src ip.
---
 examples/ipsec-secgw/sad.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/examples/ipsec-secgw/sad.h b/examples/ipsec-secgw/sad.h
index 3224b6252c..e1fa8a26f6 100644
--- a/examples/ipsec-secgw/sad.h
+++ b/examples/ipsec-secgw/sad.h
@@ -33,12 +33,12 @@ cmp_sa_key(struct ipsec_sa *sa, int is_v4, struct rte_ipv4_hdr *ipv4,
 	if ((sa_type == TRANSPORT) ||
 			/* IPv4 check */
 			(is_v4 && (sa_type == IP4_TUNNEL) &&
-			(sa->src.ip.ip4 == ipv4->src_addr) &&
-			(sa->dst.ip.ip4 == ipv4->dst_addr)) ||
+			(sa->src.ip.ip4 == ipv4->dst_addr) &&
+			(sa->dst.ip.ip4 == ipv4->src_addr)) ||
 			/* IPv6 check */
 			(!is_v4 && (sa_type == IP6_TUNNEL) &&
-			(!memcmp(sa->src.ip.ip6.ip6, ipv6->src_addr, 16)) &&
-			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->dst_addr, 16))))
+			(!memcmp(sa->src.ip.ip6.ip6, ipv6->dst_addr, 16)) &&
+			(!memcmp(sa->dst.ip.ip6.ip6, ipv6->src_addr, 16))))
 		return 1;
 
 	return 0;
-- 
2.34.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-10-07 19:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-22  7:58 [PATCH] examples/ipsec-secgw: fix cmp_sa_key bug supeng2087
2023-11-22  8:22 ` David Marchand
2024-10-07 19:39 ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2023-11-22  7:11 supeng
2023-11-22  6:57 supeng
2023-11-22  6:51 supeng
2023-11-22  6:49 supeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).