summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/if_rmap.c44
-rw-r--r--lib/if_rmap.h2
-rw-r--r--ripd/rip_nb.c2
-rw-r--r--ripd/ripd.c3
-rw-r--r--ripngd/ripng_nb.c2
-rw-r--r--ripngd/ripngd.c1
6 files changed, 18 insertions, 36 deletions
diff --git a/lib/if_rmap.c b/lib/if_rmap.c
index 5895924a5..42e162072 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -240,6 +240,18 @@ DEFPY_YANG(no_if_ipv6_route_map, no_if_ipv6_route_map_cmd,
route_map);
}
+void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
+ bool show_defaults)
+{
+ if (yang_dnode_exists(dnode, "./in-route-map"))
+ vty_out(vty, " route-map %s in %s\n",
+ yang_dnode_get_string(dnode, "./in-route-map"),
+ yang_dnode_get_string(dnode, "./interface"));
+ if (yang_dnode_exists(dnode, "./out-route-map"))
+ vty_out(vty, " route-map %s out %s\n",
+ yang_dnode_get_string(dnode, "./out-route-map"),
+ yang_dnode_get_string(dnode, "./interface"));
+}
void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
const struct lyd_node *dnode,
@@ -263,38 +275,6 @@ void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
if_rmap_unset(ctx, ifname, IF_RMAP_OUT);
}
-
-/* Configuration write function. */
-int config_write_if_rmap(struct vty *vty, struct if_rmap_ctx *ctx)
-{
- unsigned int i;
- struct hash_bucket *mp;
- int write = 0;
- struct hash *ifrmaphash = ctx->ifrmaphash;
-
- for (i = 0; i < ifrmaphash->size; i++)
- for (mp = ifrmaphash->index[i]; mp; mp = mp->next) {
- struct if_rmap *if_rmap;
-
- if_rmap = mp->data;
-
- if (if_rmap->routemap[IF_RMAP_IN]) {
- vty_out(vty, " route-map %s in %s\n",
- if_rmap->routemap[IF_RMAP_IN],
- if_rmap->ifname);
- write++;
- }
-
- if (if_rmap->routemap[IF_RMAP_OUT]) {
- vty_out(vty, " route-map %s out %s\n",
- if_rmap->routemap[IF_RMAP_OUT],
- if_rmap->ifname);
- write++;
- }
- }
- return write;
-}
-
void if_rmap_ctx_delete(struct if_rmap_ctx *ctx)
{
hash_clean_and_free(&ctx->ifrmaphash, (void (*)(void *))if_rmap_free);
diff --git a/lib/if_rmap.h b/lib/if_rmap.h
index 6f5fb578f..a9f811e22 100644
--- a/lib/if_rmap.h
+++ b/lib/if_rmap.h
@@ -56,6 +56,8 @@ extern void if_rmap_yang_modify_cb(struct if_rmap_ctx *ctx,
extern void if_rmap_yang_destroy_cb(struct if_rmap_ctx *ctx,
const struct lyd_node *dnode);
extern int config_write_if_rmap(struct vty *, struct if_rmap_ctx *ctx);
+void cli_show_if_route_map(struct vty *vty, const struct lyd_node *dnode,
+ bool show_defaults);
#ifdef __cplusplus
}
diff --git a/ripd/rip_nb.c b/ripd/rip_nb.c
index 1a7b34add..fa6652faf 100644
--- a/ripd/rip_nb.c
+++ b/ripd/rip_nb.c
@@ -10,6 +10,7 @@
#include "libfrr.h"
#include "ripd/rip_nb.h"
+#include "lib/if_rmap.h"
/* clang-format off */
const struct frr_yang_module_info frr_ripd_info = {
@@ -170,6 +171,7 @@ const struct frr_yang_module_info frr_ripd_info = {
.cbs = {
.create = ripd_instance_if_route_maps_if_route_map_create,
.destroy = ripd_instance_if_route_maps_if_route_map_destroy,
+ .cli_show = cli_show_if_route_map,
}
},
{
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 7dbe2bbcc..fb3d574aa 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -3204,9 +3204,6 @@ static int config_write_rip(struct vty *vty)
/* Distribute configuration. */
config_write_distribute(vty, rip->distribute_ctx);
- /* Interface routemap configuration */
- config_write_if_rmap(vty, rip->if_rmap_ctx);
-
vty_out(vty, "exit\n");
write = 1;
diff --git a/ripngd/ripng_nb.c b/ripngd/ripng_nb.c
index 2f412e519..1c6d7191a 100644
--- a/ripngd/ripng_nb.c
+++ b/ripngd/ripng_nb.c
@@ -10,6 +10,7 @@
#include "libfrr.h"
#include "ripngd/ripng_nb.h"
+#include "lib/if_rmap.h"
/* clang-format off */
const struct frr_yang_module_info frr_ripngd_info = {
@@ -119,6 +120,7 @@ const struct frr_yang_module_info frr_ripngd_info = {
.cbs = {
.create = ripngd_instance_if_route_maps_if_route_map_create,
.destroy = ripngd_instance_if_route_maps_if_route_map_destroy,
+ .cli_show = cli_show_if_route_map,
}
},
{
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 79e8871f6..2f6409a70 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2231,7 +2231,6 @@ static int ripng_config_write(struct vty *vty)
nb_cli_show_dnode_cmds(vty, dnode, false);
config_write_distribute(vty, ripng->distribute_ctx);
- config_write_if_rmap(vty, ripng->if_rmap_ctx);
vty_out(vty, "exit\n");