feat(net): resolve interface ids to host indexes #14213
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/14213"
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 rooklz on 2026-10-31T23:42:38Z.
What
Implement
sceNetGetNameToIndexandsceNetGetIfnameNumListfrom the locallibSceNet.sprxdump (GNU build IDad19de2df01d46df, functions at0x460and0x5c0calling the shared interface-list reader at0x5fd0/0x6380).Both exports check
sceNetInitfirst and return0x804101c8before it.sceNetGetNameToIndexrejects-1withEINVAL, then maps the guest idthrough the same ten-name table already used by
sceNetGetIfName(
lo0..pppoe0); an id whose interface is absent returns0x804101A4(
SCE_NET_ERROR_ENODATA).sceNetGetIfnameNumListrejects a null list, acapacity of 0 or less and flags above 1 with
EINVAL, and enumerates ids 1..8for flags 0 and 0..9 for flags 1, ascending, up to the capacity.
The host has no FreeBSD interface names, so the emulator maps id 0 to the host
loopback, id 1 to the first up non-loopback interface with an address, and ids
2..9 to a host interface of the same name. The returned value is the host
interface index. This deliberate guest-to-host mapping and its lack of a
console measurement are recorded in
docs/dev/debt/libSceNet.md.The shared name table moved into one constant used by
sceNetGetIfNameaswell. The Windows lane now links
iphlpapiforGetAdaptersAddresses, and thetest targets that compile
Export.cppdirectly (net_blocking_send_testsandnet_epoll_lifetime_tests) linkiphlpapitoo instead of failing to resolveGetAdaptersAddressesandif_nametoindex.#9578 (socket Ex/Internal forms, sysctl, scope-ID text, default route) landed
2026-11-02; this PR has been rebased onto current
mainon top of it and keepsonly the interface-index exports. The
iphlpapilink fix is now upstream(redundant commit dropped during the rebase), and the
GuestSceNet.cppoverlapis resolved: #9578's
CheckExForwards/CheckSysctl/CheckScopeIdTextremainuntouched and this PR's
CheckIfNameIndexruns after them.Tested
-DANYPS5_RELINKER_ONLY=ON -DBUILD_TESTING=ON:succeeds.
ctest --test-dir build-pr14213 -j6: 542/542 pass.Export.cpptesttargets now carry
iphlpapialongsidews2_32for the hosted Windows job.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)mainon top of it)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T00:02:27Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The Windows CI build fails because
net_blocking_send_testscompilesExport.cppwithout linking the newiphlpapidependency.What I ran
Reviewed #14213 at head
f9f71f7fbe46ba711e65c5d58885ed43721547c1, based onb08c539c505c48341146c705bc72d9b603cdb3a7. The precheck's current-base preview merged cleanly. Environment: Debian GNU/Linux, Python 3.11.2, Git 2.39.5. I did not configure or build AnyPS5 locally.Results
net_blocking_send_tests.exe: unresolvedGetAdaptersAddressesandif_nametoindex. The test source includesExport.cpp, and its Windows target linksws2_32but notiphlpapi.Windows linker output
Findings
Blocking
iphlpapito thelibSceNetlibrary target, butnet_blocking_send_testsincludescore/libs/prx/libSceNet/Export.cppdirectly and does not link that library target. Its Windows link line therefore lacksiphlpapi, producing the unresolved symbols shown above. Addiphlpapito this test target's Windows link libraries (and any other test target that compilesExport.cppdirectly), then rerun the Windows job.Non-blocking
Sources
iphlpapiat the reviewed headws2_32Export.cppdirectlyNot verified
To get this to a good state
Link
iphlpapiinto the Windows test target that compilesExport.cpp, verify there are no other direct-source test targets with the same missing dependency, and rerun the Windows job. I will rerun the same no-build checks on the updated head.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-01T01:28:42Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
The Windows link fix passes, but the required landing order with overlapping PR #9578 is unresolved and the pairwise preview conflicts.
What I ran
Reviewed head
20fd7cfb078c512cd85dabc9fe5939afe021a237, based on PR baseb08c539c505c48341146c705bc72d9b603cdb3a7; its preview onto currentmain8daa361aa03abc02795d182e27cffb02ef7b18cewas clean. Environment: Debian Linux x86_64, Python 3.11.2, Git 2.39.5. No local build or C++ tests were run.Results
RunNetThreadas lacking a public declaration.core/libs/tests/GuestSceNet.cpp. The PR overlap comment independently lists that file and the two overlapping regions.Unedited check output
Conventions:
Pairwise merge preview:
Findings
Blocking
Depends on. The automated overlap comment on this PR lists #9578, and the exact-head pairwise merge preview confirms a content conflict inGuestSceNet.cpp. #14213 currently saysDepends on: none; #9578 also sayssceNetGetIfnameNumListremains unimplemented, while this PR implements it. Please coordinate with #9578's author on the intended order and behavior, resolve the conflict, and record the agreed dependency in the appropriate PR before merging.Non-blocking
The host-interface mapping is deliberately not measured on a console; the debt entry records this limitation. The Linux host behavior is covered by author-reported tests.
Sources
Not verified
No local build, CTest, or PS5/console behavior was tested. The author-reported Linux run was not reproduced; only the hosted Windows job ran for this head.
To get this to a good state
Please agree on the order with #9578's author, declare it on the dependent PR, and reconcile the shared test changes and interface-list scope. I will rerun the merge and relevant checks once the order or heads change.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-06T06:06:51Z.
Review: APPROVED
Tests run and reviewed: approved
Approved on the tests and on comparing the diff with the description: 1,258 of 2708 tests ran and passed here (Linux, CPU-only), 3 of 4 claims in the description are confirmed by the diff (1 only partly, listed under Not verified) and no blocking finding stands. 1450 tests could not run on this machine and are not verified.
What I ran
Head
5f53bf94c86ab67e3de4cf290b1ab410544fea61; based1ae628bc2f62459cce1e9872ba5632c938c71f2.I built and tested this head on this machine, on Linux. Full build and tests (the head merged onto the base tip): passed. The Test logs section at the end has the details.
Hosted CI results are read from GitHub as they are now; I did not run them.
Reported by other contributors' CI comments on this head, not run by me: AMD GPU CI passed (1,130 passed · 4 failed (0 new, 3 also fail on main, 1 unstable on main) · 7 skipped (ANYPS5_REQUIRE_VULKAN=1)).
I compared the full diff of 3 changed files (258 lines) with the pull request description. I ran nothing for this and looked at nothing outside the diff.
Results
Findings
Blocking
None in the diff of 3 changed files.
Non-blocking
None recorded.
Not verified
Test logs (3 entries; open to read)
Full build and tests (the head merged onto the base tip): passed
Result:
Steps:
What did not run, and why:
All tests:
Complete output: 24,979 lines, 2.8 MB: https://gist.github.com/MarcZX10/48be24a03a41da4e364fb5ca91ebcc87
Hosted CI as GitHub shows it: passed
Jobs, newest run of each:
Overall:
AMD GPU CI comment: passed (reported by @TechLevelZero, not run by me)
Tests: