Closed mhupfer closed 1 year ago
This is a somewhat surprising answer since the taskstats are received via a NETLINK_GENERIC protocol ...
The ethtool
, nl80211
, wireguard
, netfilter
, taskstats
are all NETLINK_GENERIC
based. They all register a generic netlink family at runtime (genl_register_family()
). In stead of bloating netlink-packet-generic
, please create a new crate task-stats
. You may take ethtool or mptcp-pm as example.
I also have a blog https://blog.grisge.info/posts/ethtool_netlink_intro/ explaining how generic netlink should be parsed.
You can simply implement the trait GenlFamily
, something like:
impl GenlFamily for TaskStats {
fn family_name() -> &'static str {
"TASKSTATS"
}
fn version(&self) -> u8 {
1
}
fn command(&self) -> u8 {
self.cmd.into()
}
}
The kernel has #define TASKSTATS_GENL_NAME "TASKSTATS"
. But your code is using lower case taskstats
as family name.
I will close this PR and create a new one which hopefully satisfies your requirements.
Netlink task statistics support