Skip to content

fix(sock): bind specific IPv6 addresses v6-only - #5339

Merged
kixelated merged 1 commit into
mainfrom
fix/windows-ipv6-noq-bind
Oct 13, 2026
Merged

kixelated merged 1 commit into
mainfrom
fix/windows-ipv6-noq-bind

Conversation

@kixelated

@kixelated kixelated commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

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 with CreateEndpoint(Os { code: 10022 }) (WSAEINVAL). Any real server or client binding a specific IPv6 address on Windows hits the same error.

moq_sock::bind::udp cleared IPV6_V6ONLY on 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's UdpSocketState::new reads 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_V6ONLY only for [::] and IPv4-mapped binds. Set it for every other IPv6 address, which matches what Linux already does. This also covers bind::tcp, which shares the helper. A new moq-sock test checks that a [::1] bind comes back v6-only. Only Windows can regress it, and it runs there in the nightly windows-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 windows job in platform.yml that ran just rs test -p moq-sock -p moq-tokio, plus a diagnostic that ran noq's socket setup on a [::1] socket with IPV6_V6ONLY both off and on.

Impact

  • No public API or wire change. Behavior change: a socket bound to a specific IPv6 address is now v6-only on every platform, as it already was on Linux.

Alternatives

  • Have noq-udp tolerate WSAEINVAL on the IPv4 options. Rejected because it hides the mismatch rather than fixing the socket we hand it.

Follow-ups

  • connection::tests::quic_winning_opens_one_session fails locally under heavy load, on main too (QUIC loses the race to WebSocket). It is unrelated to this change.

(Written by Opus 5.5)

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

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>
@kixelated
kixelated force-pushed the fix/windows-ipv6-noq-bind branch 2 times, most recently from d327d58 to a0e8577 Compare October 12, 2026 01:02
@kixelated
kixelated marked this pull request as ready for review October 12, 2026 01:02
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T01:05:38.330961Z a0e8577 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 162150ab-014e-43ce-813f-94ac5d4ff9a1

📥 Commits

Reviewing files that changed from the base of the PR and between 5897d91 and a0e8577.


📒 Files selected for processing (1)
  • rs/moq-sock/src/bind.rs

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kixelated

Copy link
Copy Markdown
Collaborator Author

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)

@kixelated
kixelated added this pull request to the merge queue Oct 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 13, 2026
@kixelated

Copy link
Copy Markdown
Collaborator Author

Dequeued by the merge queue: cargo fmt --all --check fails on test/interop/clients/rust/tail.rs, which is broken on main since #5377 and unrelated to this change. Open fixes are #5381 (adds a rustfmt config under test/interop) and #5383 (reformats the file). Re-enable auto-merge once one of them lands.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 13, 2026
Merged via the queue into main with commit 99bc875 Oct 13, 2026
5 checks passed
@kixelated
kixelated deleted the fix/windows-ipv6-noq-bind branch October 13, 2026 05:29
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.

1 participant