mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:40:52 +01:00
[PR #2242] ws2_offline: connect an IPv6-only socket to localhost at ::1 (WS2-CONNECT-BY-NAME-V6) #2248
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2248
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2242
Author: @syfyra
Created: 11/26/2026
Status: 🔄 Open
Base:
main← Head:fix/ws2-connect-by-name-v6📝 Commits (2)
75bda1dws2_offline: connect an IPv6-only socket to localhost at ::1 (WS2-CONNECT-BY-NAME-V6)664a6fcdocs: runtime_imports describes the WS2-CONNECT-BY-NAME-V6 behaviour📊 Changes
3 files changed (+125 additions, -8 deletions)
View changed files
📝
docs/runtime_imports.md(+5 -3)📝
runtime/shims/ws2_offline.cpp(+26 -4)📝
runtime/test/ws2_offline_test.cpp(+94 -1)📄 Description
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 (#2241) merged: all pass exceptxmem_no_write_watch, whose split-reader check is the start race #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
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.