Skip to content

fix: split io_uring UDP availability gate#133

Merged
igorls merged 2 commits into
mainfrom
codex/io-uring-udp-gate
Jul 6, 2026
Merged

fix: split io_uring UDP availability gate#133
igorls merged 2 commits into
mainfrom
codex/io-uring-udp-gate

Conversation

@igorls

@igorls igorls commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

  • Split UDP io_uring availability from the TUN-reader gate so UDP sockets can activate the recvmsg/sendmsg ring independently.
  • Keep TUN io_uring reads disabled pending bare-metal TUN validation, with explicit startup logging for both the TUN and UDP path decisions.
  • Add tests for UDP/TUN gate selection and a Linux loopback UDP-ring receive probe when the runtime probe succeeds.
  • Update performance/module docs to describe the runtime-gated UDP ring and poll+recvmsg fallback.

Validation

  • zig fmt src/net/io_uring.zig src/main.zig
  • zig build test --summary all on Windows: 120/120 tests passed
  • zig build --summary all on Windows
  • zig build -Dtarget=x86_64-linux-gnu -Dno-sodium=true --summary all
  • zig build -Dtarget=aarch64-macos -Dno-sodium=true --summary all
  • zig build -Dtarget=x86_64-freebsd -Dno-sodium=true --summary all
  • Native WSL Ubuntu: zig build test -Dno-sodium=true --cache-dir /tmp/meshguard-zig-cache --global-cache-dir /tmp/meshguard-zig-global --summary all, 246/246 tests passed
  • WSLC Alpine container: bind-mounted repo, installed Zig 0.16.0, ran the same zig build test -Dno-sodium=true with /tmp caches, 246/246 tests passed
  • WSLC lifecycle smoke: wslc run -d, wslc exec, wslc stop, and wslc remove all worked against alpine:latest

Note: the Linux/WSLC test runs print pre-existing unexpected errno: 9 stack traces from SWIM tests that intentionally catch fake-socket send failures; the final build summaries reported success.

Closes #128

Copilot AI review requested due to automatic review settings July 6, 2026 07:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR separates Linux io_uring availability gating for the UDP recvmsg/sendmsg ring from the (still-disabled) TUN reader gate, so UDP can activate independently while TUN io_uring reads remain disabled pending bare-metal validation.

Changes:

  • Introduces independent UDP/TUN io_uring availability gates and a small helper (selectUdpPath) to classify the chosen UDP path.
  • Updates startup logging to clearly report the chosen TUN reader path and UDP path (including init failure error names).
  • Adds tests for gate-selection logic and a Linux loopback receive probe for the UDP ring; updates docs to reflect runtime-gated UDP ring support and fallback behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/net/io_uring.zig Adds split availability gates, UdpPath selection helper, and new tests including a UDP ring loopback probe.
src/main.zig Uses the split gates, attempts UDP ring init only when runtime-available, and improves startup logging with clearer fallback reasons.
README.md Documents runtime-gated UDP io_uring ring support and the still-disabled TUN reader.
docs/reference/modules.md Updates module description to reflect UDP ring + TUN reader gate responsibilities.
docs/concepts/architecture.md Updates architecture docs to reflect the split io_uring responsibilities.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/net/io_uring.zig
Comment on lines +455 to +457
var ring: UdpRing = undefined;
try ring.init(rx.fd);
defer ring.deinit();
@igorls igorls merged commit ab9d346 into main Jul 6, 2026
5 checks passed
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.

Split and validate io_uring UDP availability gate

2 participants