Burn bridges to FreeBSD 7.x IGMP stats.

This commit is contained in:
Gleb Smirnoff 2015-02-19 19:36:54 +00:00
parent 0f0d5f6e45
commit de5ef1dfee
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=279017

View File

@ -1093,47 +1093,6 @@ icmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
}
}
#ifndef BURN_BRIDGES
/*
* Dump IGMP statistics structure (pre 8.x kernel).
*/
static void
igmp_stats_live_old(const char *name)
{
struct oigmpstat oigmpstat, zerostat;
size_t len = sizeof(oigmpstat);
if (zflag)
memset(&zerostat, 0, len);
if (sysctlbyname("net.inet.igmp.stats", &oigmpstat, &len,
zflag ? &zerostat : NULL, zflag ? len : 0) < 0) {
warn("sysctl: net.inet.igmp.stats");
return;
}
printf("%s:\n", name);
#define p(f, m) if (oigmpstat.f || sflag <= 1) \
printf(m, oigmpstat.f, plural(oigmpstat.f))
#define py(f, m) if (oigmpstat.f || sflag <= 1) \
printf(m, oigmpstat.f, oigmpstat.f != 1 ? "ies" : "y")
p(igps_rcv_total, "\t%u message%s received\n");
p(igps_rcv_tooshort, "\t%u message%s received with too few bytes\n");
p(igps_rcv_badsum, "\t%u message%s received with bad checksum\n");
py(igps_rcv_queries, "\t%u membership quer%s received\n");
py(igps_rcv_badqueries,
"\t%u membership quer%s received with invalid field(s)\n");
p(igps_rcv_reports, "\t%u membership report%s received\n");
p(igps_rcv_badreports,
"\t%u membership report%s received with invalid field(s)\n");
p(igps_rcv_ourreports,
"\t%u membership report%s received for groups to which we belong\n");
p(igps_snd_reports, "\t%u membership report%s sent\n");
#undef p
#undef py
}
#endif /* !BURN_BRIDGES */
/*
* Dump IGMP statistics structure.
*/
@ -1143,27 +1102,6 @@ igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
struct igmpstat igmpstat, zerostat;
size_t len;
#ifndef BURN_BRIDGES
if (live) {
/*
* Detect if we are being run against a pre-IGMPv3 kernel.
* We cannot do this for a core file as the legacy
* struct igmpstat has no size field, nor does it
* export it in any readily-available symbols.
*/
len = 0;
if (sysctlbyname("net.inet.igmp.stats", NULL, &len, NULL,
0) < 0) {
warn("sysctl: net.inet.igmp.stats");
return;
}
if (len < sizeof(igmpstat)) {
igmp_stats_live_old(name);
return;
}
}
#endif /* !BURN_BRIDGES */
len = sizeof(igmpstat);
if (live) {
if (zflag)