summaryrefslogtreecommitdiffstats
path: root/zebra/zebra_pbr.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/zebra_pbr.c')
-rw-r--r--zebra/zebra_pbr.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c
index 1855b5437..cec891b7f 100644
--- a/zebra/zebra_pbr.c
+++ b/zebra/zebra_pbr.c
@@ -283,6 +283,20 @@ static void *pbr_ipset_alloc_intern(void *arg)
return new;
}
+static struct zebra_pbr_ipset *zpi_found;
+
+static int zebra_pbr_ipset_pername_walkcb(struct hash_backet *backet, void *arg)
+{
+ struct zebra_pbr_ipset *zpi = (struct zebra_pbr_ipset *)backet->data;
+ char *ipset_name = (char *)arg;
+
+ if (!strncmp(ipset_name, zpi->ipset_name, ZEBRA_IPSET_NAME_SIZE)) {
+ zpi_found = zpi;
+ return HASHWALK_ABORT;
+ }
+ return HASHWALK_CONTINUE;
+}
+
void zebra_pbr_create_ipset(struct zebra_ns *zns,
struct zebra_pbr_ipset *ipset)
{
@@ -309,6 +323,16 @@ void zebra_pbr_destroy_ipset(struct zebra_ns *zns,
__PRETTY_FUNCTION__);
}
+struct zebra_pbr_ipset *zebra_pbr_lookup_ipset_pername(struct zebra_ns *zns,
+ char *ipsetname)
+{
+ if (!ipsetname)
+ return NULL;
+ zpi_found = NULL;
+ hash_walk(zns->ipset_hash, zebra_pbr_ipset_pername_walkcb, ipsetname);
+ return zpi_found;
+}
+
static void *pbr_ipset_entry_alloc_intern(void *arg)
{
struct zebra_pbr_ipset_entry *zpi;