diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-03-10 18:10:43 +0200 |
|---|---|---|
| committer | Donatas Abraitis <donatas@opensourcerouting.org> | 2022-03-13 19:31:34 +0200 |
| commit | f2058cb425b6f2e5efb3ac8608c47bcc2da5535d (patch) | |
| tree | fd6568d21b7d67043c2bfb19a24767949a2de6ac /pimd/pim_iface.c | |
| parent | 7547d5288e91d7bdc09aff4cd902d6cedbabfafc (diff) | |
pimd: Add IGMP join sent/failed statistics
```
exit1-debian-11# sh ip igmp statistics
IGMP statistics
Interface : global
V1 query : 0
V2 query : 0
V3 query : 0
V2 leave : 0
V1 report : 0
V2 report : 0
V3 report : 16
mtrace response : 0
mtrace request : 0
unsupported : 0
joins failed : 0
joins sent : 11
total groups : 4
total source groups : 0
exit1-debian-11# sh ip igmp statistics json
{
"global":{
"name":"global",
"queryV1":0,
"queryV2":0,
"queryV3":0,
"leaveV3":0,
"reportV1":0,
"reportV2":0,
"reportV3":16,
"mtraceResponse":0,
"mtraceRequest":0,
"unsupported":0,
"totalGroups":4,
"totalSourceGroups":0,
"joinsFailed":0,
"joinsSent":11
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'pimd/pim_iface.c')
| -rw-r--r-- | pimd/pim_iface.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c index d1b4966ec9..98fa4c4882 100644 --- a/pimd/pim_iface.c +++ b/pimd/pim_iface.c @@ -53,8 +53,8 @@ #if PIM_IPV == 4 static void pim_if_igmp_join_del_all(struct interface *ifp); static int igmp_join_sock(const char *ifname, ifindex_t ifindex, - struct in_addr group_addr, - struct in_addr source_addr); + struct in_addr group_addr, struct in_addr source_addr, + struct pim_interface *pim_ifp); #endif void pim_if_init(struct pim_instance *pim) @@ -576,7 +576,7 @@ void pim_if_addr_add(struct connected *ifc) close(ij->sock_fd); join_fd = igmp_join_sock( ifp->name, ifp->ifindex, ij->group_addr, - ij->source_addr); + ij->source_addr, pim_ifp); if (join_fd < 0) { char group_str[INET_ADDRSTRLEN]; char source_str[INET_ADDRSTRLEN]; @@ -1248,12 +1248,16 @@ static struct gm_join *igmp_join_find(struct list *join_list, } static int igmp_join_sock(const char *ifname, ifindex_t ifindex, - struct in_addr group_addr, struct in_addr source_addr) + struct in_addr group_addr, struct in_addr source_addr, + struct pim_interface *pim_ifp) { int join_fd; + pim_ifp->igmp_ifstat_joins_sent++; + join_fd = pim_socket_raw(IPPROTO_IGMP); if (join_fd < 0) { + pim_ifp->igmp_ifstat_joins_failed++; return -1; } @@ -1269,6 +1273,8 @@ static int igmp_join_sock(const char *ifname, ifindex_t ifindex, __func__, join_fd, group_str, source_str, ifindex, ifname, errno, safe_strerror(errno)); + pim_ifp->igmp_ifstat_joins_failed++; + close(join_fd); return -2; } @@ -1288,7 +1294,7 @@ static struct gm_join *igmp_join_new(struct interface *ifp, assert(pim_ifp); join_fd = igmp_join_sock(ifp->name, ifp->ifindex, group_addr, - source_addr); + source_addr, pim_ifp); if (join_fd < 0) { char group_str[INET_ADDRSTRLEN]; char source_str[INET_ADDRSTRLEN]; |
