-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add initial implementation for parsing /proc/net/netstat #304
base: master
Are you sure you want to change the base?
feat: add initial implementation for parsing /proc/net/netstat #304
Conversation
@eminence
|
/// Represents the data from `/proc/net/netstat`. | ||
#[derive(Debug, Clone)] | ||
#[cfg_attr(feature = "serde1", derive(Serialize, Deserialize))] | ||
pub struct Netstat { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should mark this struct as #[non_exhaustive]
, in case new fields get added in newer kernels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, good idea! I'll add #[non_exhaustive]
tcp_ext_tcp_ds_ack_ignored_dubious: from_str!(u64, expect!(tcp_ext.next())), | ||
tcp_ext_tcp_migrate_req_success: from_str!(u64, expect!(tcp_ext.next())), | ||
tcp_ext_tcp_migrate_req_failure: from_str!(u64, expect!(tcp_ext.next())), | ||
tcp_ext_tcp_ecn_rehash: from_str!(u64, expect!(tcp_ext.next())), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My 6.1.0 kernel doesn't have this field:
---- net::tests::test_netstats stdout ----
thread 'net::tests::test_netstats' panicked at procfs/src/net.rs:264:35:
called `Result::unwrap()` on an `Err` value: InternalError(bug at procfs-core/src/netstat.rs:534 (please report this procfs bug)
Internal Unwrap Error: NoneError)
We're going to want to find some older kernels to test this on. I'll try to capture some examples of /proc/net/netstat
on some random old machines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I'll provide the info about the kernel version I took it from
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@eminence
I've confirmed that these parameters
TcpExt:....
TcpDuplicateDataRehash TCPDSACKRecvSegs TCPDSACKIgnoredDubious TCPMigrateReqSuccess TCPMigrateReqFailure TCPECNRehash
come from
sh-4.2$ uname -r
5.10.205-195.807.amzn2.x86_64
Not sure if that's too representative/widely used
Hi Andrew @eminence |
Hello Andrew @eminence ! |
We still have to fix the issue about fields that are only in newer kernels. These should become |
Thanks understood, will adjust! |
Description
added parsing for
/proc/net/netstat
How was this PR tested?
added a unit test
Related issues
#295