-
Notifications
You must be signed in to change notification settings - Fork 3.2k
[v1.17] bpf: ipsec: improve handling of source security identity in encrypted-overlay code #38594
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
julianwiedmann
merged 4 commits into
cilium:v1.17
from
julianwiedmann:1.17-bpf-ipsec-secid
Apr 7, 2025
Merged
[v1.17] bpf: ipsec: improve handling of source security identity in encrypted-overlay code #38594
julianwiedmann
merged 4 commits into
cilium:v1.17
from
julianwiedmann:1.17-bpf-ipsec-secid
Apr 7, 2025
Conversation
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
Defer the ipcache lookups until we've handled the ctx_is_overlay() condition, and potentially already decided that the packet needs to be encrypted. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
3556401
to
874d8d7
Compare
/test |
No need to perform an ipcache lookup, the overlay mark embeds the identity of the source endpoint. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
We only need the source endpoint to obtain its security identity. But to-overlay already obtains this from the tunnel_key, so we can avoid the ipcache lookup. This also prevents any issues if the ipcache entry for a torn-down endpoint has already been removed. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
For a typical packet that exited a local pod, the from-container program also provides the source identity through the skb->mark. And the to-netdev program already extracts this identity - so we just need to pass this through to the ipsec hook. This helps on downgrade from v1.18, where bpf_lxc no longer immediately pushes the packet towards XFRM. Here the IPSec hook in to-netdev potentially handles a packet by an endpoint that's already torn down, and no longer has an ipcache entry. The packet would then be associated with WORLD_ID and leave unencrypted. Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
874d8d7
to
9366b2a
Compare
/test |
ldelossa
approved these changes
Apr 7, 2025
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.
Changes look good to me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/datapath
Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
backport/1.17
This PR represents a backport for Cilium 1.17.x of a PR that was merged to main.
feature/ipsec
Relates to Cilium's IPsec feature
kind/backports
This PR provides functionality previously merged into master.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-blocker/1.17
This issue will prevent the release of the next version of Cilium.
release-note/misc
This PR makes changes that have no direct user impact.
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.
Address a few areas of improvement in #37993.