diff options
Diffstat (limited to 'lib/if_rmap.c')
| -rw-r--r-- | lib/if_rmap.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c index fa8899e9f8..0d305a7af1 100644 --- a/lib/if_rmap.c +++ b/lib/if_rmap.c @@ -10,6 +10,7 @@ #include "memory.h" #include "if.h" #include "if_rmap.h" +#include "ripd/ripd.h" DEFINE_MTYPE_STATIC(LIB, IF_RMAP_CTX, "Interface route map container"); DEFINE_MTYPE_STATIC(LIB, IF_RMAP_CTX_NAME, @@ -186,8 +187,13 @@ DEFUN (if_rmap, int idx_in_out = 2; int idx_ifname = 3; enum if_rmap_type type; - struct if_rmap_ctx *ctx = - (struct if_rmap_ctx *)listnode_head(if_rmap_ctx_list); + struct if_rmap_ctx *ctx; + const struct lyd_node *dnode; + struct rip *rip; + + dnode = yang_dnode_get(running_config->dnode, VTY_CURR_XPATH); + rip = nb_running_get_entry(dnode, NULL, true); + ctx = rip->if_rmap_ctx; if (strncmp(argv[idx_in_out]->text, "in", 1) == 0) type = IF_RMAP_IN; @@ -276,9 +282,9 @@ int config_write_if_rmap(struct vty *vty, void if_rmap_ctx_delete(struct if_rmap_ctx *ctx) { listnode_delete(if_rmap_ctx_list, ctx); - hash_clean(ctx->ifrmaphash, (void (*)(void *))if_rmap_free); + hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free); if (ctx->name) - XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx); + XFREE(MTYPE_IF_RMAP_CTX_NAME, ctx->name); XFREE(MTYPE_IF_RMAP_CTX, ctx); } @@ -289,8 +295,7 @@ struct if_rmap_ctx *if_rmap_ctx_create(const char *name) ctx = XCALLOC(MTYPE_IF_RMAP_CTX, sizeof(struct if_rmap_ctx)); - if (ctx->name) - ctx->name = XSTRDUP(MTYPE_IF_RMAP_CTX_NAME, 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) |
