Skip to content

Commit cec07a1

Browse files
author
Barry A. Trent
committed
pimd: add show commands for igmp proxy joins
Signed-off-by: Barry A. Trent <[email protected]>
1 parent f4d3222 commit cec07a1

File tree

1 file changed

+64
-4
lines changed

1 file changed

+64
-4
lines changed

pimd/pim_cmd.c

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ static void igmp_show_interfaces_single(struct pim_instance *pim,
567567
}
568568

569569
static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty,
570-
bool uj)
570+
bool uj, enum gm_join_type join_type)
571571
{
572572
struct interface *ifp;
573573
time_t now;
@@ -612,6 +612,10 @@ static void igmp_show_interface_join(struct pim_instance *pim, struct vty *vty,
612612
char source_str[INET_ADDRSTRLEN];
613613
char uptime[10];
614614

615+
if (ij->join_type != join_type &&
616+
ij->join_type != GM_JOIN_BOTH)
617+
continue;
618+
615619
pim_time_uptime(uptime, sizeof(uptime),
616620
now - ij->sock_creation);
617621
pim_inet4_dump("<grp?>", ij->group_addr, group_str,
@@ -1784,7 +1788,7 @@ DEFUN (show_ip_igmp_join,
17841788
if (!vrf)
17851789
return CMD_WARNING;
17861790

1787-
igmp_show_interface_join(vrf->info, vty, uj);
1791+
igmp_show_interface_join(vrf->info, vty, uj, GM_JOIN_STATIC);
17881792

17891793
return CMD_SUCCESS;
17901794
}
@@ -1822,7 +1826,61 @@ DEFUN (show_ip_igmp_join_vrf_all,
18221826
first = false;
18231827
} else
18241828
vty_out(vty, "VRF: %s\n", vrf->name);
1825-
igmp_show_interface_join(vrf->info, vty, uj);
1829+
igmp_show_interface_join(vrf->info, vty, uj, GM_JOIN_STATIC);
1830+
}
1831+
if (uj)
1832+
vty_out(vty, "}\n");
1833+
1834+
return CMD_SUCCESS;
1835+
}
1836+
1837+
DEFUN (show_ip_igmp_proxy,
1838+
show_ip_igmp_proxy_cmd,
1839+
"show ip igmp [vrf NAME] proxy [json]",
1840+
SHOW_STR
1841+
IP_STR
1842+
IGMP_STR
1843+
VRF_CMD_HELP_STR
1844+
"IGMP proxy join information\n"
1845+
JSON_STR)
1846+
{
1847+
int idx = 2;
1848+
bool uj = use_json(argc, argv);
1849+
struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx, uj);
1850+
1851+
if (!vrf)
1852+
return CMD_WARNING;
1853+
1854+
igmp_show_interface_join(vrf->info, vty, uj, GM_JOIN_PROXY);
1855+
1856+
return CMD_SUCCESS;
1857+
}
1858+
1859+
DEFUN (show_ip_igmp_proxy_vrf_all,
1860+
show_ip_igmp_proxy_vrf_all_cmd,
1861+
"show ip igmp vrf all proxy [json]",
1862+
SHOW_STR
1863+
IP_STR
1864+
IGMP_STR
1865+
VRF_CMD_HELP_STR
1866+
"IGMP proxy join information\n"
1867+
JSON_STR)
1868+
{
1869+
bool uj = use_json(argc, argv);
1870+
struct vrf *vrf;
1871+
bool first = true;
1872+
1873+
if (uj)
1874+
vty_out(vty, "{ ");
1875+
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
1876+
if (uj) {
1877+
if (!first)
1878+
vty_out(vty, ", ");
1879+
vty_out(vty, " \"%s\": ", vrf->name);
1880+
first = false;
1881+
} else
1882+
vty_out(vty, "VRF: %s\n", vrf->name);
1883+
igmp_show_interface_join(vrf->info, vty, uj, GM_JOIN_PROXY);
18261884
}
18271885
if (uj)
18281886
vty_out(vty, "}\n");
@@ -5764,7 +5822,7 @@ DEFPY (interface_ip_igmp_proxy,
57645822
IGMP_STR
57655823
"Proxy IGMP join/prune operations\n")
57665824
{
5767-
return CMD_SUCCESS;
5825+
return pim_process_ip_gmp_proxy_cmd(vty, !no);
57685826
}
57695827

57705828

@@ -8774,6 +8832,8 @@ void pim_cmd_init(void)
87748832
install_element(VIEW_NODE, &show_ip_igmp_join_group_vrf_all_cmd);
87758833
install_element(VIEW_NODE, &show_ip_igmp_static_group_cmd);
87768834
install_element(VIEW_NODE, &show_ip_igmp_static_group_vrf_all_cmd);
8835+
install_element(VIEW_NODE, &show_ip_igmp_proxy_cmd);
8836+
install_element(VIEW_NODE, &show_ip_igmp_proxy_vrf_all_cmd);
87778837
install_element(VIEW_NODE, &show_ip_igmp_groups_cmd);
87788838
install_element(VIEW_NODE, &show_ip_igmp_groups_vrf_all_cmd);
87798839
install_element(VIEW_NODE, &show_ip_igmp_groups_retransmissions_cmd);

0 commit comments

Comments
 (0)