-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
bpf: nat: fully switch to snat_v*_rewrite_helpers() #29403
Merged
Merged
Conversation
This file contains 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
/test |
Fine to review, but I really want to rebase on-top of #29510 before merging 😬. |
gentoo-root
approved these changes
Nov 30, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic cleanup!
Similar to 495af07 ("bpf: Fix csum logic in snat_v4_rewrite_headers"), we mustn't mix the diff from the L4 port-rewrite into the diff used for the pseudo-header update. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
When a local endpoint sends an ICMP_FRAG_NEEDED message, it contains some inner packet that was originally addressed to the endpoint. The endpoint's address/port in this inner packet potentially needs to be SNATed again, to return it to its pre-revSNAT state. snat_v4_icmp_rewrite_egress_embedded() handles the .daddr / .dport rewrite of such an inner packet, based on an SNAT entry. Replace it with the common snat_v4_rewrite_headers() helper. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Use the common snat_v6_rewrite_headers() helper from the IPv6 RevSNAT path. This is essentially a 1-to-1 replacement, except that we need to ensure that the L4 port rewrite is skipped for ICMPV6_PKT_TOOBIG packets. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
When loading the ICMP identifier field, store it in-place instead of going through a temporary variable. Also as the `tuple` is zero-initialized, we don't need to do this again for the port field(s). Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
60401a0
to
660f435
Compare
/test |
@ysksuzuki mentioned that 14ca07d was helping quite a bit with complexity 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
feature/ipv6
Relates to IPv6 protocol support
feature/snat
Relates to SNAT or Masquerading of traffic
kind/bug
This is a bug in the Cilium logic.
kind/cleanup
This includes no functional changes.
kind/complexity-issue
Relates to BPF complexity or program size issues
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/misc
This PR makes changes that have no direct user impact.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
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.
Fix up a thinko in the new IPv6 SNAT rewrite helper (along what @gentoo-root fixed for IPv4 in #28768). Then finish the conversion of the SNAT code to the generic rewrite helpers.