Repository navigation
XCL_NETWORK=0: a bind to a network address binds to loopback - #570
tiagonleal wants to merge 2 commits into
Conversation
|
claude code session is invalid anyway, might as well remove it ;) |
|
Test run of Tested
Review: A bind to a network address (or to every interface) is moved to loopback with its port kept, so a title's sockets still bind and the firewall prompt from #568 no longer comes up; loopback binds go to the original. I found nothing to change. Not tested: no retail title or regression run (I have no unpacked game), no Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code. |
|
Merge-order note for the three
So the simplest order is #619 and #612 first, then a rebase of #570. Its hooks array then becomes
(Above: read only, not built.) Added 20:44Z: whole workspace at the current head
AI-assisted (Claude Code, Claude Opus 5.5). Synthetic tests only; no title run. |
fc1e7a9 to
eaf034e
Compare
|
@FelipeCRamos dropped the session trailer; the commit is otherwise unchanged. @upipibi thanks for checking the merge order. Rebased onto AI-assisted (Claude Code). |
|
AMD RX 6750 XT data point for #570 (RDNA2, driver 32.0.21045.29003; Ryzen 7 5700X, 32 GB; Windows 11 Pro 26200; release builds)
main: PR: Written with Claude Code from runs on this machine. |
|
@zorde23 thanks for the RDNA2 run. For your last "not tested" point: #570 merged with the other eight open netoff PRs (#462, #612, #619, #807, #808, #821, #494, #299) builds and passes the whole suite on the RTX 5070 Ti (758 passed, 0 failed, 41 ignored; 7 netoff tests); the merge order and resolutions are in my comment on #568. AI-assisted (Claude Code). |
|
Independent Windows x64 test report on commit Environment
Command xcl-77aca8ccb20e299f.exe --exact --nocapture --test-threads=1 `
hle::netoff::tests::a_bind_to_every_interface_stays_on_loopback `
hle::netoff::tests::only_loopback_goes_throughResults
Not tested
AI use
|
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
eaf034e to
3449a3f
Compare
|
Independent Windows/NVIDIA check of head Tested
Rebasing this PR onto current Not tested
AI use
|
|
Re-verification on RTX 3060 Ti (Windows 11), new head merged with current
Thanks! — Devin |
With XCL_NETWORK=0 a retail title still bound UDP 3074 on 0.0.0.0: netoff refused connect, sendto and name lookups but not bind. Windows Firewall then asked to let the network in for xcl.exe (once per folder it runs from; "Allow" needs an administrator), and once allowed, the network reached the title's socket. A bind to a non-loopback IPv4 / IPv6 address now binds to 127.0.0.1 / ::1 on the same port, in the title's ws2_32 imports (ordinal 2) and in the system's ws2_32!bind. The bind succeeds as on a console without a network and loopback traffic still reaches the socket. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The system bind hook had no test for IPv6 beyond one UDP bind to [::]:0. Now, through the hooked ws2_32 bind: a 28-byte sockaddr_in6 for ::, for another network address and with a scope id ends up on ::1 with the port kept; ::1 stays. Sockaddrs under 28 bytes (the 24-byte form included, which Winsock itself refuses with WSAEFAULT) are passed on untouched and leave the socket unbound. A dual-stack (IPV6_V6ONLY=0) listener bound to :: is on ::1 only: an IPv6 loopback connection reaches it, an IPv4 one is refused. The hook's doc comment says so. No behaviour change. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
3449a3f to
8948d93
Compare
|
Thanks. The branch is now rebased on Run on 8948d93: Not run: a retail title with the firewall prompt on this machine, AMD hardware, and the four fuzz tests on |
With
XCL_NETWORK=0a retail title still bound UDP 3074 on0.0.0.0:netoffrefusedconnect,sendtoand name lookups, but notbind. Windows Firewall then asked to let the network in forxcl.exe(once per folder it runs from; "Allow" needs an administrator), and once allowed, the network reached the title's socket. Fixes #568.A bind to a non-loopback IPv4 / IPv6 address now binds to
127.0.0.1/::1on the same port. The bind succeeds as on a console without a network, the title's loopback traffic still reaches the socket, nothing from the network does, and Windows does not ask. IPv4-mapped addresses (::ffff:a.b.c.d) are not loopback, so they end up on::1too.Rebased onto
main08db8020; the second commit only adds tests and a doc comment. The bind is logged (note_bind) only after it succeeded: before, the 24-byte IPv6 form that Winsock refuses withWSAEFAULTwas logged as bound to::1.What is in it
crates/xcl/src/hle/netoff.rs: abindhook, in the title's ws2_32 imports (table(), ordinal 2) and in the system'sws2_32!bind(install_system_hooks), next toconnect's; loopback binds go through unchanged.a_bind_to_every_interface_stays_on_loopback: UDP and TCP binds to0.0.0.0:0end up on127.0.0.1, loopback traffic reaches them,[::]:0ends up on::1when the machine has IPv6.ws2_32!bindon rawAF_INET6sockets (port 0; skipped when the machine has no IPv6) and a doc comment:an_ipv6_bind_stays_on_loopback: a 28-bytesockaddr_in6for::, for2001:db8::1and for::with a scope id ends up on::1with the port kept;::1stays.a_sockaddr_in6_under_28_bytes_is_left_alone: lengths 0, 2, 8, 20, 23 and 24, exact-size buffers and a null name are passed on as they are; Winsock itself refuses the older 24-byte form (WSAEFAULT), also for::1, so that form fails as without the hook and the socket stays unbound.a_dual_stack_bind_is_on_ipv6_loopback_only: anIPV6_V6ONLY=0TCP listener bound to::is on::1only: an IPv6 loopback connection reaches it, an IPv4 one to the same port is refused.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4, run twice at8948d93d: 1429 passed, 4 failed, 47 ignored both times (25SKIPPEDlines). The 4 failures aregpu::dxil::fuzz_tests::fuzz_validate_and_gpu_0to_3(CreateComputePipelineState, E_OUTOFMEMORY on this GPU), in code this PR does not touch; I did not run them onmain08db8020today. Thelower_dxilbarrier test that failed at the earlier head passes after the rebase.cargo test -p xcl --lib netoff -- --test-threads=1at8948d93d: 6 passed, 0 failed, 3 of 3 runs. With thebindhook returning at once to the originalbind: 3 failed, 3 passed (a_bind_to_every_interface_stays_on_loopback:left: 0.0.0.0,right: 127.0.0.1;an_ipv6_bind_stays_on_loopbackanda_dual_stack_bind_is_on_ipv6_loopback_only:leftall zeros,right::1).wave64GPU tests, threelower_dxilf16 / conversion forms refused as unsupported, andheap_window_out_of_memory_falls_back_to_the_switch_form(no heap windows).Get-NetUDPEndpoint25 s into each smoke run:main0.0.0.0:3074; this PR127.0.0.1:3074, and the log saysXCL_NETWORK=0: a bind to a network address is bound to 127.0.0.1 instead (no network)(measured on the earlier headeaf034e4; not repeated on8948d93d, and the hook has changed since only in when the log line is written).Regression run
First block:
main08db8020; second: this PR's head8948d93d; same title, built from clean trees.Not tested
::and expects IPv4 loopback connections to it (after this it is on::1only; pinned by a test, no real title run).AF_UNSPEC, and UDP dual-stack delivery (only the TCP listener is tested).AI use