| 552 | } |
| 553 | |
| 554 | void |
| 555 | sp4_init(struct socket_ctx *ctx, int32_t socket_id) |
| 556 | { |
| 557 | const char *name; |
| 558 | |
| 559 | if (ctx == NULL) |
| 560 | rte_exit(EXIT_FAILURE, "NULL context.\n"); |
| 561 | |
| 562 | if (ctx->sp_ip4_in != NULL) |
| 563 | rte_exit(EXIT_FAILURE, "Inbound SP DB for socket %u already " |
| 564 | "initialized\n", socket_id); |
| 565 | |
| 566 | if (ctx->sp_ip4_out != NULL) |
| 567 | rte_exit(EXIT_FAILURE, "Outbound SP DB for socket %u already " |
| 568 | "initialized\n", socket_id); |
| 569 | |
| 570 | if (check_spi_value(ctx->sa_in, 1) < 0) |
| 571 | rte_exit(EXIT_FAILURE, |
| 572 | "Inbound IPv4 SP DB has unmatched in SAD SPIs\n"); |
| 573 | |
| 574 | if (check_spi_value(ctx->sa_out, 0) < 0) |
| 575 | rte_exit(EXIT_FAILURE, |
| 576 | "Outbound IPv4 SP DB has unmatched in SAD SPIs\n"); |
| 577 | |
| 578 | if (nb_acl4_rules_in > 0) { |
| 579 | name = "sp_ip4_in"; |
| 580 | ctx->sp_ip4_in = (struct sp_ctx *)acl4_init(name, |
| 581 | socket_id, acl4_rules_in, nb_acl4_rules_in); |
| 582 | } else |
| 583 | RTE_LOG(WARNING, IPSEC, "No IPv4 SP Inbound rule " |
| 584 | "specified\n"); |
| 585 | |
| 586 | if (nb_acl4_rules_out > 0) { |
| 587 | name = "sp_ip4_out"; |
| 588 | ctx->sp_ip4_out = (struct sp_ctx *)acl4_init(name, |
| 589 | socket_id, acl4_rules_out, nb_acl4_rules_out); |
| 590 | } else |
| 591 | RTE_LOG(WARNING, IPSEC, "No IPv4 SP Outbound rule " |
| 592 | "specified\n"); |
| 593 | } |
| 594 | |
| 595 | static int |
| 596 | sp_cmp(const void *p, const void *q) |
no test coverage detected