Skip to content

Fix TUN recovery and batch accounting; reuse FEC buffers - #70

Merged
AminMGMT merged 2 commits into
AminMGMT:mainfrom
dr-hoseyn:codex/tunnel-data-path
Oct 9, 2026
Merged

AminMGMT merged 2 commits into
AminMGMT:mainfrom
dr-hoseyn:codex/tunnel-data-path

Conversation

@dr-hoseyn

@dr-hoseyn dr-hoseyn commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

TUN write results were counted as packets although NativeTun returns bytes, partial carrier batches could be resent or miscounted, and permanent interface errors left a healthy-looking generation alive. FEC also rebuilt scratch buffers on the packet hot path.

Correct TUN/partial-batch accounting, retry only unsent tails, reject short scalar writes and return from pumps on permanent interface errors so the supervisor rebuilds the generation. Reuse bounded FEC transmit/parity/read scratch buffers, clear padding and release delivered references.

AutoMTU can raise packets above the configured initial MTU. Retain the grown GRE scratch buffer after wrapping instead of allocating it again for every larger packet. The raised-MTU benchmark avoids roughly 2 KiB and one allocation per packet; normal-size packets are unchanged. Every regression packet is decrypted and unwrapped to verify content. Earlier warmed FEC benchmarks reduced transmit allocations from three to zero and receive allocation bytes by about 88%. These use actual protocol code with fixture I/O, not WAN throughput measurements.

Validation: Complete original Linux CI passed full tests/races, coverage gates, analysis, fuzz, soak and builds. Latest exact-source payload/race checks and benchmarks passed at 152499a59ffc7c556ab67bd06c2b8a0296346021; old-source measurements reproduce repeated buffer growth. The latest full integrated suite and race/coverage gates also passed in the performance workflow; its baseline diagnostic-match issue was corrected in the linked baseline workflow.

Only existing production files change. No files or tests are added; supplemental fixtures/workflows stay on fork validation branches. No wire-format change.

@AminMGMT
AminMGMT merged commit 8b84ed4 into AminMGMT:main Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants