Burn bridges to FreeBSD 7.x IGMP stats.
This commit is contained in:
parent
0f0d5f6e45
commit
de5ef1dfee
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user