summaryrefslogtreecommitdiff
path: root/lib/if_rmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if_rmap.c')
-rw-r--r--lib/if_rmap.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 42d01c8731..8e58d23e28 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -27,6 +27,7 @@
#include "if_rmap.h"
DEFINE_MTYPE_STATIC(LIB, IF_RMAP_CTX, "Interface route map container")
+DEFINE_MTYPE_STATIC(LIB, IF_RMAP_CTX_NAME, "Interface route map container name")
DEFINE_MTYPE_STATIC(LIB, IF_RMAP, "Interface route map")
DEFINE_MTYPE_STATIC(LIB, IF_RMAP_NAME, "I.f. route map name")
@@ -300,15 +301,20 @@ int config_write_if_rmap(struct vty *vty,
void if_rmap_ctx_delete(struct if_rmap_ctx *ctx)
{
hash_clean(ctx->ifrmaphash, (void (*)(void *))if_rmap_free);
+ if (ctx->name)
+ XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx);
XFREE(MTYPE_IF_RMAP_CTX, ctx);
}
-struct if_rmap_ctx *if_rmap_ctx_create(struct vrf *vrf)
+/* name is optional: either vrf name, or other */
+struct if_rmap_ctx *if_rmap_ctx_create(const char *name)
{
struct if_rmap_ctx *ctx;
ctx = XCALLOC(MTYPE_IF_RMAP_CTX, sizeof(struct if_rmap_ctx));
- ctx->vrf = vrf;
+
+ if (ctx->name)
+ ctx->name = XSTRDUP(MTYPE_IF_RMAP_CTX_NAME, name);
ctx->ifrmaphash = hash_create_size(4, if_rmap_hash_make, if_rmap_hash_cmp,
"Interface Route-Map Hash");
if (!if_rmap_ctx_list)