mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-09 13:19:17 +00:00
Merge pull request #5427 from liam-mcb/igmp-join-any
pimd: Add command to join any-source multicast.
This commit is contained in:
commit
4e29b89aba
@ -211,10 +211,10 @@ is in a vrf, enter the interface command with the vrf keyword at the end.
|
|||||||
Tell pim to receive IGMP reports and Query on this interface. The default
|
Tell pim to receive IGMP reports and Query on this interface. The default
|
||||||
version is v3. This command is useful on a LHR.
|
version is v3. This command is useful on a LHR.
|
||||||
|
|
||||||
.. index:: ip igmp join A.B.C.D A.B.C.D
|
.. index:: ip igmp join A.B.C.D [A.B.C.D]
|
||||||
.. clicmd:: ip igmp join A.B.C.D A.B.C.D
|
.. clicmd:: ip igmp join A.B.C.D [A.B.C.D]
|
||||||
|
|
||||||
Join multicast source-group on an interface.
|
Join multicast group or source-group on an interface.
|
||||||
|
|
||||||
.. index:: ip igmp query-interval (1-1800)
|
.. index:: ip igmp query-interval (1-1800)
|
||||||
.. clicmd:: ip igmp query-interval (1-1800)
|
.. clicmd:: ip igmp query-interval (1-1800)
|
||||||
|
@ -6915,7 +6915,7 @@ DEFUN (interface_no_ip_igmp,
|
|||||||
|
|
||||||
DEFUN (interface_ip_igmp_join,
|
DEFUN (interface_ip_igmp_join,
|
||||||
interface_ip_igmp_join_cmd,
|
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
|
IP_STR
|
||||||
IFACE_IGMP_STR
|
IFACE_IGMP_STR
|
||||||
"IGMP join multicast group\n"
|
"IGMP join multicast group\n"
|
||||||
@ -6941,6 +6941,7 @@ DEFUN (interface_ip_igmp_join,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Source address */
|
/* Source address */
|
||||||
|
if (argc == (idx_ipv4_2 + 1)) {
|
||||||
source_str = argv[idx_ipv4_2]->arg;
|
source_str = argv[idx_ipv4_2]->arg;
|
||||||
result = inet_pton(AF_INET, source_str, &source_addr);
|
result = inet_pton(AF_INET, source_str, &source_addr);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
@ -6948,6 +6949,14 @@ DEFUN (interface_ip_igmp_join,
|
|||||||
source_str, errno, safe_strerror(errno));
|
source_str, errno, safe_strerror(errno));
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
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),
|
CMD_FERR_RETURN(pim_if_igmp_join_add(ifp, group_addr, source_addr),
|
||||||
"Failure joining IGMP group: $ERR");
|
"Failure joining IGMP group: $ERR");
|
||||||
@ -6957,7 +6966,7 @@ DEFUN (interface_ip_igmp_join,
|
|||||||
|
|
||||||
DEFUN (interface_no_ip_igmp_join,
|
DEFUN (interface_no_ip_igmp_join,
|
||||||
interface_no_ip_igmp_join_cmd,
|
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
|
NO_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
IFACE_IGMP_STR
|
IFACE_IGMP_STR
|
||||||
@ -6984,6 +6993,7 @@ DEFUN (interface_no_ip_igmp_join,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Source address */
|
/* Source address */
|
||||||
|
if (argc == (idx_ipv4_2 + 1)) {
|
||||||
source_str = argv[idx_ipv4_2]->arg;
|
source_str = argv[idx_ipv4_2]->arg;
|
||||||
result = inet_pton(AF_INET, source_str, &source_addr);
|
result = inet_pton(AF_INET, source_str, &source_addr);
|
||||||
if (result <= 0) {
|
if (result <= 0) {
|
||||||
@ -6991,6 +7001,15 @@ DEFUN (interface_no_ip_igmp_join,
|
|||||||
source_str, errno, safe_strerror(errno));
|
source_str, errno, safe_strerror(errno));
|
||||||
return CMD_WARNING_CONFIG_FAILED;
|
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);
|
result = pim_if_igmp_join_del(ifp, group_addr, source_addr);
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
#define SOL_IP IPPROTO_IP
|
#define SOL_IP IPPROTO_IP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MCAST_JOIN_GROUP
|
||||||
|
#define MCAST_JOIN_GROUP 42
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef MCAST_JOIN_SOURCE_GROUP
|
#ifndef MCAST_JOIN_SOURCE_GROUP
|
||||||
#define MCAST_JOIN_SOURCE_GROUP 46
|
#define MCAST_JOIN_SOURCE_GROUP 46
|
||||||
struct group_source_req {
|
struct group_source_req {
|
||||||
@ -58,6 +62,10 @@ static int pim_igmp_join_source(int fd, ifindex_t ifindex,
|
|||||||
|
|
||||||
req.gsr_interface = ifindex;
|
req.gsr_interface = ifindex;
|
||||||
|
|
||||||
|
if (source_addr.s_addr == INADDR_ANY)
|
||||||
|
return setsockopt(fd, SOL_IP, MCAST_JOIN_GROUP, &req,
|
||||||
|
sizeof(req));
|
||||||
|
else
|
||||||
return setsockopt(fd, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &req,
|
return setsockopt(fd, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &req,
|
||||||
sizeof(req));
|
sizeof(req));
|
||||||
}
|
}
|
||||||
|
@ -379,6 +379,11 @@ int pim_interface_config_write(struct vty *vty)
|
|||||||
ij->group_addr,
|
ij->group_addr,
|
||||||
group_str,
|
group_str,
|
||||||
sizeof(group_str));
|
sizeof(group_str));
|
||||||
|
if (ij->source_addr.s_addr == INADDR_ANY) {
|
||||||
|
vty_out(vty,
|
||||||
|
" ip igmp join %s\n",
|
||||||
|
group_str);
|
||||||
|
} else {
|
||||||
inet_ntop(AF_INET,
|
inet_ntop(AF_INET,
|
||||||
&ij->source_addr,
|
&ij->source_addr,
|
||||||
source_str,
|
source_str,
|
||||||
@ -386,6 +391,7 @@ int pim_interface_config_write(struct vty *vty)
|
|||||||
vty_out(vty,
|
vty_out(vty,
|
||||||
" ip igmp join %s %s\n",
|
" ip igmp join %s %s\n",
|
||||||
group_str, source_str);
|
group_str, source_str);
|
||||||
|
}
|
||||||
++writes;
|
++writes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user