-
Notifications
You must be signed in to change notification settings - Fork 5
NAT: Split stateful/stateless, move to own crate #635
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
Conversation
2a08309
to
b5e75a6
Compare
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.
LGTM @qmonnet!!. There seems to be a small issue with the rust docs. Can you please fix it so that we can merge? Thanks!
Move the NAT code to a dedicated crate to keep the dataplane a thin binary relying on libraries (rather than implementing all the NAT logics inside of the dataplane package). Suggested-by: Fredi Raspall <[email protected]> Signed-off-by: Quentin Monnet <[email protected]>
Most of the code for stateful and stateless NAT is already dissociated, but the two modes share a common infrastructure whitin the "Nat" object. This commit separates them entirely, by duplicating the shared code to create a copy in the "stateless" submodule, and introducing a new StatelessNat object. The remaining code in lib.rs for stateful NAT is to be moved in a future commit. Motivations for separating the two modes into distinct pipeline stages include: - They have little code in common anyway - It will be clearer, when programming the dataplane, to explicitly handle a stateless or statefull object - The structures used by the two modes, in terms of configuration and internal state (for stateful NAT), are not the same. As a consequence, having both modes in a same object means instances need to keep some useless empty context for the chosen running mode, and it also makes it more difficult to protect the different objects for concurrent access. Signed-off-by: Quentin Monnet <[email protected]>
Following the separation of stateful and stateless NAT code into two different pipeline stages, rename the object for stateful NAT as StatefulNat, and move it to the dedicated module. Signed-off-by: Quentin Monnet <[email protected]>
Following the move of the NAT code to a dedicated crate, let's make sure we pass the correct directives to Clippy and for rustdoc. Also fix the minor reports for Clippy, and make it ignore "dead_code" only in the stateful module where it's relevant, not the whole crate. Also fix two rustdoc warnings emitted from the "routing" package. Signed-off-by: Quentin Monnet <[email protected]>
b5e75a6
to
98c6439
Compare
@Fredi-raspall sorry I thought these checks had run locally (they hadn't) and I didn't check CI results yesterday. It should be addressed now, let's see. Thanks for the review! |
Please see individual commit descriptions for details.