eminence / procfs

Rust library for reading the Linux procfs filesystem
Other
367 stars 106 forks source link

In the UnixNetEntry structure there are missing fields #312

Open acsecengtesting opened 3 months ago

acsecengtesting commented 3 months ago

In procfs on Linux - Num RefCount Protocol Flags Type St Inode Path

The docs say

[non_exhaustive]

pub struct UnixNetEntry { pub ref_count: u32, pub socket_type: u16, pub state: UnixState, pub inode: u64, pub path: Option<PathBuf>, }

What is the best way to get the additional fields added? I'm mainly interested in Flags. Happy to do some legwork but am not an experienced rust developer so might need a bit of help :)

eminence commented 2 months ago

Hi, can you give an example of a /proc/net/unix with some non-zero flags? Adding support to the Flags field should be pretty easy, but this field seems to be zero on all my machines. So having a version with non-zery entries will help when writing tests for this

Hwatwasthat commented 2 months ago

The set of potential flags appear to be here: https://elixir.bootlin.com/linux/v6.10.2/source/include/net/sock.h#L916. I haven't seen any flags set on my system but did see a stackoverflow post where one was set. Still seems quite rare though (at least in the limited boxes I have to look at).

I'd be willing to look at adding this in, if my poking about hadn't hinted at it!

eminence commented 1 month ago

ah, well having the a link to the source is great. I'd still like to see some real examples, if possible. Or a mini-research project for someone could be to figure out how to generate a unix socket with a non-zero flag. I'd be happy to accept a PR to add this field