vty_out(vty, "router rip\n");
}
+/*
+ * XPath: /frr-ripd:ripd/instance/allow-ecmp
+ */
+DEFPY (rip_allow_ecmp,
+ rip_allow_ecmp_cmd,
+ "[no] allow-ecmp",
+ NO_STR
+ "Allow Equal Cost MultiPath\n")
+{
+ struct cli_config_change changes[] = {
+ {
+ .xpath = "./allow-ecmp",
+ .operation = NB_OP_MODIFY,
+ .value = no ? "false" : "true",
+ },
+ };
+
+ return nb_cli_cfg_change(vty, NULL, changes, array_size(changes));
+}
+
+void cli_show_rip_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 rip_cli_init(void)
{
install_element(CONFIG_NODE, &router_rip_cmd);
install_element(CONFIG_NODE, &no_router_rip_cmd);
+
+ install_element(RIP_NODE, &rip_allow_ecmp_cmd);
}
extern void cli_show_router_rip(struct vty *vty, struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_rip_allow_ecmp(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIP_CLI_H_ */
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ rip->ecmp = yang_dnode_get_bool(dnode, NULL);
+ if (!rip->ecmp)
+ rip_ecmp_disable();
+
return NB_OK;
}
{
.xpath = "/frr-ripd:ripd/instance/allow-ecmp",
.cbs.modify = ripd_instance_allow_ecmp_modify,
+ .cbs.cli_show = cli_show_rip_allow_ecmp,
},
{
.xpath = "/frr-ripd:ripd/instance/default-information-originate",
}
/* Update ECMP routes to zebra when ECMP is disabled. */
-static void rip_ecmp_disable(void)
+void rip_ecmp_disable(void)
{
struct route_node *rp;
struct rip_info *rinfo, *tmp_rinfo;
}
}
-DEFUN (rip_allow_ecmp,
- rip_allow_ecmp_cmd,
- "allow-ecmp",
- "Allow Equal Cost MultiPath\n")
-{
- if (rip->ecmp) {
- vty_out(vty, "ECMP is already enabled.\n");
- return CMD_WARNING;
- }
-
- rip->ecmp = 1;
- zlog_info("ECMP is enabled.");
- return CMD_SUCCESS;
-}
-
-DEFUN (no_rip_allow_ecmp,
- no_rip_allow_ecmp_cmd,
- "no allow-ecmp",
- NO_STR
- "Allow Equal Cost MultiPath\n")
-{
- if (!rip->ecmp) {
- vty_out(vty, "ECMP is already disabled.\n");
- return CMD_WARNING;
- }
-
- rip->ecmp = 0;
- zlog_info("ECMP is disabled.");
- rip_ecmp_disable();
- return CMD_SUCCESS;
-}
-
/* Print out routes update time. */
static void rip_vty_out_uptime(struct vty *vty, struct rip_info *rinfo)
{
? rdistance->access_list
: "");
- /* ECMP configuration. */
- if (rip->ecmp)
- vty_out(vty, " allow-ecmp\n");
-
/* RIP static route configuration. */
for (rn = route_top(rip->route); rn; rn = route_next(rn))
if (rn->info)
install_element(RIP_NODE, &no_rip_distance_source_cmd);
install_element(RIP_NODE, &rip_distance_source_access_list_cmd);
install_element(RIP_NODE, &no_rip_distance_source_access_list_cmd);
- install_element(RIP_NODE, &rip_allow_ecmp_cmd);
- install_element(RIP_NODE, &no_rip_allow_ecmp_cmd);
/* Debug related init. */
rip_debug_init();
struct route_table *distance_table;
/* RIP ECMP flag */
- unsigned int ecmp;
+ bool ecmp;
/* For redistribute route map. */
struct {
struct connected *);
extern int rip_neighbor_lookup(struct sockaddr_in *);
+extern void rip_ecmp_disable(void);
+
extern int rip_create_socket(void);
extern int rip_redistribute_check(int);