-
Notifications
You must be signed in to change notification settings - Fork 3.4k
ipsec: Fix XFRM clean up #36031
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
ipsec: Fix XFRM clean up #36031
Conversation
e90f026
to
dc4f24d
Compare
When deleting old XFRM policies (ex. when disabling IPsec), we try to skip policies not installed by Cilium, just in case someone else has the good idea of using XFRM. We do so in function isXfrmPolicyCilium with various rules. Unfortunately, our XFRM IN policies changed in f108c0c ("ipsec: Simplify XFRM IN policies") and isXfrmPolicyCilium doesn't work anymore. So we need to adapt it to recognize the new XFRM IN policy. This bug resulted in Cilium never cleaning up the XFRM IN policy, which would cause one of our IPsec integration tests to always pass. Fixes: f108c0c ("ipsec: Simplify XFRM IN policies") Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
dc4f24d
to
18a91c1
Compare
/test |
@@ -890,6 +890,13 @@ func isXfrmPolicyCilium(policy netlink.XfrmPolicy) bool { | |||
policy.Priority == linux_defaults.IPsecFwdPriority { | |||
return true | |||
} | |||
// Check if its our catch-all IN policy. | |||
if policy.Dir == netlink.XFRM_DIR_IN && len(policy.Tmpls) == 1 { |
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.
really wish the kernel would just have an ID for policies that would identify them unique 😓
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.
Isn't that the ReqID?
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 think Louis wants an ID that we can ip x p delete/get [id]
. Therefore we could hard code an ID for cilium catch-all IN policy and check or delete it by ID.
When deleting old XFRM policies (ex. when disabling IPsec), we try to skip policies not installed by Cilium, just in case someone else has the good idea of using XFRM. We do so in function
isXfrmPolicyCilium
with various rules.Unfortunately, our XFRM IN policies changed in f108c0c ("ipsec: Simplify XFRM IN policies") and
isXfrmPolicyCilium
doesn't work anymore. So we need to adapt it to recognize the new XFRM IN policy.This bug resulted in Cilium never cleaning up the XFRM IN policy, which would cause one of our IPsec integration tests to always pass.
Ran it against the old
main
to show that it now fails as it should: https://github.com/cilium/cilium/actions/runs/11914957041/job/33204378536. And then rebased to catch the fix for the test.Fixes: #35831.