HomeFreeBSD

netstat: switch to using the sysctl-exported stats for live stats

Description

netstat: switch to using the sysctl-exported stats for live stats

Now that we export the relevant stats via the net.route.stats sysctl,
switch to using that to avoid having to dig around in mem(4) for live
kernel statistics. Based on callers of kresolve_list(), this is the
last live path using mem(4) that could be functional today.

Tested both with netstat -rs and netstat -rs -M.

Note that this will not be able to extract stats from a running kernel
that predates 3360a15898 / 1500026, but this can be worked around by
specifying -M /dev/mem explicitly in the interim to fallback to
libkvm against /dev/mem.

Reviewed by: glebius, markj, zlei
Differential Revision: https://reviews.freebsd.org/D47231

Details

Provenance
kevansAuthored on Oct 24 2024, 4:53 PM
Reviewer
glebius
Differential Revision
D47231: netstat: convert routing statistics to a sysctl
Parents
rG2f395cfda8b5: tcp cc: Remove a stray semicolon
Branches
Unknown
Tags
Unknown