Skip to content

Conversation

pchaigno
Copy link
Member

@pchaigno pchaigno commented Nov 19, 2024

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.

@pchaigno pchaigno added area/CI Continuous Integration testing issue or flake release-note/ci This PR makes changes to the CI. feature/ipsec Relates to Cilium's IPsec feature labels Nov 19, 2024
@pchaigno pchaigno added release-note/misc This PR makes changes that have no direct user impact. and removed release-note/ci This PR makes changes to the CI. labels Nov 19, 2024
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>
@pchaigno
Copy link
Member Author

/test

@pchaigno pchaigno marked this pull request as ready for review November 19, 2024 16:09
@pchaigno pchaigno requested a review from a team as a code owner November 19, 2024 16:09
@pchaigno pchaigno requested a review from ldelossa November 19, 2024 16:09
@pchaigno pchaigno enabled auto-merge November 20, 2024 14:22
@@ -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 {
Copy link
Contributor

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 😓

Copy link
Member Author

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?

Copy link
Member

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.

@maintainer-s-little-helper maintainer-s-little-helper bot added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Nov 21, 2024
@pchaigno pchaigno added this pull request to the merge queue Nov 21, 2024
Merged via the queue into cilium:main with commit e33c65b Nov 21, 2024
68 checks passed
@pchaigno pchaigno deleted the fix-xfrm-cleanup branch November 21, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/CI Continuous Integration testing issue or flake feature/ipsec Relates to Cilium's IPsec feature ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/misc This PR makes changes that have no direct user impact.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants