HLE net: classify bracketed IPv6 literals as IP literals in reachable_name #3070
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3070
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3070"
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?
@Dukestar69 on GitHub · 2026-11-26 06:17 UTC · original
Dukestar69:fix/net-getnameinfo-and-bracketed-ipv6→main· +47 −3 · 1 files · 2 commits · openSummary
Classifies bracketed IPv6 literals (such as
[2001:db8::1]) consistently as IP literals inreachable_nameso blocked non-loopback bracketed IPv6 connects reportWSAENETUNREACHinstead ofWSAHOST_NOT_FOUND, and tightens bracket stripping inloopback_nameto match only a single surrounding[...]pair.Why
loopback_nameincrates/victory-hle/src/modules/net.rsalready strips brackets around IPv6 literals ([::1]), butreachable_nameimmediately below calledname.parse::<IpAddr>()on the unstripped string. As a result, a blocked connect to[2001:db8::1]setWSAHOST_NOT_FOUND(11001) instead ofWSAENETUNREACH(10051). Using a sharedbare_hosthelper (strip_prefix('[').and_then(|s| s.strip_suffix(']')).unwrap_or(name)) fixesreachable_nameand also avoids accepting malformed/unmatched brackets like[::1or[[::1]]inloopback_name.Verification
modules::net::tests::bracketed_ipv6_literal_fails_with_netunreach_not_host_not_found:63bcca4(left: 11001, right: 10051).cargo test -p victory-hle net::tests: 3 passed, 0 failed.cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@kotekompotek on GitHub · 2026-11-26 06:31 UTC · original · approved these changes
Verified: bare_host strips exactly one matched bracket pair, so [::1 and ::1 no longer collapse to parseable literals; reachable_name now classifies bracketed literals as IP literals -> WSAENETUNREACH instead of HOST_NOT_FOUND. Test covers all four bracket shapes.
@Marvisak on GitHub · 2026-11-26 08:23 UTC · original
Automated triage for the maintainers.
Verdict: merge candidate. In
modules/net.rs,bare_hoststrips exactly one surrounding[...]pair.loopback_nameno longer takes[::1or[[::1]]for loopback, which only tightens the offline guard: such names were passed to the host before.reachable_namenow classes a bracketed literal as an IP literal (WSAENETUNREACH), as the module doc andloopback_namealready treat it.The new test covers both. CI: not run on this head yet (the workflow needs a maintainer's approval for this contributor), so this verdict depends on it passing.
Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 08:42 UTC · original · requested changes
Verified
64588459locally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warnings: clean (1.58s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).cargo test -p victory-hle --locked: 155 passed, 0 failed (153lib +1fidelityfx +1no_dll_planting,5.17s).rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs: clean.bare_host(crates/victory-hle/src/modules/net.rs:135-145, 167-176) fixes the error code for[2001:db8::1]and rejects malformed inputs like[::1and[[::1]], but because it strips any[...]pair before callingparse::<IpAddr>()and comparing"localhost", it also reclassifies bracketed IPv4[1.2.3.4]fromWSAHOST_NOT_FOUND(onmain) toWSAENETUNREACH, and still lets[127.0.0.1]and[localhost]passloopback_name.Per RFC 3986 section 3.2.2, only IPv6 literals belong inside
[...]. Please restrict bracketed stripping to inputs whose inner slice parses asstd::net::Ipv6Addr, and add test cases for[1.2.3.4],[127.0.0.1], and[localhost](plus::1],[::1%1], and[2001:db8::1]:443).@Dukestar69 on GitHub · 2026-11-26 09:31 UTC · original
Good catch @fuzeofficlal, thanks! Fixed in
09257ae:bare_hostwithparse_ip_literalso[...]stripping only accepts inner slices that parse asstd::net::Ipv6Addr(per RFC 3986 section 3.2.2).[1.2.3.4],[127.0.0.1],[localhost],::1],[::1%1], and[2001:db8::1]:443are no longer treated as loopback or IP literals and returnWSAHOST_NOT_FOUND; all added tobracketed_ipv6_literal_fails_with_netunreach_not_host_not_found.rustfmt --edition 2024 --check,cargo test -p victory-hle --locked --lib modules::net::(3/3 passed),cargo clippy -p victory-hle --all-targets --locked -- -D warnings(clean), andcargo xtask policy(191 files ok).Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@fuzeofficlal on GitHub · 2026-11-26 10:03 UTC · original · approved these changes
parse_ip_literalcleanly resolves the bracket-stripping regression from64588459. Bracketed IPv4 inputs ([1.2.3.4],[127.0.0.1]),[localhost],[::1%1],[2001:db8::1]:443, and unmatched/nested brackets now fall through toWSAHOST_NOT_FOUND, while valid[2001:db8::1]returnsWSAENETUNREACHand[::1]/[::ffff:127.0.0.1]still pass loopback canonicalization.Verified locally on Windows 11 x64 (
09257ae1):rustfmt --edition 2024 --check crates/victory-hle/src/modules/net.rs: cleancargo run --locked -p xtask -- policy: passed (191 files ok)cargo clippy -p victory-hle --all-targets --locked -- -D warnings(default and--all-features): cleancargo test -p victory-hle --lib --locked modules::net::: 3 passed, 0 failedcargo test -p victory-hle --locked: 153 lib + 2 integration tests passed, 0 failedOptional: adding
[::ffff:127.0.0.1]and[]to the test table would round out the boundary matrix.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.