fix(libSceNet): ignore IPv4-mapped results of an IPv6 name lookup on macOS #10629
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10629"
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 boykopovar/AnyPS5. Originally posted by maximilianfv on 2026-10-24T13:32:58Z.
What
On macOS,
getaddrinfowithai_family = AF_INET6and no flags answers an IPv4 literal such as"127.0.0.1"with the IPv4-mapped address::ffff:127.0.0.1.lookup_hostpasses that on, sosceNetResolverStartNtoa6(resolver, "127.0.0.1", ...)returns 0 and writes::ffff:127.0.0.1.guest_sce_netexpectsSCE_NET_ERROR_RESOLVER_ENODNS(0x804101E1) with the output buffer unchanged (core/libs/tests/GuestSceNet.cpp:2381), and thesceNetResolverStartNtoa6entry indocs/dev/debt/libSceNet.mdsays a name with no IPv6 address fails withRESOLVER_ENODNS.FreeBSD 11.4's
getaddrinforeturns no IPv4-mapped address for anAF_INET6query unlessAI_V4MAPPEDis set: an IPv4 literal is accepted only with that flag (explore_numeric), and DNS asks for A records only with that flag (_dns_getaddrinfo).lookup_hostnever sets it.This PR makes
lookup_hostskip IPv4-mapped results of anAF_INET6lookup on macOS (IN6_IS_ADDR_V4MAPPED).sceNetResolverStartNtoa6is the onlyAF_INET6caller oflookup_host. Linux and Windows are unchanged.A small host probe (
getaddrinfo,AF_INET6, flags 0) on macOS returned::ffff:127.0.0.1for"127.0.0.1",::1for"::1"and::1for"localhost".Limitations, on macOS only:
FILTER_V4MAPPED, which its libc Makefiles do not define.AF_INET6, now fails withRESOLVER_ENODNSas on FreeBSD (only an IPv4 literal was probed on macOS, not a real A-only name).Prior art: the same change was written before in two whole-port PRs that are now closed, so both authors are credited as co-authors on the commit. #7332 by Ycaro Gabriel (ycarogabriel-lgtm) has identical code in commit
a8fa3e9008(2026-10-17). #8658 by Himansh Raj (iamthehimansh) has identical code plus a comment in commit301073a29e(2026-10-19). #7201 by marion909 (commitc31e82f31f, 2026-10-16, closed 2026-10-27) took a different approach for the same test: on macOS, anAF_INET6lookup of a name that parses as an IPv4 literal fails beforegetaddrinforuns. That approach does not cover A-only names. No open PR changeslookup_host.Tested
Apple M1 Pro, macOS 27.0.1, x86_64 build under Rosetta 2.
mainalone does not build on macOS, so I tested in a tree made of mugurc's macOS series (ci/macos-series-2,27e968974) merged withmainat1e20650e84, open #9231 (7c5d97324) and my own sceNetIoctlFIONREADfix (not yet opened). Only this change was toggled between runs. These runs are from before the 2026-10-27 rebase ontomainat3bed136010; the rebase changed only context lines of this diff, and I have not rerun them on it.ctest -R '^(guest_sce_net|guest_resolver|guest_net_ctl|guest_inet_address|guest_net_.*|guest_datagram_.*|net_dontwait_.*|guest_socket_error|guest_udp)$'(22 tests): 21 pass with and without the change.guest_sce_netaborts with and without the change. Without the change it stops at the check above (GuestSceNet.cpp:1932on1e20650e84, now:2381, located with lldb on an-O0rebuild). With the change it passes that check and stops later, at thesceNetCtlGetIfStat(&first)call (GuestSceNet.cpp:2168on1e20650e84, now:2615). That stop is an uncaught "sceNetCtlGetIfStat: host interface byte counters are not implemented on this platform" (libSceNetCtl/Export.cpp:511on1e20650e84, now:868), a separate macOS gap that open #9728 (MarcZX10) closes.Not tested on Linux or Windows. Their code is unchanged.
Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)GuestSceNet.cppand neighbouringdocs/dev/debt/libSceNet.mdentries; I rebase this one after it). #9727 and #9733 are merged; #7201 is closed🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T13:40:41Z.
Review: COMMENTED
The PR body identifies overlapping
lookup_hostbehavior in open #7201 but the checklist still saysDepends on: none. CONTRIBUTING requires the authors to agree on merge order and record the dependency. I left the specific request in this comment; no author response or body update is present at this head. I have not approved pending that coordination.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T13:52:04Z.
Review: CHANGES_REQUESTED
Follow-up on the current overlap warnings at head
b5868dd32860621102859b462b6cc0486794994a. Manual checks confirm two coordination items beyond the original checklist mismatch:lookup_hostpath on macOS (it rejects numeric IPv4 literals beforegetaddrinfo; this PR filters IPv4-mapped results).git merge-tree --write-tree upstream/pr/7201 upstream/pr/10629conflicts insidelookup_host, so these behaviors need an agreed order and a combined test/implementation plan. The body mentions #7201 but the checklist still saysDepends on: none.sceNetShowIfconfigandsceNetShowNetstat, while this branch'sCheckNetstatstill expects those calls to throw. The three-way merge conflicts inGuestSceNet.cppat that test and in theSilent stubsdebt entry. Please coordinate order with #10502 and reconcile the test expectations so the combined branch tests the implemented diagnostics rather than treating them as unsupported.I also confirmed adjacent debt-file conflicts with #9727 and #9733 via merge-tree; their implementation changes are in other functions, but the shared documentation hunks will need to retain both updates. The broad #5836 diff changes peer socket types/options, not
lookup_host, so I found no direct resolver implementation overlap there.Please agree on the merge order with the affected authors and record the required dependency or dependencies in the checklist. I have not run a local macOS resolver test; the PR's host probe and reported platform test remain author evidence.