Skip to content

Remove struct L4Protocol#1360

Draft
qmonnet wants to merge 3 commits intomainfrom
pr/qmonnet/rm-l4-proto
Draft

Remove struct L4Protocol#1360
qmonnet wants to merge 3 commits intomainfrom
pr/qmonnet/rm-l4-proto

Conversation

@qmonnet
Copy link
Member

@qmonnet qmonnet commented Mar 20, 2026

  • refactor(config): Rename VpcExposeNat.proto to proto_restriction
  • refactor(config,flow-filter,lpm,nat): Remove struct L4Protocol
  • feat(config): Prevent non-L4 NextHeader use in NAT proto restrictions

qmonnet added 3 commits March 20, 2026 10:42
We plan to remove type L4Protocol and use instead an Option<NextHeader>.
In that context, having "None" for a NAT object doesn't mean that NAT
rules should apply to no protocol at all, but rather that they are not
restricted to any L4 protocol. In other words, the field will designate
a "L4 protocol restriction" rather than a "L4 protocol covered by the
rule". Rename the field to .proto_restriction to reflect that.

Signed-off-by: Quentin Monnet <qmo@qmon.net>
Drop struct L4Protocol for NAT's protocol restrictions and use an
Option<NextHeader> instead, because... ???

Signed-off-by: Quentin Monnet <qmo@qmon.net>
We recently dropped the L4Protocol type to qualify the L4 restrictions
for a NAT set up, in favour of an Option<NextHeader>. This forces us to
be more careful when handling the field, because NextHeader can be any
IP's inner header, not just TCP or UDP.

To prevent unexpected usage of VpcExposeNat.proto_restriction, in
particular to prevent callers to randomly assign any existing NextHeader
variant, make the field private, and provide a setter than can fail.
Also add assertions where relevant, to make sure we only handle TCP or
UDP with that field.

Signed-off-by: Quentin Monnet <qmo@qmon.net>
@qmonnet qmonnet added dont-merge Do not merge this Pull Request area/nat Related to Network Address Translation (NAT) labels Mar 20, 2026
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) dont-merge Do not merge this Pull Request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant