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: minor LB cleanups #25061
bpf: minor LB cleanups #25061
Conversation
/test Job 'Cilium-PR-K8s-1.25-kernel-5.4' failed: Click to show.Test Name
Failure Output
Jenkins URL: https://jenkins.cilium.io/job/Cilium-PR-K8s-1.25-kernel-5.4/89/ If it is a flake and a GitHub issue doesn't already exist to track it, comment |
ct_create*() can result in CT-related DROP reasons. Return those to the caller, instead of a generic DROP_NO_SERVICE. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
CT_RELATED is only relevant for CT tuples that have TUPLE_F_RELATED set. The LB code doesn't build such tuples - it uses ct_lb_lookup(), and hence never passes through the relevant ICMP code in ct_lookup(). So treat this as unexpected condition, and drop the packet. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
A CT lookup with CT_SERVICE scope will only look up in the reverse direction, and thus __ct_lookup*() never returns CT_REOPENED or CT_ESTABLISHED (they would always get translated to CT_REPLY). So treat these two as invalid result. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
Hide the details of managing the csum_offset struct. It's just something we need when actually re-writing the packet. For lb4_rev_nat(), we now consistently apply the micro-optimization to only initialize the struct for packets with a L4 header. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
c5f8587
to
63e3520
Compare
/test |
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.
Looks good to me.
__be32 old_sip, new_sip, sum = 0; | ||
int ret; | ||
|
||
cilium_dbg_lb(ctx, DBG_LB4_REVERSE_NAT, nat->address, nat->port); | ||
|
||
if (has_l4_header) | ||
csum_l4_offset_and_flags(tuple->nexthdr, &csum_off); |
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.
Offtopic question: why don't we set off->offset
for IPPROTO_ICMP in csum_l4_offset_and_flags?
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.
I've wondered about that myself recently while poking around the NAT code :) (as it requires us to set the offset manually ...). Best I could come up with was that we didn't need it in the pure LB paths.
So one option would be to declare the existing helpers as LB-specific, and introduce generic variants that do handle ICMP.
A few small LB cleanups that have accumulated. Ideally the first
twothree will make review of a pending fix a bit easier.