docs(debt): record what a Windows UDP socket keeps after connect(AF_UNSPEC) #8921
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/8921"
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?
Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-21T06:13:57Z.
What
The
connect to AF_UNSPECentry indocs/dev/debt/libkernel.mdonly described Linux. It now says the same for Windows: a UDP socket bound to an explicit address keeps that host address after the association is dissolved,getsocknamereports it, and asendtoto a non-loopback address from such a socket fails withENETUNREACH(Winsock 10051), where FreeBSD 11.4'sudp_disconnect()resets the local address to the wildcard address and keeps the port, so the send goes out. No code change.Found by comparing against FreeBSD's
udp_disconnect(), not from a title; no title is known that reads the local address after the association is dissolved (see the discussion on #8682, which this replaces).Tested
Windows 10 Pro 10.0.19045, WinLibs GCC 15.2.0 r7. A plain Winsock probe (
probe_8682_disconnect.cpp, attached together with its outputprobe_8682_output.log, 3 runs): a UDP socket connected to a loopback peer, thenconnect(AF_UNSPEC), thengetsockname, thensendtoto this machine's LAN address.getsocknameafter itsendtoto the LAN addressconnect0.0.0.0:<port>127.0.0.1127.0.0.1:<port>These rows are the host's Winsock behaviour measured directly; they are not a run of the guest
connectpath onmain. Not measured on a console.python tools/check_conventions.py --base upstream/mainpasses.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file (n/a, docs only).mdfiles or images added to the repository (probe and output posted as a comment)AI-assisted (Claude Code).
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T06:23:52Z.
Review: APPROVED
The debt entry now distinguishes measured Windows host Winsock behavior from guest-path and console behavior, and preserves the known Linux case. The wording states the remaining evidence gap rather than treating the host probe as console behavior. Conventions and required intake checks pass; this is documentation only.
Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-21T14:08:33Z.
Review: APPROVED
Checked against main and on Windows 11 (10.0.26300):
DisconnectinUdp.cpp:310-336dissolves the association with a connect to a zeroed address of the socket's family on Windows and only rebinds to the wildcard (keeping the port) whengetsocknamethen reports port 0, so a socket bound to an explicit port keeps its host address on Windows as on Linux.getsockname0.0.0.0:port andsendtoto the LAN address succeeds. Bound to 127.0.0.1:getsocknamestays 127.0.0.1:port andsendtoto the LAN address fails with Winsock 10051. This matches the PR's table, on Windows 11 as well as the Windows 10 it was measured on.SocketError.hpp:37mapsWSAENETUNREACHto 51 (ENETUNREACH), so "fails withENETUNREACH(Winsock 10051)" is what the guest sees.check_conventions.py --base main --head pr-8921passes.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.