MCPcopy Create free account
hub / github.com/F-Stack/f-stack / check_spi_value

Function check_spi_value

dpdk/examples/ipsec-secgw/sp6.c:652–683  ·  view source on GitHub ↗

* check that for each rule it's SPI has a correspondent entry in SAD */

Source from the content-addressed store, hash-verified

650 * check that for each rule it's SPI has a correspondent entry in SAD
651 */
652static int
653check_spi_value(struct sa_ctx *sa_ctx, int inbound)
654{
655 uint32_t i, num, spi;
656 int32_t spi_idx;
657 struct acl6_rules *acr;
658
659 if (inbound != 0) {
660 acr = acl6_rules_in;
661 num = nb_acl6_rules_in;
662 } else {
663 acr = acl6_rules_out;
664 num = nb_acl6_rules_out;
665 }
666
667 for (i = 0; i != num; i++) {
668 spi = acr[i].data.userdata;
669 if (spi != DISCARD && spi != BYPASS) {
670 spi_idx = sa_spi_present(sa_ctx, spi, inbound);
671 if (spi_idx < 0) {
672 RTE_LOG(ERR, IPSEC,
673 "SPI %u is not present in SAD\n",
674 spi);
675 return -ENOENT;
676 }
677 /* Update userdata with spi index */
678 acr[i].data.userdata = spi_idx + 1;
679 }
680 }
681
682 return 0;
683}
684
685void
686sp6_init(struct socket_ctx *ctx, int32_t socket_id)

Callers 1

sp6_initFunction · 0.70

Calls 1

sa_spi_presentFunction · 0.85

Tested by

no test coverage detected