summaryrefslogtreecommitdiff
path: root/pimd/pim_cmd.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-12-16 07:47:41 -0500
committerGitHub <noreply@github.com>2019-12-16 07:47:41 -0500
commit4e29b89aba2e5ce56f1736443653ab4d677f3173 (patch)
tree30a8a46c115e48e7c662a047ce04ceb84fb33356 /pimd/pim_cmd.c
parentd45fdd536403c3bbcc29b47a0df3a0d804686e3f (diff)
parent771ce8ad240b0c620e6cf46a7841fe2b757f9b43 (diff)
Merge pull request #5427 from liam-mcb/igmp-join-any
pimd: Add command to join any-source multicast.
Diffstat (limited to 'pimd/pim_cmd.c')
-rw-r--r--pimd/pim_cmd.c47
1 files changed, 33 insertions, 14 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 7375e6d9b8..5c192a9fcd 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -6915,7 +6915,7 @@ DEFUN (interface_no_ip_igmp,
DEFUN (interface_ip_igmp_join,
interface_ip_igmp_join_cmd,
- "ip igmp join A.B.C.D A.B.C.D",
+ "ip igmp join A.B.C.D [A.B.C.D]",
IP_STR
IFACE_IGMP_STR
"IGMP join multicast group\n"
@@ -6941,12 +6941,21 @@ DEFUN (interface_ip_igmp_join,
}
/* Source address */
- source_str = argv[idx_ipv4_2]->arg;
- result = inet_pton(AF_INET, source_str, &source_addr);
- if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s\n",
- source_str, errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ if (argc == (idx_ipv4_2 + 1)) {
+ source_str = argv[idx_ipv4_2]->arg;
+ result = inet_pton(AF_INET, source_str, &source_addr);
+ if (result <= 0) {
+ vty_out(vty, "Bad source address %s: errno=%d: %s\n",
+ source_str, errno, safe_strerror(errno));
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ /* Reject 0.0.0.0. Reserved for any source. */
+ if (source_addr.s_addr == INADDR_ANY) {
+ vty_out(vty, "Bad source address %s\n", source_str);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ } else {
+ source_addr.s_addr = INADDR_ANY;
}
CMD_FERR_RETURN(pim_if_igmp_join_add(ifp, group_addr, source_addr),
@@ -6957,7 +6966,7 @@ DEFUN (interface_ip_igmp_join,
DEFUN (interface_no_ip_igmp_join,
interface_no_ip_igmp_join_cmd,
- "no ip igmp join A.B.C.D A.B.C.D",
+ "no ip igmp join A.B.C.D [A.B.C.D]",
NO_STR
IP_STR
IFACE_IGMP_STR
@@ -6984,12 +6993,22 @@ DEFUN (interface_no_ip_igmp_join,
}
/* Source address */
- source_str = argv[idx_ipv4_2]->arg;
- result = inet_pton(AF_INET, source_str, &source_addr);
- if (result <= 0) {
- vty_out(vty, "Bad source address %s: errno=%d: %s\n",
- source_str, errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ if (argc == (idx_ipv4_2 + 1)) {
+ source_str = argv[idx_ipv4_2]->arg;
+ result = inet_pton(AF_INET, source_str, &source_addr);
+ if (result <= 0) {
+ vty_out(vty, "Bad source address %s: errno=%d: %s\n",
+ source_str, errno, safe_strerror(errno));
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ /* Reject 0.0.0.0. Reserved for any source. */
+ if (source_addr.s_addr == INADDR_ANY) {
+ vty_out(vty, "Bad source address %s\n", source_str);
+ return CMD_WARNING_CONFIG_FAILED;
+ }
+ } else {
+ source_str = "*";
+ source_addr.s_addr = INADDR_ANY;
}
result = pim_if_igmp_join_del(ifp, group_addr, source_addr);