Repository navigation
Conversation
…NECT-BY-NAME-V6) WSAConnectByNameA/W hand "localhost" to the host as the literal 127.0.0.1 so the hosts file is never read. Windows itself resolves the name to ::1 and 127.0.0.1 and tries them in turn, and an IPv6 socket with IPV6_V6ONLY set, Windows' default, can reach only ::1: given 127.0.0.1 the host fails with WSAHOST_NOT_FOUND. A title that creates an IPv6 socket and connects it by name to localhost therefore always failed under the shim, and succeeds on Windows. Such a socket now gets the ::1 literal. IPv4 and dual-mode IPv6 sockets keep 127.0.0.1, which both reach. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lixonik
reviewed
Nov 26, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Built ws2_offline_test at this head with MSVC on Windows 11. CTest passed with 76 checks and zero failures, including IPv6-only WSAConnectByNameA/W against an ::1 listener and the IPv4 and dual-mode controls. No findings from these checks.
AI-assisted.
The Winsock2 section still described the shim before this change; it now names the new behaviour and the test that covers it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3 of 4 tasks
Author
|
Follow-up commit 664a6fc: the Winsock2 section of |
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.
Claimed in the coordination issue as: WS2-CONNECT-BY-NAME-V6 (claim comment to follow)
What and why
runtime/shims/ws2_offline.cpphands "localhost" to the host'sWSAConnectByNameA/Was the literal127.0.0.1, so the hosts file is never read. Windows itself resolves the name to::1and127.0.0.1and tries them in turn. An IPv6 socket withIPV6_V6ONLYset, which is Windows' default forAF_INET6, can reach only::1: given127.0.0.1, the host fails withWSAHOST_NOT_FOUND. A title that creates an IPv6 socket and connects it to "localhost" by name therefore always failed under the shim.Measured with a small probe on Windows 11, with TCP listeners on
::1and127.0.0.1at one port:"localhost""127.0.0.1""::1"AF_INET6, default (V6ONLY)::1WSAHOST_NOT_FOUND::1AF_INET6, V6ONLY off::1::ffff:127.0.0.1::1AF_INET127.0.0.1127.0.0.1WSAHOST_NOT_FOUNDThe shim now asks the host for the socket's family (
SO_PROTOCOL_INFOW) andIPV6_V6ONLY, and gives an IPv6-only socket the::1literal. IPv4 and dual-mode IPv6 sockets keep127.0.0.1, which both reach. A dual-mode socket whose server listens on::1only still differs from Windows, as onmain: one literal cannot fall back like the host's resolver does.Tested
Windows 11, MSVC 14.44 (Build Tools), RelWithDebInfo:
ws2_offline_testgets a section 8:WSAConnectByNameAconnects an IPv4 socket to localhost at127.0.0.1,WSAConnectByNameAandWSAConnectByNameWconnect a default IPv6 socket at::1, and a dual-mode IPv6 socket at::ffff:127.0.0.1(skipped where IPv6 loopback is unavailable).main: the two IPv6-only checks fail.ctest -j 8over the 168 CPU tests, with this branch and WS2-UDP-DISCONNECT (ws2_offline: let connect dissolve a UDP association (WS2-UDP-DISCONNECT) #2241) merged: all pass exceptxmem_no_write_watch, whose split-reader check is the start race runtime tests: race a reader thread only once it reads (RT-TESTS-READER-START) #2131 fixes (it passes on its own).scripts/check_no_game_data.pyon both files.Not tested under Wine.
This and WS2-UDP-DISCONNECT (#2241) both change
ws2_offline.cppand its test, in different places; they merge cleanly in either order.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code