diff options
author | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-19 21:08:43 +0100 |
---|---|---|
committer | Philippe Guibert <philippe.guibert@6wind.com> | 2019-02-19 21:11:37 +0100 |
commit | aec0d756677e52e86ef9b22fe2d85bbe8f0039e5 (patch) | |
tree | 960bb8e8e1aa69d564c3baa49f4b8beb1de746c3 /lib | |
parent | lib, rip, ripng, eigrp: rework if_rmap context (diff) | |
download | frr-aec0d756677e52e86ef9b22fe2d85bbe8f0039e5.tar.xz frr-aec0d756677e52e86ef9b22fe2d85bbe8f0039e5.zip |
eigrp, rip, ripng, lib: unlink if_rmap from vrf
an interface rmap context can be created from a custom name string,
instead of a vrf. This ability permits to handle several instances of
interface route map in the same vrf. The naming convention will be
transparent on what the name is for in the daemon code.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/if_rmap.c | 10 | ||||
-rw-r--r-- | lib/if_rmap.h | 6 |
2 files changed, 11 insertions, 5 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c index 42d01c873..8e58d23e2 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) diff --git a/lib/if_rmap.h b/lib/if_rmap.h index 21ac35fe1..dfc729882 100644 --- a/lib/if_rmap.h +++ b/lib/if_rmap.h @@ -44,11 +44,11 @@ struct if_rmap_ctx { void (*if_rmap_delete_hook)(struct if_rmap_ctx *ctx, struct if_rmap *ifrmap); - /* vrf information */ - struct vrf *vrf; + /* naming information */ + char *name; }; -extern struct if_rmap_ctx *if_rmap_ctx_create(struct vrf *vrf); +extern struct if_rmap_ctx *if_rmap_ctx_create(const char *name); extern void if_rmap_ctx_delete(struct if_rmap_ctx *ctx); extern void if_rmap_init(int node); extern void if_rmap_terminate(void); |