examples/ipsec-secgw: fix cmp_sa_key bug

Message ID 20231122075840.58703-1-supeng2087@aliyun.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Headers
Series examples/ipsec-secgw: fix cmp_sa_key bug |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS

Commit Message

supeng2087 Nov. 22, 2023, 7:58 a.m. UTC
  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(-)
  

Comments

David Marchand Nov. 22, 2023, 8:22 a.m. UTC | #1
Hello,

On Wed, Nov 22, 2023 at 9:18 AM supeng2087 <supeng2087@aliyun.com> wrote:
>
> 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.

No need to send 5 mails for the same patch.
All 5 were blocked, waiting in the moderation queue because you did
not register to the dev@ mailing list.

In the future, and before sending new revisions, please have a look at:
https://doc.dpdk.org/guides/contributing/patches.html


Thanks.
  

Patch

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;