Skip to content
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: nodeport: fix handling of stale CT entry with CT_REPLY #23894

Merged
merged 1 commit into from Mar 14, 2023

Conversation

julianwiedmann
Copy link
Member

@julianwiedmann julianwiedmann commented Feb 21, 2023

Drive-by fix for a weird corner case in the nodeport CT code.

@maintainer-s-little-helper maintainer-s-little-helper bot added the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 21, 2023
@julianwiedmann julianwiedmann added kind/bug This is a bug in the Cilium logic. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages. release-note/bug This PR fixes an issue in a previous release of Cilium. labels Feb 21, 2023
@maintainer-s-little-helper maintainer-s-little-helper bot removed the dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. label Feb 21, 2023
The nodeport code creates its own CT entry for a service connection to
a non-DSR backend. While doing so, the initial CT lookup might find a stale
(non-nodeport) CT entry that needs to be re-created.

CT_REPLY in particular needs consideration here - regardless of the
entry's rev_nat_index, we don't expect incoming SVC requests to be a
*reply* to some existing connection. So we always need to re-create such
entries.

Typically ct_create() is only called after the lookup returned a CT_NEW
ct_status. Meaning that the CT tuple was already flipped by ct_lookup().
If we also call ct_create() after CT_REPLY, then the tuple needs to be
flipped first. Otherwise the new CT entry is created for a tuple in the
wrong direction.

Signed-off-by: Julian Wiedmann <jwi@isovalent.com>
@julianwiedmann
Copy link
Member Author

/test

@julianwiedmann
Copy link
Member Author

/test-1.25-4.19

@julianwiedmann julianwiedmann marked this pull request as ready for review March 2, 2023 13:34
@julianwiedmann julianwiedmann requested a review from a team as a code owner March 2, 2023 13:34
@julianwiedmann julianwiedmann requested a review from brb March 10, 2023 07:19
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

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

Nice catch!

@julianwiedmann julianwiedmann added the ready-to-merge This PR has passed all tests and received consensus from code owners to merge. label Mar 13, 2023
@borkmann borkmann merged commit 685352f into cilium:master Mar 14, 2023
@julianwiedmann julianwiedmann deleted the 1.14-nodeport-stale-ct-entry branch March 14, 2023 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. sig/datapath Impacts bpf/ or low-level forwarding details, including map management and monitor messages.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants