-
Notifications
You must be signed in to change notification settings - Fork 3.4k
bpf: Skip policy enforcements for service loopback case #15321
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: Skip policy enforcements for service loopback case #15321
Conversation
91ba240
to
c759535
Compare
test-me-please |
3749b7f
to
0bae7f5
Compare
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.
Just posting to keep the context on changes, but I have a new version locally. I added the same for the IPv6 path and removed policy verdict notifications, but I'm still testing changes to address my second comment (ingress path). It's a bit more tortuous than I thought.
078659e
to
58fb824
Compare
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.
Fix itself LGTM, one minor nit for better code consistency. Would also be good to see an integration test to guard against regressions and run against different datapath modes.
The single failure is https://jenkins.cilium.io/job/Cilium-PR-K8s-1.20-kernel-4.9/953/testReport/junit/Suite-k8s-1/20/K8sDatapathConfig_AutoDirectNodeRoutes_Check_direct_connectivity_with_per_endpoint_routes/. |
We've hit a complexity issue on 4.9:
|
I've removed the v1.9 backport label until we address the complexity issue. |
It's a very corner case for the policy enforcement. Shall we just say - this won't work on v1.9, so just use v1.10 instead if you want this? |
It already works in v1.8, we can't break it in v1.9. |
Then we can list it as undefined behavior on < v1.10. If users are hit by this, then they 1) can switch to the socket-LB or 2) modify a netpol to accept packets from the svc loopback IP addr. |
Test for PR cilium#15321 - tests the case where a pod connects to itself via service clusterIP when selected by a policy. Signed-off-by: Aditi Ghag <aditi@cilium.io>
[ upstream commit 799bc1 ] Test for PR #15321 - tests the case where a pod connects to itself via service clusterIP when selected by a policy. Signed-off-by: Aditi Ghag <aditi@cilium.io>
Test for PR #15321 - tests the case where a pod connects to itself via service clusterIP when selected by a policy. Signed-off-by: Aditi Ghag <aditi@cilium.io>
[ upstream commit 69f10ed ] Test for PR cilium#15321 - tests the case where a pod connects to itself via service clusterIP when selected by a policy. backport-1.8: Resolved conflicts in test change and variable aligning Signed-off-by: Aditi Ghag <aditi@cilium.io> Signed-off-by: Glib Smaga <code@gsmaga.com>
[ upstream commit 69f10ed ] Test for PR #15321 - tests the case where a pod connects to itself via service clusterIP when selected by a policy. backport-1.8: Resolved conflicts in test change and variable aligning Signed-off-by: Aditi Ghag <aditi@cilium.io> Signed-off-by: Glib Smaga <code@gsmaga.com>
bpf: Skip policy enforcements for service loopback case
When an endpoint connects to itself via service clusterIP, we hairpin the
flow using a loopback IP address (configured using
--ipv4-service-loopback-address
).The destination clusterIP (on egress) and loopback IP (on ingress) map to incorrect identities.
As a result, the subsequent egress and ingress policy enforcements lead to packet drops.
This is evident from the monitor output -
<- endpoint 1844 flow 0x96c8d52 identity 55108->unknown state new ifindex 0 orig-ip 0.0.0.0: 10.12.0.123:58242 -> 172.20.0.130:80 tcp SYN Policy verdict log: flow 0x96c8d52 local EP ID 1844, remote ID world, proto 6, egress, action deny, match none, 169.254.42.1:58242 -> 10.12.0.123:80 tcp SYN
Skip policy enforcements (ingress and egress) in such cases since we
should allow a pod to connect to itself.
Release note
Signed-off-by: Aditi Ghag aditi@cilium.io
Co-authored-by: Paul Chaignon paul@cilium.io
Fixes: #11593