Repository navigation
Keep conntrack counters current for offloaded flows - #13496
Merged
caseydavenport merged 13 commits intoSep 7, 2026
Merged
caseydavenport merged 13 commits into
caseydavenport merged 13 commits into
Conversation
Flow log packet and byte counts come off the conntrack entry, which the flowtable fast path never updates.
Conntrack accounting stays up to date for offloaded flows, so flow logs report their real packet and byte counts.
…counters # Conflicts: # app-policy/deps.txt # cmd/deps.txt # cni-plugin/deps.txt # felix/deps.txt # felix/fv/flowtable_test.go # go.mod # go.sum # kube-controllers/deps.txt # node/deps.txt
Counter is a *bool on the fork now, matching Set.AutoMerge.
caseydavenport
marked this pull request as ready for review
August 31, 2026 18:57
fasaxc
requested changes
Sep 2, 2026
A leftover probe flowtable turns the next probe's add into an update, and old kernels don't check flags on the update path.
Imports use the original module path, so a path-changing replace dropped the module from deps.txt entirely.
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
It changes Felix’s nftables dataplane behavior with kernel-version-dependent probing and introduces a temporary forked dependency, which warrants final human review despite test coverage.
Pull request overview
This PR fixes flow log packet/byte counts freezing when connections are offloaded to the nftables software flowtable by enabling the flowtable “counter” flag when supported, while probing for kernel support at Felix startup and warning (not failing) when counters aren’t available.
Changes:
- Add startup probing for flowtable counter-flag support and plumb the result into nftables table programming.
- Program the flowtable with the counter flag (when supported) and add unit/FV coverage for counter behavior.
- Temporarily replace upstream
sigs.k8s.io/knftableswith the Project Calico fork revision that exposes the needed flowtable counter support, and adjust deps reporting to account for module replacements.
File summaries
| File | Description |
|---|---|
| node/deps.txt | Record forked knftables module in generated deps output. |
| kube-controllers/deps.txt | Record forked knftables module in generated deps output. |
| hack/cmd/deps/deps.go | Update deps generator to match imports by original module path but report replaced module/version. |
| go.sum | Add checksums for the forked knftables version; remove upstream knftables sums. |
| go.mod | Add replace to use github.com/projectcalico/knftables until upstream release includes counter support. |
| felix/nftables/table.go | Add FlowtableCounter option and program flowtable Counter flag during apply. |
| felix/nftables/table_test.go | Unit test coverage for flowtable counter flag off/on programming. |
| felix/nftables/flowoffload_detect.go | Extend probing to detect both flowtable support and counter-flag support (kernel version gating). |
| felix/nftables/flowoffload_detect_test.go | Unit tests for supported/unsupported/counter-unsupported scenarios, including leftover-probe behavior. |
| felix/fv/flowtable_test.go | FV test to ensure conntrack counters continue increasing for offloaded flows. |
| felix/deps.txt | Record forked knftables module in generated deps output. |
| felix/dataplane/linux/int_dataplane.go | Wire probe results into Felix startup: disable offload if unsupported; warn if counters unsupported; pass counter support into nftables table options. |
| cni-plugin/deps.txt | Record forked knftables module in generated deps output. |
| cmd/deps.txt | Record forked knftables module in generated deps output. |
| app-policy/deps.txt | Record forked knftables module in generated deps output. |
Review details
- Files reviewed: 14/15 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…counters # Conflicts: # go.sum
…lowtable-ct-counters # Conflicts: # go.mod
Flowtable counter support is in knftables master, so the projectcalico fork replace is no longer needed.
fasaxc
approved these changes
Sep 7, 2026
Member
|
LGTM |
caseydavenport
added a commit
that referenced
this pull request
Sep 7, 2026
danudey
pushed a commit
to danudey/calico
that referenced
this pull request
Sep 17, 2026
) (projectcalico#13804) (cherry picked from commit 5c55846)
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.
Flow logs take their packet and byte counts from the conntrack entry, but the software flowtable fast path bypasses the conntrack hook, so those counts freeze the moment a flow is offloaded. Setting the flowtable's counter flag keeps the kernel updating them, and Felix probes for the flag at startup since it needs kernel 5.13 or later, warning rather than failing when the kernel won't take it.
Depends on kubernetes-sigs/knftables#47. Until that merges, go.mod points at the projectcalico fork.
Related: CORE-13614