summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2022-03-11 20:32:05 +0100
committerGitHub <noreply@github.com>2022-03-11 20:32:05 +0100
commit44f1c44c2d9a9f975e586bebd5fc01d2148b9182 (patch)
tree6d56192f75c4b80a16e0e9de245901643a1bf6b7
parentMerge pull request #10727 from ton31337/feature/adjust_release_doc (diff)
parentpimd: Add IGMP total groups and total source groups to statistics (diff)
downloadfrr-44f1c44c2d9a9f975e586bebd5fc01d2148b9182.tar.xz
frr-44f1c44c2d9a9f975e586bebd5fc01d2148b9182.zip
Merge pull request #10759 from opensourcerouting/feature/add_more_stats_for_igmp
pimd: Add IGMP total groups and total source groups to statistics
-rw-r--r--pimd/pim_cmd.c49
-rw-r--r--pimd/pim_igmp_stats.c2
-rw-r--r--pimd/pim_igmp_stats.h2
3 files changed, 42 insertions, 11 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 3b3d06e79..a9b57cabb 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -1305,8 +1305,10 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
FOR_ALL_INTERFACES (pim->vrf, ifp) {
struct pim_interface *pim_ifp;
- struct listnode *sock_node;
+ struct listnode *sock_node, *source_node, *group_node;
struct gm_sock *igmp;
+ struct gm_group *group;
+ struct gm_source *src;
pim_ifp = ifp->info;
@@ -1316,6 +1318,22 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
if (ifname && strcmp(ifname, ifp->name))
continue;
+ rx_stats.total_groups +=
+ pim_ifp->gm_group_list
+ ? listcount(pim_ifp->gm_group_list)
+ : 0;
+
+ for (ALL_LIST_ELEMENTS_RO(pim_ifp->gm_group_list, group_node,
+ group)) {
+ for (ALL_LIST_ELEMENTS_RO(group->group_source_list,
+ source_node, src)) {
+ if (pim_addr_is_any(src->source_addr))
+ continue;
+
+ rx_stats.total_source_groups++;
+ }
+ }
+
for (ALL_LIST_ELEMENTS_RO(pim_ifp->gm_socket_list, sock_node,
igmp)) {
igmp_stats_add(&rx_stats, &igmp->rx_stats);
@@ -1343,6 +1361,10 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
rx_stats.mtrace_req);
json_object_int_add(json_row, "unsupported",
rx_stats.unsupported);
+ json_object_int_add(json_row, "totalGroups",
+ rx_stats.total_groups);
+ json_object_int_add(json_row, "totalSourceGroups",
+ rx_stats.total_source_groups);
json_object_object_add(json, ifname ? ifname : "global",
json_row);
vty_json(vty, json);
@@ -1350,16 +1372,21 @@ static void igmp_show_statistics(struct pim_instance *pim, struct vty *vty,
vty_out(vty, "IGMP RX statistics\n");
vty_out(vty, "Interface : %s\n",
ifname ? ifname : "global");
- vty_out(vty, "V1 query : %u\n", rx_stats.query_v1);
- vty_out(vty, "V2 query : %u\n", rx_stats.query_v2);
- vty_out(vty, "V3 query : %u\n", rx_stats.query_v3);
- vty_out(vty, "V2 leave : %u\n", rx_stats.leave_v2);
- vty_out(vty, "V1 report : %u\n", rx_stats.report_v1);
- vty_out(vty, "V2 report : %u\n", rx_stats.report_v2);
- vty_out(vty, "V3 report : %u\n", rx_stats.report_v3);
- vty_out(vty, "mtrace response : %u\n", rx_stats.mtrace_rsp);
- vty_out(vty, "mtrace request : %u\n", rx_stats.mtrace_req);
- vty_out(vty, "unsupported : %u\n", rx_stats.unsupported);
+ vty_out(vty, "V1 query : %u\n", rx_stats.query_v1);
+ vty_out(vty, "V2 query : %u\n", rx_stats.query_v2);
+ vty_out(vty, "V3 query : %u\n", rx_stats.query_v3);
+ vty_out(vty, "V2 leave : %u\n", rx_stats.leave_v2);
+ vty_out(vty, "V1 report : %u\n", rx_stats.report_v1);
+ vty_out(vty, "V2 report : %u\n", rx_stats.report_v2);
+ vty_out(vty, "V3 report : %u\n", rx_stats.report_v3);
+ vty_out(vty, "mtrace response : %u\n", rx_stats.mtrace_rsp);
+ vty_out(vty, "mtrace request : %u\n", rx_stats.mtrace_req);
+ vty_out(vty, "unsupported : %u\n",
+ rx_stats.unsupported);
+ vty_out(vty, "total groups : %u\n",
+ rx_stats.total_groups);
+ vty_out(vty, "total source groups : %u\n",
+ rx_stats.total_source_groups);
}
}
diff --git a/pimd/pim_igmp_stats.c b/pimd/pim_igmp_stats.c
index 40851a452..0cf1bb1ec 100644
--- a/pimd/pim_igmp_stats.c
+++ b/pimd/pim_igmp_stats.c
@@ -43,4 +43,6 @@ void igmp_stats_add(struct igmp_stats *a, struct igmp_stats *b)
a->mtrace_rsp += b->mtrace_rsp;
a->mtrace_req += b->mtrace_req;
a->unsupported += b->unsupported;
+ a->total_groups += b->total_groups;
+ a->total_source_groups += b->total_source_groups;
}
diff --git a/pimd/pim_igmp_stats.h b/pimd/pim_igmp_stats.h
index a70a43355..47167efb3 100644
--- a/pimd/pim_igmp_stats.h
+++ b/pimd/pim_igmp_stats.h
@@ -33,6 +33,8 @@ struct igmp_stats {
uint32_t mtrace_rsp;
uint32_t mtrace_req;
uint32_t unsupported;
+ uint32_t total_groups;
+ uint32_t total_source_groups;
};
#if PIM_IPV == 4