net/enic: fix VXLAN match
[dpdk.git] / examples / ipsec-secgw / sp6.c
index dc5b94c..e67d85a 100644 (file)
@@ -618,3 +618,28 @@ sp6_init(struct socket_ctx *ctx, int32_t socket_id)
                RTE_LOG(WARNING, IPSEC, "No IPv6 SP Outbound rule "
                        "specified\n");
 }
+
+/*
+ * Search though SP rules for given SPI.
+ */
+int
+sp6_spi_present(uint32_t spi, int inbound)
+{
+       uint32_t i, num;
+       const struct acl6_rules *acr;
+
+       if (inbound != 0) {
+               acr = acl6_rules_in;
+               num = nb_acl6_rules_in;
+       } else {
+               acr = acl6_rules_out;
+               num = nb_acl6_rules_out;
+       }
+
+       for (i = 0; i != num; i++) {
+               if (acr[i].data.userdata == PROTECT(spi))
+                       return i;
+       }
+
+       return -ENOENT;
+}