summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ripd/rip_cli.c78
-rw-r--r--ripd/rip_cli.h2
-rw-r--r--ripd/rip_northbound.c75
-rw-r--r--ripd/rip_routemap.c19
-rw-r--r--ripd/rip_zebra.c375
-rw-r--r--ripd/ripd.c5
-rw-r--r--ripd/ripd.h8
7 files changed, 172 insertions, 390 deletions
diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c
index ae7e05cc18..4bbec64f17 100644
--- a/ripd/rip_cli.c
+++ b/ripd/rip_cli.c
@@ -536,6 +536,82 @@ void cli_show_rip_non_passive_interface(struct vty *vty, struct lyd_node *dnode,
yang_dnode_get_string(dnode, NULL));
}
+/*
+ * XPath: /frr-ripd:ripd/instance/redistribute
+ */
+DEFPY (rip_redistribute,
+ rip_redistribute_cmd,
+ "redistribute " FRR_REDIST_STR_RIPD "$protocol [{metric (0-16)|route-map WORD}]",
+ REDIST_STR
+ FRR_REDIST_HELP_STR_RIPD
+ "Metric\n"
+ "Metric value\n"
+ "Route map reference\n"
+ "Pointer to route-map entries\n")
+{
+ char xpath_list[XPATH_MAXLEN];
+ struct cli_config_change changes[] = {
+ {
+ .xpath = ".",
+ .operation = NB_OP_CREATE,
+ },
+ {
+ .xpath = "./route-map",
+ .operation = route_map ? NB_OP_MODIFY : NB_OP_DELETE,
+ .value = route_map,
+ },
+ {
+ .xpath = "./metric",
+ .operation = metric_str ? NB_OP_MODIFY : NB_OP_DELETE,
+ .value = metric_str,
+ },
+ };
+
+ snprintf(xpath_list, sizeof(xpath_list),
+ "./redistribute[protocol='%s']", protocol);
+
+ return nb_cli_cfg_change(vty, xpath_list, changes, array_size(changes));
+}
+
+DEFPY (no_rip_redistribute,
+ no_rip_redistribute_cmd,
+ "no redistribute " FRR_REDIST_STR_RIPD "$protocol [{metric (0-16)|route-map WORD}]",
+ NO_STR
+ REDIST_STR
+ FRR_REDIST_HELP_STR_RIPD
+ "Metric\n"
+ "Metric value\n"
+ "Route map reference\n"
+ "Pointer to route-map entries\n")
+{
+ char xpath_list[XPATH_MAXLEN];
+ struct cli_config_change changes[] = {
+ {
+ .xpath = ".",
+ .operation = NB_OP_DELETE,
+ },
+ };
+
+ snprintf(xpath_list, sizeof(xpath_list),
+ "./redistribute[protocol='%s']", protocol);
+
+ return nb_cli_cfg_change(vty, xpath_list, changes, array_size(changes));
+}
+
+void cli_show_rip_redistribute(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults)
+{
+ vty_out(vty, " redistribute %s",
+ yang_dnode_get_string(dnode, "./protocol"));
+ if (yang_dnode_exists(dnode, "./metric"))
+ vty_out(vty, " metric %s",
+ yang_dnode_get_string(dnode, "./metric"));
+ if (yang_dnode_exists(dnode, "./route-map"))
+ vty_out(vty, " route-map %s",
+ yang_dnode_get_string(dnode, "./route-map"));
+ vty_out(vty, "\n");
+}
+
void rip_cli_init(void)
{
install_element(CONFIG_NODE, &router_rip_cmd);
@@ -556,4 +632,6 @@ void rip_cli_init(void)
install_element(RIP_NODE, &no_rip_offset_list_cmd);
install_element(RIP_NODE, &rip_passive_default_cmd);
install_element(RIP_NODE, &rip_passive_interface_cmd);
+ install_element(RIP_NODE, &rip_redistribute_cmd);
+ install_element(RIP_NODE, &no_rip_redistribute_cmd);
}
diff --git a/ripd/rip_cli.h b/ripd/rip_cli.h
index 61d379f78d..6625a301e1 100644
--- a/ripd/rip_cli.h
+++ b/ripd/rip_cli.h
@@ -53,5 +53,7 @@ extern void cli_show_rip_passive_interface(struct vty *vty,
extern void cli_show_rip_non_passive_interface(struct vty *vty,
struct lyd_node *dnode,
bool show_defaults);
+extern void cli_show_rip_redistribute(struct vty *vty, struct lyd_node *dnode,
+ bool show_defaults);
#endif /* _FRR_RIP_CLI_H_ */
diff --git a/ripd/rip_northbound.c b/ripd/rip_northbound.c
index 08dcac62ca..a57e294373 100644
--- a/ripd/rip_northbound.c
+++ b/ripd/rip_northbound.c
@@ -26,6 +26,7 @@
#include "prefix.h"
#include "table.h"
#include "command.h"
+#include "routemap.h"
#include "northbound.h"
#include "libfrr.h"
@@ -541,17 +542,33 @@ static int ripd_instance_redistribute_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
return NB_OK;
}
static int ripd_instance_redistribute_delete(enum nb_event event,
const struct lyd_node *dnode)
{
- /* TODO: implement me. */
+ int type;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ type = yang_dnode_get_enum(dnode, "./protocol");
+
+ rip_redistribute_conf_delete(type);
+
return NB_OK;
}
+static void
+ripd_instance_redistribute_apply_finish(const struct lyd_node *dnode)
+{
+ int type;
+
+ type = yang_dnode_get_enum(dnode, "./protocol");
+ rip_redistribute_conf_update(type);
+}
+
/*
* XPath: /frr-ripd:ripd/instance/redistribute/route-map
*/
@@ -560,7 +577,20 @@ ripd_instance_redistribute_route_map_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ int type;
+ const char *rmap_name;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ type = yang_dnode_get_enum(dnode, "../protocol");
+ rmap_name = yang_dnode_get_string(dnode, NULL);
+
+ if (rip->route_map[type].name)
+ free(rip->route_map[type].name);
+ rip->route_map[type].name = strdup(rmap_name);
+ rip->route_map[type].map = route_map_lookup_by_name(rmap_name);
+
return NB_OK;
}
@@ -568,7 +598,18 @@ static int
ripd_instance_redistribute_route_map_delete(enum nb_event event,
const struct lyd_node *dnode)
{
- /* TODO: implement me. */
+ int type;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ type = yang_dnode_get_enum(dnode, "../protocol");
+
+ if (rip->route_map[type].name) {
+ free(rip->route_map[type].name);
+ rip->route_map[type].name = NULL;
+ }
+
return NB_OK;
}
@@ -580,7 +621,18 @@ ripd_instance_redistribute_metric_modify(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
- /* TODO: implement me. */
+ int type;
+ uint8_t metric;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ type = yang_dnode_get_enum(dnode, "../protocol");
+ metric = yang_dnode_get_uint8(dnode, NULL);
+
+ rip->route_map[type].metric_config = true;
+ rip->route_map[type].metric = metric;
+
return NB_OK;
}
@@ -588,7 +640,16 @@ static int
ripd_instance_redistribute_metric_delete(enum nb_event event,
const struct lyd_node *dnode)
{
- /* TODO: implement me. */
+ int type;
+
+ if (event != NB_EV_APPLY)
+ return NB_OK;
+
+ type = yang_dnode_get_enum(dnode, "../protocol");
+
+ rip->route_map[type].metric_config = false;
+ rip->route_map[type].metric = 0;
+
return NB_OK;
}
@@ -1028,6 +1089,8 @@ const struct frr_yang_module_info frr_ripd_info = {
.xpath = "/frr-ripd:ripd/instance/redistribute",
.cbs.create = ripd_instance_redistribute_create,
.cbs.delete = ripd_instance_redistribute_delete,
+ .cbs.apply_finish = ripd_instance_redistribute_apply_finish,
+ .cbs.cli_show = cli_show_rip_redistribute,
},
{
.xpath = "/frr-ripd:ripd/instance/redistribute/route-map",
diff --git a/ripd/rip_routemap.c b/ripd/rip_routemap.c
index 88473c164e..b69b2466d5 100644
--- a/ripd/rip_routemap.c
+++ b/ripd/rip_routemap.c
@@ -40,22 +40,6 @@ struct rip_metric_modifier {
uint8_t metric;
};
-/* Hook function for updating route_map assignment. */
-/* ARGSUSED */
-static void rip_route_map_update(const char *notused)
-{
- int i;
-
- if (rip) {
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
- if (rip->route_map[i].name)
- rip->route_map[i].map =
- route_map_lookup_by_name(
- rip->route_map[i].name);
- }
- }
-}
-
/* `match metric METRIC' */
/* Match function return 1 if match is success else return zero. */
static route_map_result_t route_match_metric(void *rule,
@@ -543,9 +527,6 @@ void rip_route_map_init()
{
route_map_init();
- route_map_add_hook(rip_route_map_update);
- route_map_delete_hook(rip_route_map_update);
-
route_map_match_interface_hook(generic_match_add);
route_map_no_match_interface_hook(generic_match_delete);
diff --git a/ripd/rip_zebra.c b/ripd/rip_zebra.c
index 1d0290daf9..2a56cd7b1b 100644
--- a/ripd/rip_zebra.c
+++ b/ripd/rip_zebra.c
@@ -25,7 +25,6 @@
#include "table.h"
#include "stream.h"
#include "memory.h"
-#include "routemap.h"
#include "zclient.h"
#include "log.h"
#include "vrf.h"
@@ -153,75 +152,20 @@ void rip_zclient_reset(void)
zclient_reset(zclient);
}
-/* RIP route-map set for redistribution */
-static void rip_routemap_set(int type, const char *name)
+void rip_redistribute_conf_update(int type)
{
- if (rip->route_map[type].name)
- free(rip->route_map[type].name);
-
- rip->route_map[type].name = strdup(name);
- rip->route_map[type].map = route_map_lookup_by_name(name);
-}
-
-static void rip_redistribute_metric_set(int type, unsigned int metric)
-{
- rip->route_map[type].metric_config = 1;
- rip->route_map[type].metric = metric;
-}
-
-static int rip_metric_unset(int type, unsigned int metric)
-{
-#define DONT_CARE_METRIC_RIP 17
- if (metric != DONT_CARE_METRIC_RIP
- && rip->route_map[type].metric != metric)
- return 1;
- rip->route_map[type].metric_config = 0;
- rip->route_map[type].metric = 0;
- return 0;
-}
-
-/* RIP route-map unset for redistribution */
-static int rip_routemap_unset(int type, const char *name)
-{
- if (!rip->route_map[type].name
- || (name != NULL && strcmp(rip->route_map[type].name, name)))
- return 1;
-
- free(rip->route_map[type].name);
- rip->route_map[type].name = NULL;
- rip->route_map[type].map = NULL;
-
- return 0;
+ zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient, AFI_IP, type,
+ 0, VRF_DEFAULT);
}
-/* Redistribution types */
-static struct {
- int type;
- int str_min_len;
- const char *str;
-} redist_type[] = {{ZEBRA_ROUTE_KERNEL, 1, "kernel"},
- {ZEBRA_ROUTE_CONNECT, 1, "connected"},
- {ZEBRA_ROUTE_STATIC, 1, "static"},
- {ZEBRA_ROUTE_OSPF, 1, "ospf"},
- {ZEBRA_ROUTE_BGP, 2, "bgp"},
- {ZEBRA_ROUTE_VNC, 1, "vnc"},
- {0, 0, NULL}};
-
-static int rip_redistribute_unset(int type)
+void rip_redistribute_conf_delete(int type)
{
- if (!vrf_bitmap_check(zclient->redist[AFI_IP][type], VRF_DEFAULT))
- return CMD_SUCCESS;
-
- vrf_bitmap_unset(zclient->redist[AFI_IP][type], VRF_DEFAULT);
-
if (zclient->sock > 0)
zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE, zclient,
AFI_IP, type, 0, VRF_DEFAULT);
/* Remove the routes from RIP table. */
rip_redistribute_withdraw(type);
-
- return CMD_SUCCESS;
}
int rip_redistribute_check(int type)
@@ -231,306 +175,32 @@ int rip_redistribute_check(int type)
void rip_redistribute_clean(void)
{
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (vrf_bitmap_check(
- zclient->redist[AFI_IP][redist_type[i].type],
- VRF_DEFAULT)) {
- if (zclient->sock > 0)
- zebra_redistribute_send(
- ZEBRA_REDISTRIBUTE_DELETE, zclient,
- AFI_IP, redist_type[i].type, 0,
- VRF_DEFAULT);
-
- vrf_bitmap_unset(
- zclient->redist[AFI_IP][redist_type[i].type],
- VRF_DEFAULT);
-
- /* Remove the routes from RIP table. */
- rip_redistribute_withdraw(redist_type[i].type);
- }
- }
-}
-
-DEFUN (rip_redistribute_type,
- rip_redistribute_type_cmd,
- "redistribute " FRR_REDIST_STR_RIPD,
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD)
-{
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strncmp(redist_type[i].str, argv[1]->arg,
- redist_type[i].str_min_len)
- == 0) {
- zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient,
- AFI_IP, redist_type[i].type, 0,
- VRF_DEFAULT);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[1]->arg);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-DEFUN (no_rip_redistribute_type,
- no_rip_redistribute_type_cmd,
- "no redistribute " FRR_REDIST_STR_RIPD,
- NO_STR
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD)
-{
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strncmp(redist_type[i].str, argv[2]->arg,
- redist_type[i].str_min_len)
- == 0) {
- rip_metric_unset(redist_type[i].type,
- DONT_CARE_METRIC_RIP);
- rip_routemap_unset(redist_type[i].type, NULL);
- rip_redistribute_unset(redist_type[i].type);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[2]->arg);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-DEFUN (rip_redistribute_type_routemap,
- rip_redistribute_type_routemap_cmd,
- "redistribute " FRR_REDIST_STR_RIPD " route-map WORD",
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
-{
- int idx_protocol = 1;
- int idx_word = 3;
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- rip_routemap_set(redist_type[i].type,
- argv[idx_word]->arg);
- zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient,
- AFI_IP, redist_type[i].type, 0,
- VRF_DEFAULT);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-DEFUN (no_rip_redistribute_type_routemap,
- no_rip_redistribute_type_routemap_cmd,
- "no redistribute " FRR_REDIST_STR_RIPD " route-map WORD",
- NO_STR
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Route map reference\n"
- "Pointer to route-map entries\n")
-{
- int idx_protocol = 2;
- int idx_word = 4;
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- if (rip_routemap_unset(redist_type[i].type,
- argv[idx_word]->arg))
- return CMD_WARNING_CONFIG_FAILED;
- rip_redistribute_unset(redist_type[i].type);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-DEFUN (rip_redistribute_type_metric,
- rip_redistribute_type_metric_cmd,
- "redistribute " FRR_REDIST_STR_RIPD " metric (0-16)",
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Metric\n"
- "Metric value\n")
-{
- int idx_protocol = 1;
- int idx_number = 3;
- int i;
- int metric;
-
- metric = atoi(argv[idx_number]->arg);
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- rip_redistribute_metric_set(redist_type[i].type,
- metric);
- zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient,
- AFI_IP, redist_type[i].type, 0,
- VRF_DEFAULT);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-DEFUN (no_rip_redistribute_type_metric,
- no_rip_redistribute_type_metric_cmd,
- "no redistribute " FRR_REDIST_STR_RIPD " metric (0-16)",
- NO_STR
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Metric\n"
- "Metric value\n")
-{
- int idx_protocol = 2;
- int idx_number = 4;
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- if (rip_metric_unset(redist_type[i].type,
- atoi(argv[idx_number]->arg)))
- return CMD_WARNING_CONFIG_FAILED;
- rip_redistribute_unset(redist_type[i].type);
- return CMD_SUCCESS;
- }
- }
+ for (int i = 0; i < ZEBRA_ROUTE_MAX; i++) {
+ if (!vrf_bitmap_check(zclient->redist[AFI_IP][i], VRF_DEFAULT))
+ continue;
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
+ if (zclient->sock > 0)
+ zebra_redistribute_send(ZEBRA_REDISTRIBUTE_DELETE,
+ zclient, AFI_IP, i, 0,
+ VRF_DEFAULT);
- return CMD_WARNING_CONFIG_FAILED;
-}
+ vrf_bitmap_unset(zclient->redist[AFI_IP][i], VRF_DEFAULT);
-DEFUN (rip_redistribute_type_metric_routemap,
- rip_redistribute_type_metric_routemap_cmd,
- "redistribute " FRR_REDIST_STR_RIPD " metric (0-16) route-map WORD",
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Metric\n"
- "Metric value\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
-{
- int idx_protocol = 1;
- int idx_number = 3;
- int idx_word = 5;
- int i;
- int metric;
-
- metric = atoi(argv[idx_number]->arg);
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- rip_redistribute_metric_set(redist_type[i].type,
- metric);
- rip_routemap_set(redist_type[i].type,
- argv[idx_word]->arg);
- zclient_redistribute(ZEBRA_REDISTRIBUTE_ADD, zclient,
- AFI_IP, redist_type[i].type, 0,
- VRF_DEFAULT);
- return CMD_SUCCESS;
- }
+ /* Remove the routes from RIP table. */
+ rip_redistribute_withdraw(i);
}
-
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
-
- return CMD_WARNING_CONFIG_FAILED;
}
-
-DEFUN (no_rip_redistribute_type_metric_routemap,
- no_rip_redistribute_type_metric_routemap_cmd,
- "no redistribute " FRR_REDIST_STR_RIPD " metric (0-16) route-map WORD",
- NO_STR
- REDIST_STR
- FRR_REDIST_HELP_STR_RIPD
- "Metric\n"
- "Metric value\n"
- "Route map reference\n"
- "Pointer to route-map entries\n")
+void rip_show_redistribute_config(struct vty *vty)
{
- int idx_protocol = 2;
- int idx_number = 4;
- int idx_word = 6;
- int i;
-
- for (i = 0; redist_type[i].str; i++) {
- if (strmatch(redist_type[i].str, argv[idx_protocol]->text)) {
- if (rip_metric_unset(redist_type[i].type,
- atoi(argv[idx_number]->arg)))
- return CMD_WARNING_CONFIG_FAILED;
- if (rip_routemap_unset(redist_type[i].type,
- argv[idx_word]->arg)) {
- rip_redistribute_metric_set(
- redist_type[i].type,
- atoi(argv[idx_number]->arg));
- return CMD_WARNING_CONFIG_FAILED;
- }
- rip_redistribute_unset(redist_type[i].type);
- return CMD_SUCCESS;
- }
- }
-
- vty_out(vty, "Invalid type %s\n", argv[idx_protocol]->text);
-
- return CMD_WARNING_CONFIG_FAILED;
-}
-
-int config_write_rip_redistribute(struct vty *vty, int config_mode)
-{
- int i;
-
- for (i = 0; i < ZEBRA_ROUTE_MAX; i++) {
+ for (int i = 0; i < ZEBRA_ROUTE_MAX; i++) {
if (i == zclient->redist_default
|| !vrf_bitmap_check(zclient->redist[AFI_IP][i],
VRF_DEFAULT))
continue;
- if (!config_mode) {
- vty_out(vty, " %s", zebra_route_string(i));
- continue;
- }
-
- if (rip->route_map[i].metric_config) {
- if (rip->route_map[i].name)
- vty_out(vty,
- " redistribute %s metric %d route-map %s\n",
- zebra_route_string(i),
- rip->route_map[i].metric,
- rip->route_map[i].name);
- else
- vty_out(vty, " redistribute %s metric %d\n",
- zebra_route_string(i),
- rip->route_map[i].metric);
- } else {
- if (rip->route_map[i].name)
- vty_out(vty, " redistribute %s route-map %s\n",
- zebra_route_string(i),
- rip->route_map[i].name);
- else
- vty_out(vty, " redistribute %s\n",
- zebra_route_string(i));
- }
+ vty_out(vty, " %s", zebra_route_string(i));
}
-
- return 0;
}
static void rip_zebra_connected(struct zclient *zclient)
@@ -552,17 +222,6 @@ void rip_zclient_init(struct thread_master *master)
zclient->interface_down = rip_interface_down;
zclient->redistribute_route_add = rip_zebra_read_route;
zclient->redistribute_route_del = rip_zebra_read_route;
-
- /* Install command elements to rip node. */
- install_element(RIP_NODE, &rip_redistribute_type_cmd);
- install_element(RIP_NODE, &rip_redistribute_type_routemap_cmd);
- install_element(RIP_NODE, &rip_redistribute_type_metric_cmd);
- install_element(RIP_NODE, &rip_redistribute_type_metric_routemap_cmd);
- install_element(RIP_NODE, &no_rip_redistribute_type_cmd);
- install_element(RIP_NODE, &no_rip_redistribute_type_routemap_cmd);
- install_element(RIP_NODE, &no_rip_redistribute_type_metric_cmd);
- install_element(RIP_NODE,
- &no_rip_redistribute_type_metric_routemap_cmd);
}
void rip_zclient_stop(void)
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 9892c5c41c..26b79e873c 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -3312,7 +3312,7 @@ DEFUN (show_ip_rip_status,
/* Redistribute information. */
vty_out(vty, " Redistributing:");
- config_write_rip_redistribute(vty, 0);
+ rip_show_redistribute_config(vty);
vty_out(vty, "\n");
vty_out(vty, " Default version control: send version %s,",
@@ -3411,9 +3411,6 @@ static int config_write_rip(struct vty *vty)
rip->update_time, rip->timeout_time,
rip->garbage_time);
- /* Redistribute configuration. */
- config_write_rip_redistribute(vty, 1);
-
/* Distribute configuration. */
write += config_write_distribute(vty);
diff --git a/ripd/ripd.h b/ripd/ripd.h
index 307f7934bf..7a1e3837bd 100644
--- a/ripd/ripd.h
+++ b/ripd/ripd.h
@@ -156,8 +156,8 @@ struct rip {
struct {
char *name;
struct route_map *map;
- int metric_config;
- uint32_t metric;
+ bool metric_config;
+ uint8_t metric;
} route_map[ZEBRA_ROUTE_MAX];
QOBJ_FIELDS
@@ -420,6 +420,8 @@ extern void rip_ecmp_disable(void);
extern int rip_create_socket(void);
extern int rip_redistribute_check(int);
+extern void rip_redistribute_conf_update(int type);
+extern void rip_redistribute_conf_delete(int type);
extern void rip_redistribute_add(int type, int sub_type, struct prefix_ipv4 *p,
struct nexthop *nh, unsigned int metric,
unsigned char distance, route_tag_t tag);
@@ -432,7 +434,7 @@ extern void rip_distribute_update_interface(struct interface *);
extern void rip_if_rmap_update_interface(struct interface *);
extern int rip_show_network_config(struct vty *);
-extern int config_write_rip_redistribute(struct vty *, int);
+extern void rip_show_redistribute_config(struct vty *);
extern void rip_peer_init(void);
extern void rip_peer_update(struct sockaddr_in *, uint8_t);