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: nodeport: update TTL / hop-limit on redirect #27299
Merged
julianwiedmann
merged 4 commits into
cilium:main
from
julianwiedmann:1.15-bpf-nodeport-ttl
Aug 8, 2023
Merged
bpf: nodeport: update TTL / hop-limit on redirect #27299
julianwiedmann
merged 4 commits into
cilium:main
from
julianwiedmann:1.15-bpf-nodeport-ttl
Aug 8, 2023
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
When forwarding from the XDP LB to a remote NAT backend, tail_nodeport_nat_egress_ipv4() potentially adds outer tunnel headers to the packet. The call to fib_redirect_v4() then decrements outer header's TTL, not the inner IPv4 header. Fix this by manually updating the TTL, and open-coding the redirect. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
When forwarding from the LB to a remote NAT backend, tail_nodeport_nat_egress_ipv6() uses fib_redirect() to pick the egress interface (we can't use fib_redirect_v6() as the packet might have been converted to IPv4, or tunnel-encapsulated in XDP). Thus the hop-limit currently doesn't get updated. Do so manually, before potentially adding the tunnel encapsulation. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
When forwarding replies from the LB (or EgressGW replies) back to the client, rev_nodeport_lb4() potentially adds outer tunnel headers to the packet. The call to fib_redirect_v4() then decrements outer header's TTL, not the inner IPv4 header. Fix this by manually updating the TTL, and open-coding the redirect. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
When forwarding replies from the LB back to the client, rev_nodeport_lb6() uses fib_redirect() to pick the egress interface (we can't use fib_redirect_v6() as the packet might have been converted to IPv4, or tunnel-encapsulated in XDP). Thus the hop-limit currently doesn't get updated. Do so manually. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
julianwiedmann
added
kind/bug
This is a bug in the Cilium logic.
sig/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
area/loadbalancing
Impacts load-balancing and Kubernetes service implementations
labels
Aug 5, 2023
/test |
julianwiedmann
added
the
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
label
Aug 7, 2023
julianwiedmann
changed the title
1.15 bpf nodeport ttl
bpf: nodeport: update TTL / hop-limit on redirect
Aug 7, 2023
julianwiedmann
added
the
backport/author
The backport will be carried out by the author of the PR.
label
Aug 7, 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.
One question for the first commit "fix TTL update for XDP in IPv4 NAT Egress path", thanks 😨
jschwinger233
approved these changes
Aug 8, 2023
maintainer-s-little-helper
bot
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Aug 8, 2023
julianwiedmann
added
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
and removed
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
labels
Aug 9, 2023
maintainer-s-little-helper
bot
moved this from Needs backport from main
to Backport pending to v1.14
in 1.14.1
Aug 9, 2023
1 task
ti-mo
added
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
and removed
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
labels
Aug 16, 2023
joestringer
moved this from Backport pending to v1.14
to Backport done to v1.14
in 1.14.2
Aug 25, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/loadbalancing
Impacts load-balancing and Kubernetes service implementations
backport/author
The backport will be carried out by the author of the PR.
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
kind/bug
This is a bug in the Cilium logic.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
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.
#23884 and #24422 introduced some inconsistencies and bugs in how the TTL / hop-limit field is updated when a packet is redirected from the ingress path to a remote destination. Fix them by adding
ipv*_l3()
calls, or shuffling the existing calls into the correct place.