Conversation
Tiny clean-up fixes for test_default_expose: Move done_reason check fist, move blank lines to the relevant locations. Signed-off-by: Quentin Monnet <qmo@qmon.net>
We do not support initiating a masqueraded connection for the destination of a packet (we only support initiating when masquerading the source side). As such, there is no need to ever look up for the destination translation information when trying to establish a new connection: this is dead code, and should be removed. Signed-off-by: Quentin Monnet <qmo@qmon.net>
We can already build NatTranslationData objects by instantiating the struct fields directly, but it takes six lines and is less readable than a one-liner builder call. If we want to build an empty instance, we have the default() method for that. Let's make new() accept arguments. Signed-off-by: Quentin Monnet <qmo@qmon.net>
In some cases, the flow table entries should contain NAT information that does not correspond to any allocated resources: this is the case for the entries for return flows, for example, where we do not actually need to reserve the IPs and ports to use via the allocator. Instead of holding pointers towards NAT objects that we later need to de-allocate, turn NatFlowState into an enum with a variant simply holding the computed values to use. We move NatFlowState and its sub-types into a dedicated file to provide a clean implementation, such that the changes in the other files are minimal and result in some code simplification. Signed-off-by: Quentin Monnet <qmo@qmon.net>
We do not actually need to allocate resources for reverse flow. As we only support initiating masquerading on the source side, there is no risk that a reverse flow would allocate resources, so no risk that IPs and ports used for reverse flows in the flow table actually collide with IPs and ports that the allocator would attempt to assign to other flows. Instead of allocating these resources, and holding references to allocated resources in the flow table, we simply hold an IP address and a port. Signed-off-by: Quentin Monnet <qmo@qmon.net>
Remove the destination masquerading tables. They are unused now that we do not allocate resources for reverse flows. 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.
WIP