Skip to content

Conversation

jrajahalme
Copy link
Member

@jrajahalme jrajahalme commented Jun 7, 2023

CreateOrUpdateRedirect called nil revertFunc when any local error was returned. This was done using the pattern return 0, err, nil, nil which sets the revertFunc return variable as nil, but this was called on a deferred function to revert any changes on a local error.

Fix this by calling ReverStack.Revert() directly on the deferred function, and setting the return variable if there was no local error.

Another panic was possible when updating an existing redirect the proxy port of which had been released. Check that the proxy port is initialized before reusing the (possibly stale) redirect.

This was hit any time a CiliumNetworkPolicy referred to a non-existing listener.

Add a test case that reproduced the panic and works after the fix.

Increment proxy port on failure for non-DNS ports, even if DNS has been configured with a static port.

Fixed Cilium agent crash when policy refers to a non-existing Envoy listener.

CreateOrUpdateRedirect called nil revertFunc when any local error was
returned. This was done using the pattern `return 0, err, nil, nil` which
sets the revertFunc return variable as nil, but this was called on a
deferred function to revert any changes on a local error.

Fix this by calling ReverStack.Revert() directly on the deferred
function, and setting the return variable if there was no local error.

This was hit any time a CiliumNetworkPolicy referred to a non-existing
listener.

Add a test case that reproduced the panic and works after the fix.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme jrajahalme added kind/bug This is a bug in the Cilium logic. release-note/bug This PR fixes an issue in a previous release of Cilium. release-blocker/1.13 labels Jun 7, 2023
@jrajahalme jrajahalme requested a review from a team as a code owner June 7, 2023 08:16
@jrajahalme jrajahalme requested a review from sayboras June 7, 2023 08:16
Only update an existing redirect if it is configured. This prevents
Cilium agent panic when trying to update redirect with released proxy
port.

This has only been observed to happen with explicit Envoy listener
redirects in CiliumNetworkPolicy when the listener has been removed.

Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Increment non-DNS proxy ports on failure even if DNS has been configured
with a static port.

Fixes: cilium#20896
Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
@jrajahalme
Copy link
Member Author

/test

Copy link
Member

@sayboras sayboras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✔️

@jrajahalme jrajahalme self-assigned this Jun 7, 2023
@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 Jun 7, 2023
@dylandreimerink dylandreimerink merged commit 894aa4e into cilium:main Jun 7, 2023
@pchaigno pchaigno mentioned this pull request Jun 9, 2023
5 tasks
@michi-covalent michi-covalent added backport-done/1.13 The backport for Cilium 1.13.x for this PR is done. and removed backport-pending/1.13 labels Jun 9, 2023
@jrajahalme
Copy link
Member Author

Added Fixes, additional backports to 1.12, 1.11

@nbusseneau nbusseneau mentioned this pull request Jun 22, 2023
7 tasks
@nbusseneau nbusseneau mentioned this pull request Jun 22, 2023
10 tasks
@tklauser tklauser added backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. and removed backport-pending/1.11 labels Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-done/1.11 The backport for Cilium 1.11.x for this PR is done. backport-done/1.12 The backport for Cilium 1.12.x for this PR is done. backport-done/1.13 The backport for Cilium 1.13.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.
Projects
No open projects
Status: Released
Development

Successfully merging this pull request may close these issues.

7 participants