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

Function check_spi_value

dpdk/examples/ipsec-secgw/sp4.c:521–552  ·  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

519 * check that for each rule it's SPI has a correspondent entry in SAD
520 */
521static int
522check_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
554void
555sp4_init(struct socket_ctx *ctx, int32_t socket_id)

Callers 1

sp4_initFunction · 0.70

Calls 1

sa_spi_presentFunction · 0.85

Tested by

no test coverage detected