Skip to content

fix(nat): Make stateful NAT code direction-independent #676

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

Merged
merged 1 commit into from
Jul 11, 2025

Conversation

qmonnet
Copy link
Member

@qmonnet qmonnet commented Jul 7, 2025

In commit b12d185 we changed the way we're handling directions in NAT stages. That commit mostly focused on stateful NAT, and the sensitive code portions in the module for stateful NAT were simply commented out, given that the code is not complete anyway.

Here we adjust the code for stateful NAT, on the same basis. We make it handle both source and destination NAT, in a single pipeline stage. This requires storing more information in the state tables, given that we need addresses and port for both directions.

In commit b12d185 ("feat(nat): Make NAT stage
direction-independant") we changed the way we're handling directions in
NAT stages. That commit mostly focused on stateful NAT, and the
sensitive code portions in the module for stateful NAT were simply
commented out, given that the code is not complete anyway.

Here we adjust the code for stateful NAT, on the same basis. We make it
handle both source and destination NAT, in a single pipeline stage. This
requires storing more information in the state tables, given that we
need addresses and port for both directions.

Signed-off-by: Quentin Monnet <[email protected]>
@qmonnet qmonnet added this to the GW R1 milestone Jul 7, 2025
@qmonnet qmonnet requested a review from mvachhar July 7, 2025 14:46
@qmonnet qmonnet self-assigned this Jul 7, 2025
@qmonnet qmonnet requested a review from a team as a code owner July 7, 2025 14:46
@qmonnet qmonnet added dont-merge Do not merge this Pull Request area/nat Related to Network Address Translation (NAT) labels Jul 7, 2025
@qmonnet qmonnet marked this pull request as draft July 8, 2025 10:37
@qmonnet qmonnet marked this pull request as ready for review July 8, 2025 10:50
@qmonnet
Copy link
Member Author

qmonnet commented Jul 9, 2025

I don't think this conflicts with #672. It doesn't touch the same files, the changes here do not rely on iptrie or other prefix-related constructs. Could we have this PR reviewed and merged, please?

@qmonnet qmonnet removed the dont-merge Do not merge this Pull Request label Jul 9, 2025
@mvachhar mvachhar added this pull request to the merge queue Jul 11, 2025
Merged via the queue into main with commit ad821f8 Jul 11, 2025
16 of 19 checks passed
@mvachhar mvachhar deleted the pr/qmonnet/nat-fix-stateful-directions branch July 11, 2025 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/nat Related to Network Address Translation (NAT)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants