[pim] show ip igmp join
diff --git a/pimd/COMMANDS b/pimd/COMMANDS
index 8cfa671..56b15dd 100644
--- a/pimd/COMMANDS
+++ b/pimd/COMMANDS
@@ -14,6 +14,7 @@
verification commands:
show ip igmp interface IGMP interface information
+ show ip igmp join IGMP static join information
show ip igmp parameters IGMP parameters information
show ip igmp groups IGMP groups information
show ip igmp groups retransmissions IGMP group retransmission
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 23ad11f..9553361 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -34,6 +34,7 @@
#include "pim_vty.h"
#include "pim_mroute.h"
#include "pim_str.h"
+#include "pim_igmp.h"
#include "pim_igmpv3.h"
#include "pim_sock.h"
#include "pim_time.h"
@@ -455,6 +456,59 @@
}
}
+static void igmp_show_interface_join(struct vty *vty)
+{
+ struct listnode *node;
+ struct interface *ifp;
+ time_t now;
+
+ now = pim_time_monotonic_sec();
+
+ vty_out(vty,
+ "Interface Address Source Group Socket Uptime %s",
+ VTY_NEWLINE);
+
+ for (ALL_LIST_ELEMENTS_RO(iflist, node, ifp)) {
+ struct pim_interface *pim_ifp;
+ struct listnode *join_node;
+ struct igmp_join *ij;
+ struct in_addr pri_addr;
+ char pri_addr_str[100];
+
+ pim_ifp = ifp->info;
+
+ if (!pim_ifp)
+ continue;
+
+ if (!pim_ifp->igmp_join_list)
+ continue;
+
+ pri_addr = pim_find_primary_addr(ifp);
+ pim_inet4_dump("<pri?>", pri_addr, pri_addr_str, sizeof(pri_addr_str));
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->igmp_join_list, join_node, ij)) {
+ char group_str[100];
+ char source_str[100];
+ char uptime[10];
+
+ pim_time_uptime(uptime, sizeof(uptime), now - ij->sock_creation);
+ pim_inet4_dump("<grp?>", ij->group_addr, group_str, sizeof(group_str));
+ pim_inet4_dump("<src?>", ij->source_addr, source_str, sizeof(source_str));
+
+ vty_out(vty, "%-9s %-15s %-15s %-15s %6d %8s%s",
+ ifp->name,
+ pri_addr_str,
+ source_str,
+ group_str,
+ ij->sock_fd,
+ uptime,
+ VTY_NEWLINE);
+ } /* for (pim_ifp->igmp_join_list) */
+
+ } /* for (iflist) */
+
+}
+
static void show_interface_address(struct vty *vty)
{
struct listnode *ifpnode;
@@ -1547,6 +1601,19 @@
return CMD_SUCCESS;
}
+DEFUN (show_ip_igmp_join,
+ show_ip_igmp_join_cmd,
+ "show ip igmp join",
+ SHOW_STR
+ IP_STR
+ IGMP_STR
+ "IGMP static join information\n")
+{
+ igmp_show_interface_join(vty);
+
+ return CMD_SUCCESS;
+}
+
DEFUN (show_ip_igmp_groups,
show_ip_igmp_groups_cmd,
"show ip igmp groups",
@@ -4140,6 +4207,7 @@
install_element (INTERFACE_NODE, &interface_no_ip_pim_ssm_cmd);
install_element (VIEW_NODE, &show_ip_igmp_interface_cmd);
+ install_element (VIEW_NODE, &show_ip_igmp_join_cmd);
install_element (VIEW_NODE, &show_ip_igmp_parameters_cmd);
install_element (VIEW_NODE, &show_ip_igmp_groups_cmd);
install_element (VIEW_NODE, &show_ip_igmp_groups_retransmissions_cmd);
@@ -4175,6 +4243,7 @@
install_element (ENABLE_NODE, &clear_ip_pim_interfaces_cmd);
install_element (ENABLE_NODE, &show_ip_igmp_interface_cmd);
+ install_element (ENABLE_NODE, &show_ip_igmp_join_cmd);
install_element (ENABLE_NODE, &show_ip_igmp_parameters_cmd);
install_element (ENABLE_NODE, &show_ip_igmp_groups_cmd);
install_element (ENABLE_NODE, &show_ip_igmp_groups_retransmissions_cmd);
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index 7806c80..863cc03 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -38,6 +38,7 @@
#include "pim_ifchannel.h"
#include "pim_rand.h"
#include "pim_sock.h"
+#include "pim_time.h"
#include "pim_ssmpingd.h"
static void pim_if_igmp_join_del_all(struct interface *ifp);
@@ -917,9 +918,10 @@
return 0;
}
- ij->sock_fd = join_fd;
- ij->group_addr = group_addr;
- ij->source_addr = source_addr;
+ ij->sock_fd = join_fd;
+ ij->group_addr = group_addr;
+ ij->source_addr = source_addr;
+ ij->sock_creation = pim_time_monotonic_sec();
listnode_add(pim_ifp->igmp_join_list, ij);
@@ -975,6 +977,16 @@
return -4;
}
+ {
+ char group_str[100];
+ char source_str[100];
+ pim_inet4_dump("<grp?>", group_addr, group_str, sizeof(group_str));
+ pim_inet4_dump("<src?>", source_addr, source_str, sizeof(source_str));
+ zlog_info("%s: issued static igmp join for channel (S,G)=(%s,%s) on interface %s",
+ __PRETTY_FUNCTION__,
+ source_str, group_str, ifp->name);
+ }
+
return 0;
}
diff --git a/pimd/pim_igmp.h b/pimd/pim_igmp.h
index 95e60bf..d45f223 100644
--- a/pimd/pim_igmp.h
+++ b/pimd/pim_igmp.h
@@ -70,6 +70,7 @@
struct in_addr group_addr;
struct in_addr source_addr;
int sock_fd;
+ time_t sock_creation;
};
struct igmp_sock {
diff --git a/pimd/pim_version.h b/pimd/pim_version.h
index 546ace3..ef75791 100644
--- a/pimd/pim_version.h
+++ b/pimd/pim_version.h
@@ -23,7 +23,7 @@
#ifndef PIM_VERSION_H
#define PIM_VERSION_H
-#define PIMD_VERSION_STR "0.159"
+#define PIMD_VERSION_STR "0.160"
const char * const PIMD_VERSION;