Conversation
Member
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
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.