summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2016-08-05 17:08:06 +0000
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-12-21 20:26:05 -0500
commit36d6bd7d34090d3af3dd1953b7ccc1b02f042849 (patch)
tree129a74cb7048295a6821743c8de9dfbcdeb1dfba /pimd/pim_cmd.c
parent75a26779e8f25e9868f1f33e0fd35677f17c978b (diff)
pimd: multiple rp commands
Allow the user to specify multiple rp commands. 'ip pim rp A.B.C.D' -> translates to 'ip pim rp A.G.C.D 224.0.0.0/24' ip pim rp A.B.C.D A.B.C.D/M First is the rp, second is the group with mask. Groups and masks cannot be over each other except 224.0.0.0/24 which is the fallback if used. Ticket: CM-7860 Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 9c32ab1c32..e804b47ebd 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -2425,6 +2425,33 @@ DEFUN (show_ip_ssmpingd,
return CMD_SUCCESS;
}
+static int
+pim_rp_cmd_worker (struct vty *vty, const char *rp, const char *group)
+{
+ int result;
+ result = pim_rp_new (rp, group);
+
+ if (result == -1)
+ {
+ vty_out (vty, "%% Bad RP/group address specified: %s", rp);
+ return CMD_WARNING;
+ }
+
+ if (result == -2)
+ {
+ vty_out (vty, "%% No Path to RP address specified: %s", rp);
+ return CMD_WARNING;
+ }
+
+ if (result == -3)
+ {
+ vty_out (vty, "%% Group range specified cannot overlap");
+ return CMD_ERR_NO_MATCH;
+ }
+
+ return CMD_SUCCESS;
+}
+
DEFUN (ip_pim_rp,
ip_pim_rp_cmd,
"ip pim rp A.B.C.D [A.B.C.D/M]",
@@ -2434,19 +2461,23 @@ DEFUN (ip_pim_rp,
"ip address of RP\n")
{
int idx_ipv4 = 3;
- int result;
+ return pim_rp_cmd_worker (vty, argv[idx_ipv4]->arg, argv[idx_ipv4 + 1]->arg);
+}
- result = pim_rp_new (argv[idx_ipv4]->arg, argv[idx_ipv4 + 1]->arg);
+static int
+pim_no_rp_cmd_worker (struct vty *vty, const char *rp, const char *group)
+{
+ int result = pim_rp_del (rp, group);
if (result == -1)
{
- vty_out(vty, "%% Bad RP address specified: %s", argv[idx_ipv4]->arg);
- return CMD_ERR_NO_MATCH;
+ vty_out (vty, "%% Unable to Decode specified RP");
+ return CMD_WARNING;
}
if (result == -2)
{
- vty_out(vty, "%% No Path to RP address specified: %s", argv[idx_ipv4]->arg);
+ vty_out (vty, "%% Unable to find specified RP");
return CMD_WARNING;
}
@@ -2463,9 +2494,7 @@ DEFUN (no_ip_pim_rp,
"ip address of RP\n")
{
int idx_ipv4 = 4;
- pim_rp_del (argv[idx_ipv4]->arg, argv[idx_ipv4 + 1]->arg);
-
- return CMD_SUCCESS;
+ return pim_no_rp_cmd_worker (vty, argv[idx_ipv4]->arg, argv[idx_ipv4 + 1]->arg);
}
DEFUN (ip_multicast_routing,