-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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: Add missing packet trace in handle_nat_fwd #19158
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
YutaroHayakawa
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.
area/monitor
Impacts monitoring, access logging, flow logging, visibility of datapath traffic.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
needs-backport/1.11
labels
Mar 16, 2022
/test |
YutaroHayakawa
force-pushed
the
issue-18909
branch
2 times, most recently
from
April 6, 2022 12:27
7a93b6b
to
ccf987b
Compare
qmonnet
requested changes
Apr 12, 2022
src_id variable in to_netdev in bpf_host.c is always zero, so safe to delete. Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
In to-netdev in bpf_host.c, the packet tracing is missing when the handle_nat_fwd uses tailcall. This PR adds new packet tracing inside the handle_nat_fwd, but there were two complicated issue in here. 1. handle_nat_fwd is called from to-netdev as well as to-overlay There are two possible caller for this function, so we needed to use IS_BPF_OVERLAY macro to make sure where it is called. 2. handle_nat_fwd does not always tailcalls Internally, it uses conditional tailcall. When it returns without tailcall, we will hit the packet tracing hook at the bottom of the to_netdev and have duplicated packet trace. We need to make sure whether we already trace the packet or not and skip it. Below is an example of simple ICMP Echo to outside of Pod network Before the fix (with tailcall) ``` <- endpoint ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> stack ... 10.0.1.185 -> 1.1.1.1 EchoRequest ["-> network" is missing here] <- network ... 1.1.1.1 -> 172.18.0.3 EchoReply <- host ... 1.1.1.1 -> 10.0.1.185 EchoReply -> endpoint ... 1.1.1.1 -> 10.0.1.185 EchoReply ``` Before the fix (without tailcall) ``` <- endpoint ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> stack ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> network ... 172.18.0.3 -> 1.1.1.1 EchoRequest <- network ... 1.1.1.1 -> 172.18.0.3 EchoReply <- host ... 1.1.1.1 -> 10.0.1.185 EchoReply -> endpoint ... 1.1.1.1 -> 10.0.1.185 EchoReply [no problem] ``` After the fix (with tailcall) ``` <- endpoint ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> stack ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> network ... 172.18.0.3 -> 1.1.1.1 EchoRequest <- network ... 1.1.1.1 -> 172.18.0.3 EchoReply <- host ... 1.1.1.1 -> 10.0.1.185 EchoReply -> endpoint ... 1.1.1.1 -> 10.0.1.185 EchoReply [no problem] ``` After the fix (without tailcall) ``` <- endpoint ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> stack ... 10.0.1.185 -> 1.1.1.1 EchoRequest -> network ... 172.18.0.3 -> 1.1.1.1 EchoRequest <- network ... 1.1.1.1 -> 172.18.0.3 EchoReply <- host ... 1.1.1.1 -> 10.0.1.185 EchoReply -> endpoint ... 1.1.1.1 -> 10.0.1.185 EchoReply [no duplicated trace, no problem] ``` Fixes: cilium#18909 Signed-off-by: Yutaro Hayakawa <yutaro.hayakawa@isovalent.com>
YutaroHayakawa
force-pushed
the
issue-18909
branch
from
April 25, 2022 02:10
ccf987b
to
651c05d
Compare
2 tasks
qmonnet
approved these changes
Apr 25, 2022
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.
Thanks!
joamaki
approved these changes
Apr 28, 2022
/test Job 'Cilium-PR-K8s-GKE' has 1 failure but they might be new flake since it also hit 1 known flake: #17628 (93.58) |
YutaroHayakawa
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
May 6, 2022
maintainer-s-little-helper
bot
moved this from Needs backport from master
to Backport pending to v1.10
in 1.11.5
May 9, 2022
aanm
added
backport-done/1.11
The backport for Cilium 1.11.x for this PR is done.
and removed
backport-pending/1.11
labels
May 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/monitor
Impacts monitoring, access logging, flow logging, visibility of datapath traffic.
backport-done/1.11
The backport for Cilium 1.11.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.
Please see the commit message for more details.
Fixes: #18909