diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2018-03-07 13:21:14 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2018-04-16 14:40:16 +0200 |
commit | d59c13af5ca0913f16eff966baaa01b1531f86e7 (patch) | |
tree | a31f413e9be31b70291f87bb0c6955533e683c37 /zebra/zebra_pbr.c | |
parent | zebra: handle entry pointfs for ipset creation/destruction (diff) | |
download | frr-d59c13af5ca0913f16eff966baaa01b1531f86e7.tar.xz frr-d59c13af5ca0913f16eff966baaa01b1531f86e7.zip |
lib: add ZEBRA IPSET defines
ZEBRA IPSET defines are added for creating/deleting ipset contexts.
Ans also create ipset hash sets.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'zebra/zebra_pbr.c')
-rw-r--r-- | zebra/zebra_pbr.c | 24 |
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; |