Netoff: block ConnectEx when network is disabled #462
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!462
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-462"
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?
@SandimL on GitHub · 2026-11-24 00:35 UTC · original
SandimL:fix/connectex-network-off→main· +126 −1 · 1 files · 1 commits · openFixes #444.
What is in it
crates/xcl/src/hle/netoff.rs: hookws2_32!WSAIoctl, recognizeWSAID_CONNECTEX, and return a detour that refuses non-loopback destinations while retaining the original function for loopback.WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)path a title uses.Tested
cargo check -p xcl: passed.cargo test -p xcl --lib hle::netoff::tests -- --nocapture: 2 passed, 0 failed.cargo test -p xcl --lib: 634 passed, 2 failed, 21 ignored. The two failures are the existing GPU texture test on this adapter and its dependent poisoned-mutex test; the VRAM test passes alone and the texture failure reproduces on the base tree.smoke-gametitle for 20 seconds withXCL_NETWORK=0; the required--helloargument was supplied because that test title requires it.Regression run
Not tested
ConnectEx.ConnectExloopback to a real listener; the detour forwards loopback to the captured original function, while the regression covers the refusal path.AI use
@Kalmarv on GitHub · 2026-11-24 01:09 UTC · original
Tested
17172b5merged onto main7ebf1b8(merge 642740b, no conflicts). It closes the gap in #444, and the loopback path the description lists as not tested works.WSAIoctlto a listener on 127.0.0.1, reached as::ffff:127.0.0.1, which the hooks treat as any other host) fails on main7ebf1b8and passes on the merge: ConnectEx is refused with 10051 and nothing arrives at the listener.ConnectExloopback to a real listener" under Not tested.WSAIoctlline left out of the hook table,the_systems_own_network_functions_refusefails. It cannot run on main, whereconnect_ex_detourdoes not exist.On main the ConnectEx row reads
r=1 err=0 REACHEDin both columns; the other rows are the same.Tested
Ryzen 9 9950X, Windows 11 26200, debug. CPU only, loopback only; no GPU test was run.
cargo test -p xcl --lib -- netoff::on the merge 642740b: 2 passed, 0 failed; with theWSAIoctlhook left out 1 passed, 1 failed.cargo test -p xcl --lib -- gap_tests --nocapture(the scratch test, not part of the PR): merge 1 passed, 0 failed; main7ebf1b80 passed, 1 failed.scripts/pr_check.pyfrom main on the description: ok.Not tested
ConnectExpointer for the process.🤖 Claude Fable 5.2
@SpaghettiMaster545 on GitHub · 2026-11-24 02:13 UTC · original
Tested
17172b5(this PR's head).cargo test -p xcl --lib hle::netoff::tests -- --nocapture: 2 passed, 0 failed.("ws2_32.dll", "WSAIoctl", …)entry taken out ofinstall_system_hooks(array back to 18),the_systems_own_network_functions_refusefails atassert_eq!(connect_ex, connect_ex_detour as usize), so the test does catch the gap from #444. It fails there beforeConnectExis called, so nothing leaves the machine in that case.main508a0c7+ #451, #300, #468, this PR, #267; release),XCL_NETWORK=0, through its menus into the world load, 150 s until the title's own watchdog stop (#505, not related): the netoff install line is logged as onmain, and noConnectExrefusal was logged, so the title did not callConnectExin that time. The firewall also blockedxcl.exe, so nothing reached the network either way.One remark on the test, checked by reading it: the refused destination is 8.8.8.8. If a later change ever made the detour let a connection through, the test itself would try to reach that host. #444's scratch test used
::ffff:127.0.0.1for that reason: a local listener that the hooks do not count as loopback, so a regression would show up as REACHED without leaving the machine.Not tested
ConnectExitself (the retail title did not in those 150 s).(Claude Code, Claude Opus 5.5: ran the commands above and wrote this report.)
@pvfreis on GitHub · 2026-11-24 03:19 UTC · original
Test report for
17172b593a(this PR's head), against its merge base on maina6f5f7a74c. Whole suite on NVIDIA, no regression.Tested
cargo build --workspace --locked --offline, thencargo test --workspace --locked --offline --no-fail-fast -- --test-threads=4, for both commits:a6f5f7a: 675 passed, 1 failed, 41 ignored17172b5: 675 passed, 1 failed, 41 ignoredhle::netoff::tests::the_systems_own_network_functions_refuseandonly_loopback_goes_throughpass on bothgpu_geometry_wave32_prefix_count_over_a_mask,gpu_wave32_program_in_wave64_hardware(no wave64)test_title_runs_and_game_folder_is_untouched(e2e.rs:225,presents0), because these runs are in an isolated non-interactive session whereCreateSwapChainForHwndreturns 0x887A0022. An interactive run of main at7ebf1b8on this machine passed it (677 passed, 0 failed, 41 ignored).Not tested
WSAIoctlhook): already done by SpaghettiMaster545 aboveConnectExon a socket from a non-Microsoft Winsock provider. Reading the diff:O_CONNECT_EXkeeps one original pointer for all sockets, so with two providers that hand out differentConnectExpointers, loopback calls would go to whichever was stored last. Not seen in practice, just a question.Tested and written with Claude Code (Claude Opus 5.5); the runs are real, on the hardware above.
@MesshM on GitHub · 2026-11-24 04:27 UTC · original
Test run of
17172b593ae1324591d43ace8192458934cca70eon AMD RDNA4. I merged it onto currentmain64b3f35locally (clean merge) and tested that tree.Tested
stable-x86_64-pc-windows-msvc, debugcargo build --workspace+cargo test --workspace -- --test-threads=4on the merge: 701 passed, 0 failed, 41 ignored, exit code 0;xcllib tests 660 passed, 0 failed, 21 ignoredSKIPPED; thenetofftests pass, including theWSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)regression.Review: Handing out a detour for
WSAID_CONNECTEXthat refuses non-loopback destinations closes the path #444 describes. The sameWSAIoctlpath also gives outWSAID_WSASENDMSG(andWSAID_WSARECVMSG), which this hook passes through; #612 hooks theWSASendMsgexport, but a title that gets it throughWSAIoctlwould get the provider's function. Extending the GUID check toWSAID_WSASENDMSGwould cover both. I found nothing to change in what this PR does.Not tested: no retail title or regression run (I have no unpacked game), no
XCL_SAMPLE_*tests, release build; the PR's head on its old base was not run, only its merge ontomain.Run and review by Claude Code (Claude Opus 5.5) on this machine; the review points were checked against the code.
@raylitebull on GitHub · 2026-11-24 10:40 UTC · original
Code/CI review only (not independently runtime-tested by me): clean merge with both checks green (
Build and test+PR description). BlocksWSAIoctlConnectExunderXCL_NETWORK=0, closing an offline-mode gap. Recommend merging, @ivall.@DavidM1911 on GitHub · 2026-11-25 14:15 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.