* check that for each rule it's SPI has a correspondent entry in SAD */
| 519 | * check that for each rule it's SPI has a correspondent entry in SAD |
| 520 | */ |
| 521 | static int |
| 522 | check_spi_value(struct sa_ctx *sa_ctx, int inbound) |
| 523 | { |
| 524 | uint32_t i, num, spi; |
| 525 | int32_t spi_idx; |
| 526 | struct acl4_rules *acr; |
| 527 | |
| 528 | if (inbound != 0) { |
| 529 | acr = acl4_rules_in; |
| 530 | num = nb_acl4_rules_in; |
| 531 | } else { |
| 532 | acr = acl4_rules_out; |
| 533 | num = nb_acl4_rules_out; |
| 534 | } |
| 535 | |
| 536 | for (i = 0; i != num; i++) { |
| 537 | spi = acr[i].data.userdata; |
| 538 | if (spi != DISCARD && spi != BYPASS) { |
| 539 | spi_idx = sa_spi_present(sa_ctx, spi, inbound); |
| 540 | if (spi_idx < 0) { |
| 541 | RTE_LOG(ERR, IPSEC, |
| 542 | "SPI %u is not present in SAD\n", |
| 543 | spi); |
| 544 | return -ENOENT; |
| 545 | } |
| 546 | /* Update userdata with spi index */ |
| 547 | acr[i].data.userdata = spi_idx + 1; |
| 548 | } |
| 549 | } |
| 550 | |
| 551 | return 0; |
| 552 | } |
| 553 | |
| 554 | void |
| 555 | sp4_init(struct socket_ctx *ctx, int32_t socket_id) |
no test coverage detected