Skip to content

[3/3] [nat] unify per-family NAT mapping - #336

Open
nicolaskagami wants to merge 1 commit into
nsk/nat-2-nat-familyfrom
nsk/nat-3-natmap
Open

[3/3] [nat] unify per-family NAT mapping#336
nicolaskagami wants to merge 1 commit into
nsk/nat-2-nat-familyfrom
nsk/nat-3-natmap

Conversation

@nicolaskagami

@nicolaskagami nicolaskagami commented Aug 6, 2026

Copy link
Copy Markdown

This PR:

  • Introduces a NatEntry and NatMap to replace duplicated v4/v6 logic (net -203 LOC).

This is the last of 3 PRs simplifying and de-duplicating some of the nat.rs code.

Obs:

  • I decided to upgrade the IPv6 log error from trace to error to match the IPv4 one but I'm happy to do it the other way around.
  • Renamed ipv4_generation to generation, since it applies to both even though the nexus API nomenclature is out-of-date.

@nicolaskagami nicolaskagami self-assigned this Aug 6, 2026
@nicolaskagami
nicolaskagami marked this pull request as ready for review August 6, 2026 18:00
@nicolaskagami
nicolaskagami force-pushed the nsk/nat-3-natmap branch 2 times, most recently from 789c30c to 61774ca Compare August 7, 2026 13:47
@nicolaskagami
nicolaskagami force-pushed the nsk/nat-3-natmap branch 2 times, most recently from 020bd98 to a1b1cb9 Compare August 7, 2026 21:36
@nicolaskagami
nicolaskagami marked this pull request as draft August 7, 2026 21:49
@nicolaskagami
nicolaskagami force-pushed the nsk/nat-3-natmap branch 3 times, most recently from ccd1c40 to d515c3d Compare August 10, 2026 17:14
@nicolaskagami
nicolaskagami marked this pull request as ready for review August 10, 2026 19:33

@bnaecker bnaecker left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks! I have a few nits and suggestions, but they're for new issues not this PR. Nice cleanup here.

Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs Outdated
Comment thread dpd/src/nat.rs
Comment thread dpd/src/nat.rs
Comment thread dpd/src/nat.rs
Comment thread dpd/src/nat.rs Outdated
Replace the duplicated v4/v6 mapping storage and logic with a single
NatEntry type and a NatMap generic over NatAddress; the public API keeps
its per-family signatures as thin wrappers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants