Skip to contentSkip to conversation

examples/ipsec-secgw: fix cmp_sa_key bug

PATCH In review supeng2087 3 participants 3 messages Nov 22, 2023 – Oct 7, 2024

lore
Share & tools
lore

supeng2087

author
#0 lore raw

PATCH 1/1 examples/ipsec-secgw: fix cmp_sa_key bug

From: supeng <[email protected]>

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(-)
examples/ipsec-secgw/sad.h +4 -4
index 3224b6252c..e1fa8a26f6 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw

Hello,

Quoted 4 lines · On Wed, Nov 22, 2023 at 9:18 AM supeng2087 <[email protected]> wrote:

From: supeng <[email protected]>

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.

Signature · 1 line
David Marchand
#2 lore raw
In reply to supeng2087
Quoted 6 lines · On Wed, 22 Nov 2023 15:58:40 +0800 supeng2087 <[email protected]> wrote:

From: supeng <[email protected]>

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(-)

Patch without Signed-off-by can not be accepted.

For explanation of Signed-off-by see:
https://en.wikipedia.org/wiki/Developer_Certificate_of_Origin