rtnetlink interface statistics — the RTM_GETSTATS reads.
get/2 returns one interface's counters; list/1 dumps every
interface's. Both verbs are read-only — no CAP_NET_ADMIN needed.
The counters live on the :link field as a Linx.Netlink.Rtnl.Stats.Link64
sub-struct. IFLA_STATS_LINK_64 is the only stats class Linx decodes
today; the kernel exposes others (XSTATS, OFFLOAD_XSTATS, AF_SPEC) under
sibling attribute IDs and they will be added as the need arises.
The wire format — struct if_stats_msg (include/uapi/linux/rtnetlink.h)
and the IFLA_STATS_* attributes (include/uapi/linux/if_link.h) — is
declared with the Linx.Netlink.Codec DSL.
Summary
Types
Functions
Decodes a netlink message body into a t/0.
Encodes a t/0 into its netlink message body.
@spec get(Linx.Netlink.Socket.t(), binary()) :: {:ok, t()} | {:error, term()}
Returns the statistics for the link named name.
Resolves the interface index by name first, then issues a single
RTM_GETSTATS request with that index. Returns
{:error, %Linx.Netlink.Error{}} if there is no such interface.
@spec list(Linx.Netlink.Socket.t()) :: {:ok, [t()]} | {:error, term()}
Returns the statistics for every link in the socket's namespace.