HLE: resolve the local machine name to loopback #2001

Open
github-bot wants to merge 2 commits from github-bot/gh-2001 into main AGit
Owner

@⁠necrobytes on GitHub · 2026-11-25 02:38 UTC · original
necrobytes:fix/offline-console-hostname → main · +137 −28 · 2 files · 2 commits · open

A title could call Winsock’s gethostname() successfully, then get WSAHOST_NOT_FOUND when it passed that same name to getaddrinfo(). This fixes VIC-BT-039 in #1249.

The title still sees the machine’s own hostname. When a forward lookup matches that name, the HLE passes a static localhost string to Winsock. This covers the ANSI, Unicode, extended and legacy lookup APIs, including asynchronous requests. The original machine name never goes to the address resolver, and the change adds no names to the connection allowlist.

The Windows regression reads the real ANSI and Unicode hostnames, resolves them through the HLE, and checks every returned address for loopback. It also checks the legacy lookup with a case-varied ASCII name and verifies that an unrelated name still returns WSAHOST_NOT_FOUND.

I ran the Windows regression under Wine. On upstream 940d32f the first lookup returned 11001. With the patch, the regression and the existing blocked-name test both passed. The remaining network test fails on both revisions because Wine lacks WSAConnectByList. Native Linux compilation also stops on both revisions at victory-gpu’s missing host_resource. Strict Windows MSVC-target Clippy passed for all victory-hle targets and features. The asset-policy check passed for all 182 tracked files.

Claim in #1633

Implemented and tested with Codex.

**@⁠necrobytes** on GitHub · 2026-11-25 02:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/2001) `necrobytes:fix/offline-console-hostname` → `main` · +137 −28 · 2 files · 2 commits · open A title could call Winsock’s `gethostname()` successfully, then get `WSAHOST_NOT_FOUND` when it passed that same name to `getaddrinfo()`. This fixes `VIC-BT-039` in #1249. The title still sees the machine’s own hostname. When a forward lookup matches that name, the HLE passes a static `localhost` string to Winsock. This covers the ANSI, Unicode, extended and legacy lookup APIs, including asynchronous requests. The original machine name never goes to the address resolver, and the change adds no names to the connection allowlist. The Windows regression reads the real ANSI and Unicode hostnames, resolves them through the HLE, and checks every returned address for loopback. It also checks the legacy lookup with a case-varied ASCII name and verifies that an unrelated name still returns `WSAHOST_NOT_FOUND`. I ran the Windows regression under Wine. On upstream `940d32f` the first lookup returned `11001`. With the patch, the regression and the existing blocked-name test both passed. The remaining network test fails on both revisions because Wine lacks `WSAConnectByList`. Native Linux compilation also stops on both revisions at `victory-gpu`’s missing `host_resource`. Strict Windows MSVC-target Clippy passed for all `victory-hle` targets and features. The asset-policy check passed for all 182 tracked files. [Claim in #1633](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633) Implemented and tested with Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:51:13 +00:00
Author
Owner

@⁠DesertGamer on GitHub · 2026-11-25 02:40 UTC · original

`### VIctory V2: community PRs, merged and tested

Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch.

Where it stands today: launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1).

⚠️ Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk.

Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help:
https://DesertGamer/VIctory-V2

Unofficial community fork of Marvisak/VIctory, GPL-3.0.`

**@⁠DesertGamer** on GitHub · 2026-11-25 02:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/2001#issuecomment-7151023978) `### VIctory V2: community PRs, merged and tested Open PRs sitting in the queue? V2 pulls them into one build, screens each one (binaries, build scripts, hooks, new deps) and runs tests after every batch. **Where it stands today:** launches, runs the menu at 30 fps, plays the intro video, reaches the start screen and loads the world (~50 s). Entering the world is the current blocker: rendering fails with a GPU "device removed" error (tracked in issue #1). :warning: Entering the world on a real GPU can hang it and make Windows reset the driver. Try it at your own risk. Not playable yet, but every batch of merged fixes moves it closer. If you have a PR that's stuck, or a GPU to test on, I'd love your help: https://DesertGamer/VIctory-V2 *Unofficial community fork of Marvisak/VIctory, GPL-3.0.*`
Author
Owner

@⁠Calvix2k on GitHub · 2026-11-25 02:47 UTC · original

Independent run on Windows 10 19045: cargo test -p victory-hle --lib — 144 passed, 0 failed, including your new hostname round-trip test. Nothing else in victory-hle regressed here.

On the change: resolving the machine name to 127.0.0.1 keeps the title’s own hostname working while not leaking DNS, which is the right side of the offline rule; the test that an unrelated name still fails is the part worth keeping.

**@⁠Calvix2k** on GitHub · 2026-11-25 02:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2001#issuecomment-7151182851) Independent run on Windows 10 19045: `cargo test -p victory-hle --lib` — **144 passed, 0 failed**, including your new `hostname` round-trip test. Nothing else in `victory-hle` regressed here. On the change: resolving the machine name to `127.0.0.1` keeps the title’s own hostname working while not leaking DNS, which is the right side of the offline rule; the test that an unrelated name still fails is the part worth keeping.
Author
Owner

@⁠AgneyaK on GitHub · 2026-11-25 02:52 UTC · original

Native Windows result, since the description's runs were under Wine. Windows 11 26300, Rust 1.98.1 MSVC, b478965 merged onto main 940d32f.

Unit tests: cargo test -p victory-hle --lib -- net passes all 3 net tests, including only_loopback_is_reachable, the one that fails under Wine for lack of WSAConnectByList. Also passing: the_local_hostname_resolves_only_to_loopback and blocked_name_lookups_clear_the_result.

In the title (1.0.2.1, Series X profile, diag build): an RTX 3050 laptop, so the tree also has #1763 (NVIDIA stops at boot without it) and a local adapter patch. One 55 s run each from launch through the boot screens, with VICTORY_LOG=victory_hle::modules::net=debug,info:

net log lines what they are
without this PR 1 network name lookup blocked destination=<this machine's name>, about 60 s in
with this PR 0 the lookup of the machine's own name no longer fails (the PR doesn't log the loopback mapping)

So the title does look up its own hostname during boot, and that's the only name lookup it makes in that window. With the PR it gets an answer, and nothing else in the net module fired: no blocked connections, no other lookups. Frames reached in 55 s: 613 vs 627, the same within noise.

Not tested: past the first ~55 s (this laptop runs out of memory in the story load), and whether the title then connects to the loopback address it got.

AI use: Claude Code (Claude Opus 5.5) ran these builds and wrote this; the results are from the runs described. The machine name is left out on purpose.

**@⁠AgneyaK** on GitHub · 2026-11-25 02:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2001#issuecomment-7151290881) Native Windows result, since the description's runs were under Wine. Windows 11 26300, Rust 1.98.1 MSVC, `b478965` merged onto `main` `940d32f`. **Unit tests:** `cargo test -p victory-hle --lib -- net` passes all 3 `net` tests, including `only_loopback_is_reachable`, the one that fails under Wine for lack of `WSAConnectByList`. Also passing: `the_local_hostname_resolves_only_to_loopback` and `blocked_name_lookups_clear_the_result`. **In the title (1.0.2.1, Series X profile, diag build):** an RTX 3050 laptop, so the tree also has #1763 (NVIDIA stops at boot without it) and a local adapter patch. One 55 s run each from launch through the boot screens, with `VICTORY_LOG=victory_hle::modules::net=debug,info`: | | `net` log lines | what they are | |---|---|---| | without this PR | 1 | `network name lookup blocked destination=<this machine's name>`, about 60 s in | | with this PR | 0 | the lookup of the machine's own name no longer fails (the PR doesn't log the loopback mapping) | So the title does look up its own hostname during boot, and that's the only name lookup it makes in that window. With the PR it gets an answer, and nothing else in the `net` module fired: no blocked connections, no other lookups. Frames reached in 55 s: 613 vs 627, the same within noise. Not tested: past the first ~55 s (this laptop runs out of memory in the story load), and whether the title then connects to the loopback address it got. AI use: Claude Code (Claude Opus 5.5) ran these builds and wrote this; the results are from the runs described. The machine name is left out on purpose.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:17 UTC · original · edited 2026-11-25 20:20 UTC

Automated triage for the maintainers.

Needs work: this needs the maintainer's decision (unchanged). The new head eec4037 is only a merge of main. The PR's own diff is identical to the previously triaged head b478965.

The substance is the same. In crates/victory-hle/src/modules/net.rs, resolvable becomes lookup_node/lookup_node_a/lookup_node_w. A forward lookup of the machine's own hostname now succeeds: the name is replaced with the literal localhost before Winsock sees it, in getaddrinfo, GetAddrInfoW, GetAddrInfoEx{A,W}, gethostbyname and WSAAsyncGetHostByName. The real name never reaches a resolver, the connect checks are unchanged, and other names still fail with WSAHOST_NOT_FOUND. By my reading the title still gets only loopback answers and stays offline. The native Windows run in the thread shows the title does look up its own name at boot (#1249, VIC-BT-039).

It still needs the maintainer for two reasons:

  • It relaxes the name-lookup guard in the net module, even if only to a loopback answer.
  • It adds a [target.'cfg(windows)'.dev-dependencies] windows-sys entry to crates/victory-hle/Cargo.toml.

If the maintainer accepts this relaxation, the code looks sound to me.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 09:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/2001#issuecomment-7158123669) · edited 2026-11-25 20:20 UTC <!-- victory-triage v1 head=eec4037d1884180408fbfbd6e8d1c71ad8d31817 verdict=needs-work at=2026-11-25T20:18:54Z --> Automated triage for the maintainers. **Needs work: this needs the maintainer's decision (unchanged).** The new head `eec4037` is only a merge of `main`. The PR's own diff is identical to the previously triaged head `b478965`. The substance is the same. In `crates/victory-hle/src/modules/net.rs`, `resolvable` becomes `lookup_node`/`lookup_node_a`/`lookup_node_w`. A forward lookup of the machine's own hostname now succeeds: the name is replaced with the literal `localhost` before Winsock sees it, in `getaddrinfo`, `GetAddrInfoW`, `GetAddrInfoEx{A,W}`, `gethostbyname` and `WSAAsyncGetHostByName`. The real name never reaches a resolver, the connect checks are unchanged, and other names still fail with `WSAHOST_NOT_FOUND`. By my reading the title still gets only loopback answers and stays offline. The native Windows run in the thread shows the title does look up its own name at boot (#1249, `VIC-BT-039`). It still needs the maintainer for two reasons: - It relaxes the name-lookup guard in the `net` module, even if only to a loopback answer. - It adds a `[target.'cfg(windows)'.dev-dependencies]` `windows-sys` entry to `crates/victory-hle/Cargo.toml`. If the maintainer accepts this relaxation, the code looks sound to me. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2001/head:github-bot/gh-2001'
git switch 'github-bot/gh-2001'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'github-bot/gh-2001'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2001'
git switch 'main'
git merge --squash 'github-bot/gh-2001'
git switch 'main'
git merge --ff-only 'github-bot/gh-2001'
git switch 'main'
git merge 'github-bot/gh-2001'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!2001
No description provided.