HLE net: classify bracketed IPv6 literals as IP literals in reachable_name #3068
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/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?
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T06:17:48Z.
Summary
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).
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T06:31:55Z.
Review: APPROVED
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.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T08:42:01Z.
Review: CHANGES_REQUESTED
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).Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T08:23:22Z.
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
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T10:03:14Z.
Review: APPROVED
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.Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T09:31:13Z.
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).
Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-27T10:45:23Z.
NVIDIA full-suite run, to go with the reports above by fuzeofficlal, since none of them names a GPU run. Tested exact head
09257ae(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.bracketed_ipv6_literal_fails_with_netunreach_not_host_not_found.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.