aboutsummaryrefslogtreecommitdiff
path: root/test/validation/api
diff options
context:
space:
mode:
authorJanne Peltonen <janne.peltonen@nokia.com>2021-03-27 11:58:39 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2021-04-01 15:02:59 +0300
commit7fa8b1953c89c762ad0afd9d5dafda755f6e10cb (patch)
tree5e7615c6db919b90735b78dbbeecd0db8a785490 /test/validation/api
parent6fba5c596f501455fb9f3704bdb612e7c91ce384 (diff)
validation: ipsec: use ipsec_test_part for one operation only
Clean up the code by using ipsec_test_part for one IPsec operation only so that the outbound and inbound phases of combined out+in tests become separate. One ipsec_test_part will contain single input packet to an (outbound or inbound) IPsec operation and the expected output. This makes the code clearer and brings it closer to the original design. Signed-off-by: Janne Peltonen <janne.peltonen@nokia.com> Reviewed-by: Anoob Joseph <anoobj@marvell.com>
Diffstat (limited to 'test/validation/api')
-rw-r--r--test/validation/api/ipsec/ipsec.c24
-rw-r--r--test/validation/api/ipsec/ipsec.h12
-rw-r--r--test/validation/api/ipsec/ipsec_test_in.c120
-rw-r--r--test/validation/api/ipsec/ipsec_test_out.c95
4 files changed, 127 insertions, 124 deletions
diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index 2caf90b32..4acdc55b3 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -575,7 +575,7 @@ static int ipsec_send_in_one(const ipsec_test_part *part,
odp_event_types(ev, &subtype));
CU_ASSERT_EQUAL(ODP_EVENT_PACKET_BASIC,
subtype);
- CU_ASSERT(part->in[i].status.error.sa_lookup);
+ CU_ASSERT(part->out[i].status.error.sa_lookup);
pkto[i++] = odp_ipsec_packet_from_event(ev);
continue;
@@ -588,7 +588,7 @@ static int ipsec_send_in_one(const ipsec_test_part *part,
odp_event_types(ev, &subtype));
CU_ASSERT_EQUAL(ODP_EVENT_PACKET_IPSEC,
subtype);
- CU_ASSERT(!part->in[i].status.error.sa_lookup);
+ CU_ASSERT(!part->out[i].status.error.sa_lookup);
pkto[i] = odp_ipsec_packet_from_event(ev);
CU_ASSERT(odp_packet_subtype(pkto[i]) ==
@@ -844,13 +844,13 @@ void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
if (ODP_EVENT_PACKET_IPSEC !=
odp_event_subtype(odp_packet_to_event(pkto[i]))) {
/* Inline packet went through loop */
- CU_ASSERT_EQUAL(1, part->in[i].status.error.sa_lookup);
+ CU_ASSERT_EQUAL(1, part->out[i].status.error.sa_lookup);
} else {
CU_ASSERT_EQUAL(0, odp_ipsec_result(&result, pkto[i]));
- CU_ASSERT_EQUAL(part->in[i].status.error.all,
+ CU_ASSERT_EQUAL(part->out[i].status.error.all,
result.status.error.all);
- if (part->in[i].status.error.all != 0) {
+ if (part->out[i].status.error.all != 0) {
odp_packet_free(pkto[i]);
return;
}
@@ -866,16 +866,16 @@ void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
CU_ASSERT_EQUAL(IPSEC_SA_CTX,
odp_ipsec_sa_context(sa));
}
- ipsec_check_packet(part->in[i].pkt_res,
+ ipsec_check_packet(part->out[i].pkt_res,
pkto[i],
false);
- if (part->in[i].pkt_res != NULL &&
- part->in[i].l3_type != _ODP_PROTO_L3_TYPE_UNDEF)
- CU_ASSERT_EQUAL(part->in[i].l3_type,
+ if (part->out[i].pkt_res != NULL &&
+ part->out[i].l3_type != _ODP_PROTO_L3_TYPE_UNDEF)
+ CU_ASSERT_EQUAL(part->out[i].l3_type,
odp_packet_l3_type(pkto[i]));
- if (part->in[i].pkt_res != NULL &&
- part->in[i].l4_type != _ODP_PROTO_L4_TYPE_UNDEF)
- CU_ASSERT_EQUAL(part->in[i].l4_type,
+ if (part->out[i].pkt_res != NULL &&
+ part->out[i].l4_type != _ODP_PROTO_L4_TYPE_UNDEF)
+ CU_ASSERT_EQUAL(part->out[i].l4_type,
odp_packet_l4_type(pkto[i]));
odp_packet_free(pkto[i]);
}
diff --git a/test/validation/api/ipsec/ipsec.h b/test/validation/api/ipsec/ipsec.h
index eefdf4fe0..b9259ad00 100644
--- a/test/validation/api/ipsec/ipsec.h
+++ b/test/validation/api/ipsec/ipsec.h
@@ -70,10 +70,14 @@ typedef struct {
} ipsec_test_flags;
typedef struct {
- const ipsec_test_packet *pkt_in;
ipsec_test_flags flags;
+
+ /* Input for the inbound or outbound IPsec operation */
+ const ipsec_test_packet *pkt_in;
int num_opt;
odp_ipsec_out_opt_t opt;
+
+ /* Expected output */
int num_pkt;
struct {
odp_ipsec_op_status_t status;
@@ -82,12 +86,6 @@ typedef struct {
odp_proto_l4_type_t l4_type;
uint32_t seq_num;
} out[1];
- struct {
- odp_ipsec_op_status_t status;
- const ipsec_test_packet *pkt_res;
- odp_proto_l3_type_t l3_type;
- odp_proto_l4_type_t l4_type;
- } in[1];
} ipsec_test_part;
void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c
index f31f77244..0e9125664 100644
--- a/test/validation/api/ipsec/ipsec_test_in.c
+++ b/test/validation/api/ipsec/ipsec_test_in.c
@@ -27,7 +27,7 @@ static void test_in_ipv4_ah_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -62,7 +62,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv4(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_tun_ipv4_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -97,7 +97,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv6(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_tun_ipv6_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -129,7 +129,7 @@ static void test_in_ipv4_ah_sha256_tun_ipv4_notun(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_tun_ipv4_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -162,7 +162,7 @@ static void test_in_ipv4_esp_null_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -194,7 +194,7 @@ static void test_in_ipv4_esp_aes_cbc_null(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_cbc_null_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -226,7 +226,7 @@ static void test_in_ipv4_esp_aes_cbc_sha1(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_cbc_sha1_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -258,7 +258,7 @@ static void test_in_ipv4_esp_aes_cbc_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_cbc_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -290,7 +290,7 @@ static void test_in_ipv4_esp_aes_cbc_sha384(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_cbc_sha384_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -322,7 +322,7 @@ static void test_in_ipv4_esp_aes_cbc_sha512(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_cbc_sha512_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -354,7 +354,7 @@ static void test_in_ipv4_esp_aes_ctr_null(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_aes_ctr_null_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -389,7 +389,7 @@ static void test_in_ipv4_ah_sha256_lookup(void)
.lookup = 1,
},
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -424,7 +424,7 @@ static void test_in_ipv4_esp_null_sha256_lookup(void)
.lookup = 1,
},
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -459,7 +459,7 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv4(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_tun_ipv4_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -494,7 +494,7 @@ static void test_in_ipv4_esp_null_sha256_tun_ipv6(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_tun_ipv6_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -527,7 +527,7 @@ static void test_in_ipv4_esp_udp_null_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_udp_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -563,7 +563,7 @@ static void test_in_ipv4_esp_udp_null_sha256_lookup(void)
.lookup = 1,
},
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -596,7 +596,7 @@ static void test_in_ipv4_ah_sha256_noreplay(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -608,7 +608,7 @@ static void test_in_ipv4_ah_sha256_noreplay(void)
ipsec_test_part test_1235 = {
.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1235,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -647,7 +647,7 @@ static void test_in_ipv4_ah_sha256_replay(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -658,12 +658,12 @@ static void test_in_ipv4_ah_sha256_replay(void)
test_repl.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1;
test_repl.num_pkt = 1;
- test_repl.in[0].status.error.antireplay = 1;
+ test_repl.out[0].status.error.antireplay = 1;
ipsec_test_part test_1235 = {
.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1235,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -699,7 +699,7 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -711,7 +711,7 @@ static void test_in_ipv4_esp_null_sha256_noreplay(void)
ipsec_test_part test_1235 = {
.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1235,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -757,18 +757,11 @@ static void test_in_ipv4_esp_null_sha256_replay(void)
.l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
.pkt_res = &pkt_ipv4_icmp_0 },
},
- .in = {
- { .status.warn.all = 0,
- .status.error.all = 0,
- .l3_type = ODP_PROTO_L3_TYPE_IPV4,
- .l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
- .pkt_res = &pkt_ipv4_icmp_0 },
- },
};
test_repl.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1;
test_repl.num_pkt = 1;
- test_repl.in[0].status.error.antireplay = 1;
+ test_repl.out[0].status.error.antireplay = 1;
ipsec_test_part test_1235 = {
.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1235,
@@ -780,13 +773,6 @@ static void test_in_ipv4_esp_null_sha256_replay(void)
.l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
.pkt_res = &pkt_ipv4_icmp_0 },
},
- .in = {
- { .status.warn.all = 0,
- .status.error.all = 0,
- .l3_type = ODP_PROTO_L3_TYPE_IPV4,
- .l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
- .pkt_res = &pkt_ipv4_icmp_0 },
- },
};
ipsec_check_in_one(&test, sa);
@@ -822,7 +808,7 @@ static void test_in_ipv4_ah_esp_pkt(void)
test.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1;
test.num_pkt = 1;
- test.in[0].status.error.proto = 1;
+ test.out[0].status.error.proto = 1;
ipsec_check_in_one(&test, sa);
@@ -854,7 +840,7 @@ static void test_in_ipv4_esp_ah_pkt(void)
test.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1;
test.num_pkt = 1;
- test.in[0].status.error.proto = 1;
+ test.out[0].status.error.proto = 1;
ipsec_check_in_one(&test, sa);
@@ -882,7 +868,7 @@ static void test_in_ipv4_ah_esp_pkt_lookup(void)
test.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1;
test.flags.lookup = 1;
test.num_pkt = 1;
- test.in[0].status.error.sa_lookup = 1;
+ test.out[0].status.error.sa_lookup = 1;
ipsec_check_in_one(&test, ODP_IPSEC_SA_INVALID);
@@ -910,7 +896,7 @@ static void test_in_ipv4_esp_ah_pkt_lookup(void)
test.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1;
test.flags.lookup = 1;
test.num_pkt = 1;
- test.in[0].status.error.sa_lookup = 1;
+ test.out[0].status.error.sa_lookup = 1;
ipsec_check_in_one(&test, ODP_IPSEC_SA_INVALID);
@@ -937,7 +923,7 @@ static void test_in_ipv4_ah_sha256_bad1(void)
test.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1_bad1;
test.num_pkt = 1;
- test.in[0].status.error.auth = 1;
+ test.out[0].status.error.auth = 1;
ipsec_check_in_one(&test, sa);
@@ -964,7 +950,7 @@ static void test_in_ipv4_ah_sha256_bad2(void)
test.pkt_in = &pkt_ipv4_icmp_0_ah_sha256_1_bad2;
test.num_pkt = 1;
- test.in[0].status.error.auth = 1;
+ test.out[0].status.error.auth = 1;
ipsec_check_in_one(&test, sa);
@@ -991,7 +977,7 @@ static void test_in_ipv4_esp_null_sha256_bad1(void)
test.pkt_in = &pkt_ipv4_icmp_0_esp_null_sha256_1_bad1;
test.num_pkt = 1;
- test.in[0].status.error.auth = 1;
+ test.out[0].status.error.auth = 1;
ipsec_check_in_one(&test, sa);
@@ -1016,7 +1002,7 @@ static void test_in_ipv4_rfc3602_5_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_rfc3602_5_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1048,7 +1034,7 @@ static void test_in_ipv4_rfc3602_6_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_rfc3602_6_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1083,7 +1069,7 @@ static void test_in_ipv4_rfc3602_7_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_rfc3602_7_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1118,7 +1104,7 @@ static void test_in_ipv4_rfc3602_8_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_rfc3602_8_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1153,7 +1139,7 @@ static void test_in_ipv4_mcgrew_gcm_2_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_2_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1188,7 +1174,7 @@ static void test_in_ipv4_mcgrew_gcm_3_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_3_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1223,7 +1209,7 @@ static void test_in_ipv4_mcgrew_gcm_4_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_4_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1263,7 +1249,7 @@ static void test_in_ipv4_mcgrew_gcm_12_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_12_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_NONE,
@@ -1295,7 +1281,7 @@ static void test_in_ipv4_mcgrew_gcm_12_esp_notun(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_12_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1330,7 +1316,7 @@ static void test_in_ipv4_mcgrew_gcm_15_esp(void)
ipsec_test_part test = {
.pkt_in = &pkt_mcgrew_gcm_test_15_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1365,7 +1351,7 @@ static void test_in_ipv4_rfc7634_chacha(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_rfc7634_esp,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1397,7 +1383,7 @@ static void test_in_ipv4_ah_aes_gmac_128(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_ah_aes_gmac_128_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1429,7 +1415,7 @@ static void test_in_ipv4_esp_null_aes_gmac_128(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv4_icmp_0_esp_null_aes_gmac_128_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1461,7 +1447,7 @@ static void test_in_ipv6_ah_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_ah_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1496,7 +1482,7 @@ static void test_in_ipv6_ah_sha256_tun_ipv4(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_ah_tun_ipv4_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1531,7 +1517,7 @@ static void test_in_ipv6_ah_sha256_tun_ipv6(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_ah_tun_ipv6_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1563,7 +1549,7 @@ static void test_in_ipv6_esp_null_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_esp_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1598,7 +1584,7 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv4(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_esp_tun_ipv4_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1633,7 +1619,7 @@ static void test_in_ipv6_esp_null_sha256_tun_ipv6(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_esp_tun_ipv6_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1666,7 +1652,7 @@ static void test_in_ipv6_esp_udp_null_sha256(void)
ipsec_test_part test = {
.pkt_in = &pkt_ipv6_icmp_0_esp_udp_null_sha256_1,
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
@@ -1702,7 +1688,7 @@ static void test_in_ipv6_esp_udp_null_sha256_lookup(void)
.lookup = 1,
},
.num_pkt = 1,
- .in = {
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV6,
diff --git a/test/validation/api/ipsec/ipsec_test_out.c b/test/validation/api/ipsec/ipsec_test_out.c
index d3275e417..92f6566ac 100644
--- a/test/validation/api/ipsec/ipsec_test_out.c
+++ b/test/validation/api/ipsec/ipsec_test_out.c
@@ -417,27 +417,28 @@ static void ipsec_pkt_auth_err_set(odp_packet_t pkt)
odp_packet_copy_from_mem(pkt, len - sizeof(data), sizeof(data), &data);
}
-static void ipsec_check_out_in_one(const ipsec_test_part *part,
+static void ipsec_check_out_in_one(const ipsec_test_part *part_outbound,
+ const ipsec_test_part *part_inbound,
odp_ipsec_sa_t sa,
odp_ipsec_sa_t sa_in)
{
- int num_out = part->num_pkt;
+ int num_out = part_outbound->num_pkt;
odp_packet_t pkto[num_out];
int i;
- num_out = ipsec_check_out(part, sa, pkto);
+ num_out = ipsec_check_out(part_outbound, sa, pkto);
for (i = 0; i < num_out; i++) {
- ipsec_test_part part_in = *part;
+ ipsec_test_part part_in = *part_inbound;
ipsec_test_packet pkt_in;
CU_ASSERT_FATAL(odp_packet_len(pkto[i]) <=
sizeof(pkt_in.data));
- if (part->flags.stats == IPSEC_TEST_STATS_PROTO_ERR)
+ if (part_outbound->flags.stats == IPSEC_TEST_STATS_PROTO_ERR)
ipsec_pkt_proto_err_set(pkto[i]);
- if (part->flags.stats == IPSEC_TEST_STATS_AUTH_ERR)
+ if (part_outbound->flags.stats == IPSEC_TEST_STATS_AUTH_ERR)
ipsec_pkt_auth_err_set(pkto[i]);
pkt_in.len = odp_packet_len(pkto[i]);
@@ -529,7 +530,7 @@ static void test_out_in_common(ipsec_test_flags *flags,
CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa_in);
- ipsec_test_part test = {
+ ipsec_test_part test_out = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_pkt = 1,
.out = {
@@ -539,7 +540,10 @@ static void test_out_in_common(ipsec_test_flags *flags,
.l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
},
},
- .in = {
+ };
+ ipsec_test_part test_in = {
+ .num_pkt = 1,
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -549,20 +553,19 @@ static void test_out_in_common(ipsec_test_flags *flags,
};
if (flags->v6) {
- test.pkt_in = &pkt_ipv6_icmp_0;
- test.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV6;
- test.out[0].l4_type = ODP_PROTO_L4_TYPE_ICMPV6;
- test.in[0].l3_type = ODP_PROTO_L3_TYPE_IPV6;
- test.in[0].l4_type = ODP_PROTO_L4_TYPE_ICMPV6;
- test.in[0].pkt_res = &pkt_ipv6_icmp_0;
+ test_out.pkt_in = &pkt_ipv6_icmp_0;
+ test_in.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV6;
+ test_in.out[0].l4_type = ODP_PROTO_L4_TYPE_ICMPV6;
+ test_in.out[0].pkt_res = &pkt_ipv6_icmp_0;
}
- test.flags = *flags;
+ test_out.flags = *flags;
+ test_in.flags = *flags;
if (flags->stats == IPSEC_TEST_STATS_PROTO_ERR)
- test.in[0].status.error.proto = 1;
+ test_in.out[0].status.error.proto = 1;
if (flags->stats == IPSEC_TEST_STATS_AUTH_ERR)
- test.in[0].status.error.auth = 1;
+ test_in.out[0].status.error.auth = 1;
if (flags->stats != IPSEC_TEST_STATS_NONE) {
CU_ASSERT_EQUAL(odp_ipsec_stats(sa_out, &stats), 0);
@@ -574,19 +577,20 @@ static void test_out_in_common(ipsec_test_flags *flags,
if (flags->test_sa_seq_num) {
int rc;
- test.out[0].seq_num = 0x1235;
- rc = ipsec_test_sa_update_seq_num(sa_out, test.out[0].seq_num);
+ test_out.out[0].seq_num = 0x1235;
+ rc = ipsec_test_sa_update_seq_num(sa_out,
+ test_out.out[0].seq_num);
/* Skip further checks related to this specific test if the
* SA update call was not successful.
*/
if (rc < 0) {
printf("\t >> skipped");
- test.flags.test_sa_seq_num = false;
+ test_out.flags.test_sa_seq_num = false;
}
}
- ipsec_check_out_in_one(&test, sa_out, sa_in);
+ ipsec_check_out_in_one(&test_out, &test_in, sa_out, sa_in);
if (flags->stats == IPSEC_TEST_STATS_SUCCESS) {
CU_ASSERT_EQUAL(odp_ipsec_stats(sa_in, &stats), 0);
@@ -1203,9 +1207,11 @@ static void test_out_dummy_esp_null_sha256_tun(odp_ipsec_tunnel_param_t tunnel)
odp_ipsec_sa_t sa;
odp_ipsec_sa_t sa2;
ipsec_test_part test;
+ ipsec_test_part test_in;
ipsec_test_part test_empty;
memset(&test, 0, sizeof(ipsec_test_part));
+ memset(&test_in, 0, sizeof(ipsec_test_part));
memset(&test_empty, 0, sizeof(ipsec_test_part));
/* This test will not work properly in inbound inline mode.
@@ -1235,22 +1241,22 @@ static void test_out_dummy_esp_null_sha256_tun(odp_ipsec_tunnel_param_t tunnel)
test.pkt_in = &pkt_test_nodata;
test.num_opt = 1;
- test.opt .flag.tfc_dummy = 1;
+ test.opt.flag.tfc_dummy = 1;
test.opt.tfc_pad_len = 16;
test.num_pkt = 1;
- test.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV4;
- test.out[0].l4_type = ODP_PROTO_L4_TYPE_NO_NEXT;
+
+ test_in.num_pkt = 1;
+ test_in.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV4;
+ test_in.out[0].l4_type = ODP_PROTO_L4_TYPE_NO_NEXT;
test_empty.pkt_in = &pkt_test_empty;
test_empty.num_opt = 1;
test_empty.opt.flag.tfc_dummy = 1;
test_empty.opt.tfc_pad_len = 16;
test_empty.num_pkt = 1;
- test_empty.out[0].l3_type = ODP_PROTO_L3_TYPE_IPV4;
- test_empty.out[0].l4_type = ODP_PROTO_L4_TYPE_NO_NEXT;
- ipsec_check_out_in_one(&test, sa, sa2);
- ipsec_check_out_in_one(&test_empty, sa, sa2);
+ ipsec_check_out_in_one(&test, &test_in, sa, sa2);
+ ipsec_check_out_in_one(&test_empty, &test_in, sa, sa2);
ipsec_sa_destroy(sa2);
ipsec_sa_destroy(sa);
@@ -1418,7 +1424,7 @@ static void test_sa_info(void)
CU_ASSERT_EQUAL_FATAL(0, odp_ipsec_sa_info(sa_in, &info_in));
CU_ASSERT_EQUAL(0, info_in.inbound.antireplay_window_top);
- ipsec_test_part test = {
+ ipsec_test_part test_out = {
.pkt_in = &pkt_ipv4_icmp_0,
.num_pkt = 1,
.out = {
@@ -1429,8 +1435,18 @@ static void test_sa_info(void)
},
},
};
+ ipsec_test_part test_in = {
+ .num_pkt = 1,
+ .out = {
+ { .status.warn.all = 0,
+ .status.error.all = 0,
+ .l3_type = ODP_PROTO_L3_TYPE_IPV4,
+ .l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
+ },
+ },
+ };
- ipsec_check_out_in_one(&test, sa_out, sa_in);
+ ipsec_check_out_in_one(&test_out, &test_in, sa_out, sa_in);
memset(&info_out, 0, sizeof(info_out));
CU_ASSERT_EQUAL_FATAL(0, odp_ipsec_sa_info(sa_out, &info_out));
@@ -1621,12 +1637,8 @@ static void test_max_num_sa(void)
odp_ipsec_sa_param_t param;
const uint32_t spi_start = 256;
odp_ipsec_sa_t sa_odd = ODP_IPSEC_SA_INVALID;
- ipsec_test_part test = {
+ ipsec_test_part test_out = {
.pkt_in = &pkt_ipv4_icmp_0,
- .flags = {
- /* Test lookup now that we have lots of SAs */
- .lookup = 1,
- },
.num_pkt = 1,
.out = {
{ .status.warn.all = 0,
@@ -1635,7 +1647,14 @@ static void test_max_num_sa(void)
.l4_type = ODP_PROTO_L4_TYPE_ICMPV4,
},
},
- .in = {
+ };
+ ipsec_test_part test_in = {
+ .flags = {
+ /* Test lookup now that we have lots of SAs */
+ .lookup = 1,
+ },
+ .num_pkt = 1,
+ .out = {
{ .status.warn.all = 0,
.status.error.all = 0,
.l3_type = ODP_PROTO_L3_TYPE_IPV4,
@@ -1706,11 +1725,11 @@ static void test_max_num_sa(void)
sa_odd = odp_ipsec_sa_create(&param);
CU_ASSERT_FATAL(sa_odd != ODP_IPSEC_SA_INVALID);
- ipsec_check_out_in_one(&test, sa_odd, sa_in[n]);
+ ipsec_check_out_in_one(&test_out, &test_in, sa_odd, sa_in[n]);
}
for (n = 0; n < sa_pairs; n++)
- ipsec_check_out_in_one(&test, sa_out[n], sa_in[n]);
+ ipsec_check_out_in_one(&test_out, &test_in, sa_out[n], sa_in[n]);
for (n = 0; n < sa_pairs; n++) {
ipsec_sa_destroy(sa_out[n]);