Repository navigation
fix(net): track gateway transit flows from its routed CIDRs - #930
Open
Semen Kolesnikov (Lotarcc) wants to merge 1 commit into
Open
Semen Kolesnikov (Lotarcc) wants to merge 1 commit into
Semen Kolesnikov (Lotarcc) wants to merge 1 commit into
Conversation
Semen Kolesnikov (Lotarcc)
force-pushed
the
fix/net-gateway-notrack-local-source
branch
from
October 17, 2026 14:39
3c7ce21 to
8843345
Compare
Contributor
Author
|
I've corrected the description. With two or more gateways in a pool, a reply that comes back through |
Contributor
Author
|
Patrick W. Healy (@phealy) Cameron Childress (@cchildress) I checked this against #915-#918: it still merges cleanly, and since #917 the new source rules cover only the gateway's assigned pool. Tests pass on current main. Could one of you review it when you have time? #990 and #993 are rebased too and are waiting for a workflow run approval. |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
On a gateway,
UNBOUNDED-NOTRACKkeeps conntrack for packets to the local Site(
-d <returnCIDR> -j RETURN) but not for packets from it. When a pod on a non-gateway node in thegateway's Site reaches a remote Site through the gateway, the request arrives on the tunnel with a
remote destination and is NOTRACKed, while the reply arrives with a local destination and is
tracked. Conntrack marks the reply INVALID and
KUBE-FORWARDdrops it.The chain now also returns
-s <cidr>for the routedCidrs of the gateway's own pools, so a gatewaythat carries both the request and the reply tracks both. Other local sources, such as node IPs, stay
untracked: their replies can bypass the gateway, and tracking only the request would make the rest of
that flow INVALID instead. NAT is unchanged.
With two or more gateways in a pool, this fixes only the flows whose reply comes back through the
same gateway. The sending node and the remote node each pick a gateway per flow from their own flow
hash (
hrw_selectinbpf/unbounded_encap.c), so a reply can reach a gateway that never saw therequest, and that gateway still drops it. Untracking the reply there is not an option: remote-initiated
flows to the same local CIDRs are masqueraded on that gateway and need conntrack, and the raw table
cannot tell the two apart. Making both ends pick the same gateway would cover that case; it is a
routing change, so it is not part of this PR.
reconcileFamilyandensureChainnow take the package'siptablesClientinterface so the chainlayout can be tested with the existing fake.
Reproduced on AKS (Azure CNI pod subnets, gateway mode) and in a kind lab (unmanaged Calico Site with
an Internal gateway pool, remote managed Site over GENEVE). 30 TCP connections per path, 1s apart,
fresh cluster per run:
On main, the member node's host network fails the same way when it sends from an address inside the
routedCidrs (in the lab, the
unbounded0address from its podCIDR), and passes with this change.Other paths are unchanged.
Part of #921.
Testing: new
TestReconcileFamilyTracksRoutedSources(fails without the source rules),go test ./internal/net/netlink/ ./cmd/unbounded-net-node/on Linux,make lint, kind lab runs.