-
Notifications
You must be signed in to change notification settings - Fork 11
Conntrack get netlink netfilter message types #12
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
base: main
Are you sure you want to change the base?
Conversation
eaaa88f to
c7c6939
Compare
c7c6939 to
568f8d5
Compare
f89a9cd to
e171eca
Compare
|
Thanks for the review @cathay4t . I've updated the tests and moved the conntrack constants to be private as you suggested. I noticed the nflog module still exposes public constants. Let me know if you want those refactored as well to hide the implementation details. Happy to do it in a follow up PR. I also added one more conntrack get UDP IPv6 test. |
cathay4t
left a comment
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.
All public data type should be protected by #[non_exhaustive] unless you are sure it will never changes in the future of Linux kernel.
e171eca to
40c4c4f
Compare
cathay4t
left a comment
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.
The netlink-packet-routes has changed nlas to attributes for better understanding.
The nlas is for hard for new developer to understand.
f002e81 to
c9d7dc3
Compare
|
Hi @cathay4t, I've addressed all of the feedback. NOTE: a normal crate user would not have to do this type of stuff. |
Implemented the following attributes required to successfully construct a conntrack get request: * iptuple * protoinfo * protoinfotcp * prototuple * tcp_flags * tuple Signed-off-by: Shivang K Raghuvanshi <[email protected]>
450e8b4 to
3fd1242
Compare
This refactors the crate to use type-safe enums for netfilter subsystems and message types, for a safer and more idiomatic API. - Introduces a `Subsystem` enum to replace raw `u8` identifiers for `NfLog` and `Conntrack` subsystems. - Introduces `ULogMessageType` and `ConntrackMessageType` enums to provide type safety for messages within each subsystem. - Makes the top-level `NetfilterMessage::message_type()` function private to guide users towards the safer pattern of matching on `NetfilterMessageInner`. - Updates the internal parsing logic in `buffer.rs` to use the new `Subsystem` enum. Signed-off-by: Shivang K Raghuvanshi <[email protected]>
3fd1242 to
d45921c
Compare
Add examples/dump_conntrack.rs to demonstrate how to dump connection tracking entries using the NLM_F_DUMP flag. Signed-off-by: Shivang K Raghuvanshi <[email protected]>
Depends on #11
Implemented the following types required to successfully construct a conntrack get request:
Also wrote tests to construct a conntrack get and dump request.