summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ripngd/ripng_cli.c26
-rw-r--r--ripngd/ripng_cli.h2
-rw-r--r--ripngd/ripng_northbound.c9
-rw-r--r--ripngd/ripngd.c41
-rw-r--r--ripngd/ripngd.h3
5 files changed, 39 insertions, 42 deletions
diff --git a/ripngd/ripng_cli.c b/ripngd/ripng_cli.c
index 7bdc74220..8944198c2 100644
--- a/ripngd/ripng_cli.c
+++ b/ripngd/ripng_cli.c
@@ -75,8 +75,34 @@ void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
vty_out(vty, "router ripng\n");
}
+/*
+ * XPath: /frr-ripngd:ripngd/instance/allow-ecmp
+ */
+DEFPY (ripng_allow_ecmp,
+ ripng_allow_ecmp_cmd,
+ "[no] allow-ecmp",
+ NO_STR
+ "Allow Equal Cost MultiPath\n")
+{
+ nb_cli_enqueue_change(vty, "./allow-ecmp", NB_OP_MODIFY,
+ no ? "false" : "true");
+
+ return nb_cli_apply_changes(vty, NULL);
+}
+
+void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ if (!yang_dnode_get_bool(dnode, NULL))
+ vty_out(vty, " no");
+
+ vty_out(vty, " allow-ecmp\n");
+}
+
void ripng_cli_init(void)
{
install_element(CONFIG_NODE, &router_ripng_cmd);
install_element(CONFIG_NODE, &no_router_ripng_cmd);
+
+ install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
}
diff --git a/ripngd/ripng_cli.h b/ripngd/ripng_cli.h
index f0ef046f6..e90fb8aae 100644
--- a/ripngd/ripng_cli.h
+++ b/ripngd/ripng_cli.h
@@ -23,5 +23,7 @@
extern void cli_show_router_ripng(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_ripng_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIPNG_CLI_H_ */
diff --git a/ripngd/ripng_northbound.c b/ripngd/ripng_northbound.c
index 219d8d1db..f067d048e 100644
--- a/ripngd/ripng_northbound.c
+++ b/ripngd/ripng_northbound.c
@@ -82,7 +82,13 @@ static int ripngd_instance_allow_ecmp_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ ripng->ecmp = yang_dnode_get_bool(dnode, NULL);
+ if (!ripng->ecmp)
+ ripng_ecmp_disable();
+
return NB_OK;
}
@@ -513,6 +519,7 @@ const struct frr_yang_module_info frr_ripngd_info = {
{
.xpath = "/frr-ripngd:ripngd/instance/allow-ecmp",
.cbs.modify = ripngd_instance_allow_ecmp_modify,
+ .cbs.cli_show = cli_show_ripng_allow_ecmp,
},
{
.xpath = "/frr-ripngd:ripngd/instance/default-information-originate",
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 634596719..0d5ec507b 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2540,7 +2540,7 @@ DEFUN (no_ripng_default_information_originate,
}
/* Update ECMP routes to zebra when ECMP is disabled. */
-static void ripng_ecmp_disable(void)
+void ripng_ecmp_disable(void)
{
struct agg_node *rp;
struct ripng_info *rinfo, *tmp_rinfo;
@@ -2577,38 +2577,6 @@ static void ripng_ecmp_disable(void)
}
}
-DEFUN (ripng_allow_ecmp,
- ripng_allow_ecmp_cmd,
- "allow-ecmp",
- "Allow Equal Cost MultiPath\n")
-{
- if (ripng->ecmp) {
- vty_out(vty, "ECMP is already enabled.\n");
- return CMD_WARNING;
- }
-
- ripng->ecmp = 1;
- zlog_info("ECMP is enabled.");
- return CMD_SUCCESS;
-}
-
-DEFUN (no_ripng_allow_ecmp,
- no_ripng_allow_ecmp_cmd,
- "no allow-ecmp",
- NO_STR
- "Allow Equal Cost MultiPath\n")
-{
- if (!ripng->ecmp) {
- vty_out(vty, "ECMP is already disabled.\n");
- return CMD_WARNING;
- }
-
- ripng->ecmp = 0;
- zlog_info("ECMP is disabled.");
- ripng_ecmp_disable();
- return CMD_SUCCESS;
-}
-
/* RIPng configuration write function. */
static int ripng_config_write(struct vty *vty)
{
@@ -2644,10 +2612,6 @@ static int ripng_config_write(struct vty *vty)
inet6_ntoa(rp->p.u.prefix6),
rp->p.prefixlen);
- /* ECMP configuration. */
- if (ripng->ecmp)
- vty_out(vty, " allow-ecmp\n");
-
/* RIPng static routes. */
for (rp = agg_route_top(ripng->route); rp;
rp = agg_route_next(rp))
@@ -2983,9 +2947,6 @@ void ripng_init()
install_element(RIPNG_NODE,
&no_ripng_default_information_originate_cmd);
- install_element(RIPNG_NODE, &ripng_allow_ecmp_cmd);
- install_element(RIPNG_NODE, &no_ripng_allow_ecmp_cmd);
-
ripng_if_init();
ripng_debug_init();
diff --git a/ripngd/ripngd.h b/ripngd/ripngd.h
index de3b2e194..9b5f89076 100644
--- a/ripngd/ripngd.h
+++ b/ripngd/ripngd.h
@@ -134,7 +134,7 @@ struct ripng {
struct thread *t_triggered_interval;
/* RIPng ECMP flag */
- unsigned int ecmp;
+ bool ecmp;
/* For redistribute route map. */
struct {
@@ -378,6 +378,7 @@ extern void ripng_redistribute_delete(int, int, struct prefix_ipv6 *,
ifindex_t);
extern void ripng_redistribute_withdraw(int type);
+extern void ripng_ecmp_disable(void);
extern void ripng_distribute_update_interface(struct interface *);
extern void ripng_if_rmap_update_interface(struct interface *);