Repository navigation
Net: connect to a zero address disconnects a datagram socket instead of being refused (fixes #891) - #1071
Net: connect to a zero address disconnects a datagram socket instead of being refused (fixes #891)#1071acleofe wants to merge 1 commit into
Conversation
…of being refused (fixes #891) Winsock disconnects a datagram socket connected to an address of zeros. The offline policy refused that address as off the machine; it reaches no one, so it now goes to the host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of being refused (fixes Marvisak#891) Upstream: Marvisak#1071 by @acleofe
|
Independent Linux/Wine validation of I compared direct
The wrapper still rejects the off-machine test address with This isolates the discrepancy to the host Winsock behavior on this Wine setup, rather than the new forwarding branch. Microsoft's Full workspace unit/integration suite on the unmodified PR, all features, all 14 generated Windows MSVC test executables: 341 passed, 6 failed, 6 ignored. Matched baseline: 341 passed, 5 failed, 6 ignored. The extra failure is the new disconnect test. The other five remain the empty pipeline library (#347), missing Wine Winsock export (#217), checksum-rejection expectation, nested Cargo fixture build, and Windows xtask attempting to launch host Git. Native xtask separately passes all 4 tests; asset policy passes. Both Windows-target workspace Clippy configurations (all targets, with and without all features, Environment: Rust 1.98.1, Wine 11.22, RTX 5090 / NVIDIA 620.73.04, vkd3d-proton |
What
connectandWSAConnectpass an address that reaches no one to the host: an IPv4/IPv6 address of zeros, or asockaddrof no family (AF_UNSPEC). Every other address is vetted as before, so only loopback connects.Why
Winsock documents that connecting a datagram socket to an address of zeros dissolves its association with its peer. The offline policy refused that address as off the machine (
WSAENETUNREACH), so a connected UDP socket stayed connected. An address of zeros never leaves the machine (a stream socket cannot connect to it on Windows), so passing it on does not weaken the policy.Test
a_zero_address_disconnects_a_datagram_socket: a UDP socket connected to a loopback peer is disconnected (getpeernamegivesWSAENOTCONN) byconnectwith0.0.0.0:0and with a zeroedAF_UNSPECsockaddr, and byWSAConnect; an off-machine address is still refused withWSAENETUNREACH. Before this change the first zero-addressconnectreturnedSOCKET_ERROR.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warningsandcargo test --workspace --lockedpass.🤖 Generated with Claude Code