Repository navigation
fix(sock): bind specific IPv6 addresses v6-only - #5339
Conversation
A specific IPv6 address such as [::1] can't carry IPv4, but we cleared IPV6_V6ONLY on every IPv6 socket. Linux forces v6-only on such a bind, Windows does not, so noq-udp saw a dual-stack socket, set IPv4-level options on it, and Windows rejected them with WSAEINVAL. Only clear the flag for [::] and IPv4-mapped binds; set it otherwise. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d327d58 to
a0e8577
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merge summary: CI green and Codex reviewed the head (a0e8577) with no findings. No changes made at merge time; enabling auto-merge on the current head. (Written by Claude Opus 5.5) |
|
Dequeued by the merge queue: (Written by Claude Opus 5.5) |
Problem
The nightly
Tests (rs windows-test)job has failed every night since it was added:noq::tests::pinned_ipv6_connection(and usually..._with_host_override) panic withCreateEndpoint(Os { code: 10022 })(WSAEINVAL). Any real server or client binding a specific IPv6 address on Windows hits the same error.moq_sock::bind::udpclearedIPV6_V6ONLYon every IPv6 socket, including[::1]. Linux forces v6-only when a socket binds a specific IPv6 address, so this was harmless there. Windows keeps the cleared flag, so noq-udp'sUdpSocketState::newreads the socket as dual-stack and sets IPv4-level options on it, which Windows rejects with WSAEINVAL. Upstream quinn-udp has the same logic. The bug is ours: the socket claims an IPv4 side it can't have.Approach
Clear
IPV6_V6ONLYonly for[::]and IPv4-mapped binds. Set it for every other IPv6 address, which matches what Linux already does. This also coversbind::tcp, which shares the helper. A newmoq-socktest checks that a[::1]bind comes back v6-only. Only Windows can regress it, and it runs there in the nightlywindows-test.The other Windows failure (
a_refused_upgrade_keeps_websocket, one night) was "could not bind a matching TCP and UDP port after 20 attempts". That is a separate port-collision flake.Verification
Windows was verified through a temporary commit, now dropped. It added a step to the
windowsjob inplatform.ymlthat ranjust rs test -p moq-sock -p moq-tokio, plus a diagnostic that ran noq's socket setup on a[::1]socket withIPV6_V6ONLYboth off and on.Impact
Alternatives
Follow-ups
connection::tests::quic_winning_opens_one_sessionfails locally under heavy load, onmaintoo (QUIC loses the race to WebSocket). It is unrelated to this change.(Written by Opus 5.5)
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.