-
Notifications
You must be signed in to change notification settings - Fork 3.2k
bpf: nodeport: fix-up error check in rev_nodeport_lb*() for XDP #23119
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
Merged
joestringer
merged 1 commit into
cilium:master
from
julianwiedmann:nodeport-revnat-fixup
Jan 17, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1001,7 +1001,7 @@ static __always_inline int rev_nodeport_lb6(struct __ctx_buff *ctx, __u32 *ifind | |||||
#endif | ||||||
|
||||||
ret = lb6_extract_tuple(ctx, ip6, &l4_off, &tuple); | ||||||
if (ret) { | ||||||
if (ret < 0) { | ||||||
if (ret == DROP_NO_SERVICE || ret == DROP_UNKNOWN_L4) | ||||||
goto out; | ||||||
return ret; | ||||||
|
@@ -2006,7 +2006,7 @@ static __always_inline int rev_nodeport_lb4(struct __ctx_buff *ctx, __u32 *ifind | |||||
#endif /* ENABLE_EGRESS_GATEWAY */ | ||||||
|
||||||
ret = lb4_extract_tuple(ctx, ip4, &l4_off, &tuple); | ||||||
if (ret) { | ||||||
if (ret < 0) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
/* If it's not a SVC protocol, we don't need to check for RevDNAT: */ | ||||||
if (ret == DROP_NO_SERVICE || ret == DROP_UNKNOWN_L4) | ||||||
goto out; | ||||||
|
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.
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.
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 agree we should be using this style in general, but there are several other places in this file that are not yet using this. @julianwiedmann , would you mind following up on this separately to update these and other remaining
if (ret < 0)
cases in this file?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.
@joestringer yeah I plan to spend a few cycles on the wider error handling scheme.
Think with a bit of effort we should be able to banish
CTX_ACT_DROP
from all/most our own code (just return a proper negativeDROP_*
everywhere), and translate all helper calls (eg. forctx_redirect()
, don't we want someDROP_MISSED_BPF_REDIRECT
visibility anyway?). At which pointIS_ERR()
might just turn into a simpleret < 0
check.