| 284 | } |
| 285 | |
| 286 | static int32_t |
| 287 | __test_lookup_invalid(int ipv6, union rte_ipsec_sad_key *tuple) |
| 288 | { |
| 289 | int status; |
| 290 | struct rte_ipsec_sad *sad = NULL; |
| 291 | struct rte_ipsec_sad_conf config; |
| 292 | const union rte_ipsec_sad_key *key_arr[] = {tuple}; |
| 293 | void *sa[1]; |
| 294 | |
| 295 | status = rte_ipsec_sad_lookup(NULL, key_arr, sa, 1); |
| 296 | RTE_TEST_ASSERT(status < 0, |
| 297 | "Call succeeded with invalid parameters\n"); |
| 298 | |
| 299 | config.max_sa[RTE_IPSEC_SAD_SPI_ONLY] = MAX_SA; |
| 300 | config.max_sa[RTE_IPSEC_SAD_SPI_DIP] = MAX_SA; |
| 301 | config.max_sa[RTE_IPSEC_SAD_SPI_DIP_SIP] = MAX_SA; |
| 302 | config.socket_id = SOCKET_ID_ANY; |
| 303 | config.flags = 0; |
| 304 | if (ipv6) |
| 305 | config.flags = RTE_IPSEC_SAD_FLAG_IPV6; |
| 306 | |
| 307 | sad = rte_ipsec_sad_create(__func__, &config); |
| 308 | RTE_TEST_ASSERT_NOT_NULL(sad, "Failed to create SAD\n"); |
| 309 | |
| 310 | status = rte_ipsec_sad_lookup(sad, NULL, sa, 1); |
| 311 | RTE_TEST_ASSERT(status < 0, |
| 312 | "Call succeeded with invalid parameters\n"); |
| 313 | |
| 314 | status = rte_ipsec_sad_lookup(sad, key_arr, NULL, 1); |
| 315 | RTE_TEST_ASSERT(status < 0, |
| 316 | "Call succeeded with invalid parameters\n"); |
| 317 | |
| 318 | rte_ipsec_sad_destroy(sad); |
| 319 | |
| 320 | return TEST_SUCCESS; |
| 321 | } |
| 322 | |
| 323 | /* |
| 324 | * Check that rte_ipsec_sad_lookup fails gracefully for incorrect user input |
no test coverage detected