feat(libSceNet): implement the Ex and Internal socket forms, sceNetSysctl, scope-ID text and the default route #9578
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9578"
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 EagleBearerYS on 2026-10-22T02:56:06Z.
What
This implements 7 libSceNet functions that threw. 4 more from the same batch stay throwing, because their answer would be a guess.
0x80410100 | errno, like the library's other calls.libSceNet.sprx(comment).lo0,eth0,eth1,dbg0,gbe0,bt0,wlan0,wlan1,phone0,pppoe0). Ntop prints%<name>, and a decimal zone such asfe80::1%2doesn't convert.%branch runs only with a scope output.ENOSPC. Another family givesEAFNOSUPPORT: null from ntop,0x8041012Ffrom pton.std::invalid_argument, where the module faults.0x804101C8with errno 200.0x8041130Cwith the output untouched.std::invalid_argument, where the module faults.Still throwing:
81bc358860(the scope-ID forms) and0a4d4e792c(the default route) replace the earlier numeric zones and throws with the module's answers, after rooklz's reading and oneandonlydean's review. Both commits carry rooklz's Co-authored-by line. The debt entries list what isn't measured:#9494 and #9515, which this was stacked on, have both merged. The scope-ID forms use #9494's text rules through sceNetInetNtop and sceNetInetPton.
Related: #9231 changes sceNetSocket's errors and, on macOS, sceNetInetPton's IPv4 path. sceNetSocketInternal follows whatever sceNetSocket returns.
Overlap: checked with
git merge-treeagainst every open PR touching these files, onmain6ef5a1c4c9. The conflicts it reported came from #9515's commits in this branch's base, which are onmainnow that #9515 has merged: #9365, #9099 and #8359 indocs/dev/debt/libkernel.md, and #7511 inSocket/src/Udp.cpp. This PR's own commits change only libSceNet, libSceNetCtl,GuestSceNet.cpp, libSceNet's debt file and the iphlpapi link incore/libs/CMakeLists.txt. #9231 merges cleanly with this PR and with #9494, whose IPv6 path insceNetInetPtonits macOS IPv4 check sits next to, and Gonic0 agreed that neither waits for the other (comment). The order agreed on #9515 (comment), #9523 → #9542 → #9515 → this PR, has reached this PR: the other three have merged. #9542 (Queuse) carried the samesceNetGetsockoptreadback as #9515'se887616e74, and the merge of #9515's4432e8aa57in57ba2fc47ckept #9542's version. #14213 (rooklz, interface names) shares the interface table, its host helpers and the iphlpapi links, which this PR takes with the same text, so a merge keeps one copy of each.git merge-treeagainst its 20fd7cfb07 conflicts only inGuestSceNet.cpp, in the same two places as before these commits: both PRs add test functions, and their calls, at the same point. Keeping both sides resolves it.Tested
guest_sce_netfails ×2 on both with the stubs, and passes ×5 on both with this PR.guest_sce_net_testsgains these cases:fe80::1%2round trip, with rejected and boundary texts;main. None of the new cases needs IPv6 networking.43ea7772bb,main8b3e39832amerged in (clean; the PR's own diff is unchanged), on GitHub's runners (run):guest_sce_netandguest_net_ctlpass 10 of 10 on Linux and Windows, none skipped. On its one run withmain's implementation,guest_sce_netfails on both runners andguest_net_ctlpasses. libkernel's suite passes on both, and libc's on Windows.precise_waitfailed on the fix arm only in the run's first attempt. It's a runner timing test outside the files this PR touches, and in run 39788040462 it failed withmain's implementation as well. The rerun of the Linux job passed.check_conventions.pypasses, with no comment lines added.dda8c45be7, a merge of #9515's merge ofmain938812df14(efd999c8ed). It brings no conflict of its own, and the PR's own diff is unchanged. On GitHub's runners (run),guest_net_ctl,guest_sce_net,guest_socket_optionsandguest_socket_errorpass 10 runs in a row on Linux and on Windows, 4 of 4, none skipped. The libc and libkernel suites pass on both (119 and 201 tests on Linux, 146 and 211 on Windows), run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.c0caad00ca, a merge ofmaindb6af9e0fd(run).mainnow has #10275 (orezraey'ssceNetInetPton, measured on a PS5: a nulldstfor IPv6 returnsNET_EINVAL, IPv4 text ends at the first whitespace, and the dotted IPv4 part of IPv6 text is checked the same way). The merge keeps that function asmainhas it and sends only its IPv6 conversion through libkernel'sinet_pton, as this PR does; the IPv4 conversion and the dotted-part check stay on the host. The debt file keepsmain's measured entry and this PR's IPv6 entry, which now says the FreeBSD forms are unverified on a console beyond those PS5 measurements.guest_net_ctl,guest_sce_net,guest_socket_errorandguest_socket_optionspass 10 runs in a row on both runners, 4 of 4 each, none skipped. The libc and libkernel suites pass on both, run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners. This PR'ssceNetInetPtonWithScopeIdcallssceNetInetPtonwith the text before the zone, so it takes the same rules.5cffcf56d1, a merge of #9515's merge ofmain67bbe03f91(abbb7ac6b5, whose one conflict wasdocs/dev/debt/libkernel.md, where #9099 (aarushkha, regular-file events) reworded thesceKernelAddReadEventpipe entry and added its own regular-file entry just above this PR'sclose,setsockoptandgetsockoptline; the merge keeps both ofmain's entries and this PR's line). It brings no conflict of its own, and the PR's own diff is unchanged. On GitHub's runners (run),guest_net_ctl,guest_sce_net,guest_socket_errorandguest_socket_optionspass 10 runs in a row with the change, on Linux and on Windows: 4 run, 4 pass, 0 skip, 0 fail. Withmain's code,guest_sce_netfails on both. The libc and libkernel suites pass on both (143 and 205 tests on Linux, 170 and 218 on Windows), run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.6c938db3ce, a merge of #9515's merge ofmaina512780d58(fc47c2f491; see #9515). The conflicts were incore/libs/tests/GuestSceNet.cppand libSceNet'sExport.cpp, where #10706 (the public-header migration) removed their local declarations, among them this PR's forsceNetSocketInternal,sceNetGetsockoptEx,sceNetSetsockoptEx,sceNetSysctl,sceNetInetNtopWithScopeId,sceNetInetPtonWithScopeId,sceNetConfigGetDefaultRouteand libkernel'ssysctl,__inet_ptonand__inet_ntop. The merge takesmain's side:Net.hppand libkernel'sinclude/Api.hppnow declare each of them with the same arguments as this PR's definitions, andtests/test_public_headers.py --audit-onlypasses. So the PR's own diff loses those declarations and is otherwise unchanged.guest_net_ctl,guest_sce_net,guest_socket_error,guest_socket_optionsandpublic_headerspass 10 runs in a row with the change, on Linux and on Windows: 5 run, 5 pass, 0 skip, 0 fail. Withmain's code,guest_sce_netfails on both.guest_floating_pointfailed once in that run, on itsfeholdexcept workers preserve the main environmentcheck, which #8863 added; this PR changes nothing in libc. Run alone on this head 20 times in a row (run), it passes on both runners, and both suites pass on both (143 and 206 tests on Linux, 170 and 222 on Windows). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.7f300827d1, a merge ofmain75227c7cdc(run). The one conflict wasdocs/dev/debt/libkernel.md's entry on libSceNet sockets, wheremainaddspollandfcntland this PR addsgetsockopt; the merge keeps both, in the same words as #9515's merge. The PR's code diff is unchanged.guest_sce_netandguest_tcppass 10 runs in a row on both runners.guest_floating_point, which this PR doesn't touch, passed 10 of 10 on Windows; on Linux it passed seven times and aborted on the eighth run, atfeholdexcept workers preserve the main environment. At6c938db3ceit passed 20 runs in a row on both runners (run). That check is the AMD x87 pointer-word case reported in #10899, which #10937 addresses; both aborts here were on AMD EPYC Linux runners. Suites: libc and libkernel pass on Linux (144 and 207) and on Windows (171 and 223). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.89da0c7455, a merge ofmain2b5225605b(run).mainnow has #9494, so its part of this branch leaves the diff: the IPv6 text conversion insceNetInetPtonandsceNetInetNtop,CheckRejectedAddressTextand thesceNetInetPton, sceNetInetNtopdebt entry. This PR's other changed lines are the same as before the merge. One conflict, indocs/dev/debt/libSceNet.md: KernelPanicNT's #9727 adds asceNetResolverStartNtoaentry after thesceNetInetPton, sceNetInetNtopentry both sides now carry, and the merge takes it.guest_net_ctlandguest_sce_netpass 10 runs in a row, andguest_sce_netfails on the before arm. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (144 and 209), and libc passes on Windows (171). Windows' libkernel suite runs 227 tests and failsguest_timed_join_import_libkernel_sysandguest_timed_join_import_libkernel_web, which this PR doesn't touch;main88f99678bffails the same two in this verify's Windows job (run), andmain's own Windows CI passes them. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.57ba2fc47c, after oneandonlydean's review (run). It holds three commits:f051532324, a merge ofmain439d03db38, whose one conflict, in libSceNetCtl'sExport.cpp, keeps this PR'sNetCtlHostIpv4Gatewayhelper next tomain's STUN block from #10790;930c1c0ec0, which removes the four assertions that pinned valid inputs to throw (the named zonefe80::1%lo0, the two AF_INET scope conversions, andsceNetConfigGetDefaultRoutewith a valid output and no host gateway), keeping the malformed and null-pointer checks, the numeric IPv6 round trips and the success and no-write controls; and a merge of #9515's4432e8aa57, which drops the duplicate readback block (see #9515). This PR's other changed lines are the same.guest_sce_net,guest_net_ctl,guest_socket_error,guest_socket_options,guest_tcp,guest_net_boolean_readback,guest_socket_descriptor_flagsandpublic_headerspass 10 runs in a row. Linux: 8 run, 8 pass, 0 skip, 0 fail. Windows: 8 run, 8 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (166 and 264). On Windows libc passes (194) and libkernel passes 283 of 286:exec_arguments,guest_timed_join_import_libkernel_sysandguest_timed_join_import_libkernel_webfail at their setup in the verify's Windows build (FileNotFoundErrorstarting the title, or copying the libraries they load), withmain's code too, and pass inmain's own Windows job at1829def9bf(job). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.8c13ac3865, a merge ofmaincc672fdfc6(run). The one conflict was in libSceNet'sExport.cpp, where #10502 (frankea, the interface and socket tables fromsceNetShowIfconfigandsceNetShowNetstat) declares libSceNetCtl'sNetCtlHostIpv4Address_nid_no_patchon the line where this PR declaresNetCtlHostIpv4Gateway_nid_no_patch; the merge keeps both declarations. This PR's other changed lines are the same.guest_sce_net,guest_net_ctl,guest_net_boolean_readback,guest_socket_descriptor_flags,guest_socket_error,guest_socket_optionsandguest_tcppass 10 runs in a row. Linux: 7 run, 7 pass, 0 skip, 0 fail. Windows: 7 run, 7 pass, 0 skip, 0 fail. Suites: libc and libkernel pass on Linux (166 and 265). On Windows libc passes (194), and libkernel passes 284 of 287:exec_arguments,guest_timed_join_import_libkernel_sysandguest_timed_join_import_libkernel_webfail at their setup in the verify's Windows build (FileNotFoundErrorstarting the title, or copying the libraries they load), withmain's code too, and pass inmain's own Windows job at1829def9bf(job). The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.e88598fd9e, a merge ofmain2960e9a6e7after #9515 merged (run). The merge was clean. With #9515 onmain, its lines leave this PR's diff: the libkernel socket files and debt entry, and its getter in libSceNet'sExport.cppwith its tests inGuestSceNet.cpp. The diff now holds only libSceNet, libSceNetCtl,GuestSceNet.cppand libSceNet's debt file, and this PR's own changed lines are the same as before the merge.guest_sce_net,guest_net_ctl,guest_net_boolean_readback,guest_socket_descriptor_flags,guest_socket_error,guest_socket_optionsandguest_tcppass 10 runs in a row, and withmain's codeguest_sce_netfails on both runners ("sceNetSocketInternal not implemented"). Linux: 7 run, 7 pass, 0 skip, 0 fail. Windows: 7 run, 7 pass, 0 skip, 0 fail. The libc and libkernel suites run 191 and 291 tests on Linux and 220 and 314 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.0a4d4e792c, the module's answers for the scope-ID forms and the default route (run). Two commits one88598fd9e, with no merge.guest_sce_netand the 11net_dontwait_blocking_*andnet_epoll_lifetime_*tests, which build libSceNet'sExport.cppinto themselves, pass 10 runs in a row. Linux: 12 run, 12 pass, 0 skip, 0 fail. Windows: 12 run, 12 pass, 0 skip, 0 fail. With e88598fd9e'sExport.cpp,guest_sce_netaborts on both runners at its first new check ("the interface name zone in fe80::1%lo0 is not implemented"). The libc and libkernel suites run 191 and 291 tests on Linux and 220 and 314 on Windows, with 0 failed. The suites ran withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.0x8041130Cwith the output untouched, for a null output too) also ran on Linux in a network namespace with onlyloup.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T03:49:35Z.
I reviewed the current overlap report against the declared dependency branches. #9515 changes
libSceNet/Export.cppandSocket/src/Udp.cpp, which are also in this PR's aggregate diff because #9578 is stacked on it. The relevant work composes in principle: the newgetsockoptgetter uses the socket-option hook added by #9515, and the Ex forwarding methods use thesceNetGetsockoptimplementation updated there. Please keep #9515's hook and option behavior intact when reconciling; the required dependency is already declared.One additional overlap needs coordination: #9231 remains open and changes
sceNetInetPtonin the sameExport.cpp, while this PR changes that function's IPv6 conversion path to use libkernel's parser. Its change is Apple-only and should compose with the family-specific IPv6 delegation, but that needs an agreed order/rebase and retention of the leading-zero IPv4 behavior. Please coordinate with #9231's author and record a dependency if either PR must land first.The no-gateway branch of
sceNetConfigGetDefaultRouteis explicitly not exercised in the reported Linux run. Its helper correctly leaves the caller's output untouched when it finds no route, and the code throws in that case; keep the debt statement that this result is unverified.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:10:59Z.
Review: APPROVED
Reviewed the eight-commit diff and the focused coverage. The Ex/Internal forms are explicit forwards with uncertainty recorded; sysctl is routed through the existing libkernel implementation and its error mapping is documented as unverified; scope IDs are deliberately numeric-only with unsupported interface-name/AF_INET paths left throwing; and the default-route helper writes only after finding a gateway, with its no-route and null behavior kept explicitly unimplemented. The tests include boundaries/rejections, focused red-green controls, repeats, and accurately disclose the missing no-gateway execution and IPv6 environment limitation. The checklist declares the stacked prerequisites #9494 and #9515 and correctly says no title unblock. Eligibility, conventions, intake, labels and report checks pass; product build jobs are skipped. The Linux/Windows comparisons in the description are author-reported; I did not run tests locally. No actionable issue found in this review.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T05:01:43Z.
Thanks, @MarcZX10. Gonic0 agreed on #9231 that neither PR waits for the other (comment): its macOS check of an IPv4 address's leading zeros runs before the host conversion, which this stack leaves IPv4 to, and the two merge cleanly with this PR and with #9494. The Overlap section and Depends on now say so, here and on #9494, where the
sceNetInetPtonIPv6 change comes from.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T10:37:15Z.
Review: CHANGES_REQUESTED
Follow-up to my earlier approval after refreshing
upstream/mainand rerunning the focused target on this exact head. The localguest_sce_net_teststarget builds successfully from this PR head. CTest starts the test, but the process aborts inHostCpubefore test assertions because this host lacks LZCNT, BMI1/2, MOVBE, AVX2 and FMA. The PR's Linux/Windows test matrix is reported as author-run on a merge of #9494 and #9515; current required eligibility, conventions, intake, labels and report checks pass, while product and relinker jobs are skipped by path policy. Please refresh the branch against currentmainand rerun the focused Linux/Windows checks before merge.check_main_sync.pyreports 10 ahead / 116 behind (merge base94fbb8cea), despite a clean merge. Since the PR's last checked base6ef5a1cand that merge base, main changedlibSceNet/Export.cpp,libSceNetCtl/Export.cpp,GuestSceNet.cppand both debt files. In particular,GuestSceNet.cppnow has additional tests, andlibSceNetCtlinitialization changed; please verify the new cases and the default-route helper still behave as intended after rebasing. My prior review found no code defect on the then-current base. The focused Linux/Windows checks in the PR description are useful evidence; the remaining requests are for current-base validation only. I withdraw the queue-based hold; it is fine to keep submitting PRs and they will be handled in due course.I’ve noticed that holding this PR because of #5239 isn’t necessary. It’s fine for PRs to keep coming in; they’ll be handled in due course. Please disregard my earlier request to hold or defer it.
Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T14:15:55Z.
mainis merged (8b3e39832a,43ea7772bb), with the PR's own diff unchanged;guest_sce_netandguest_net_ctlpass 10 of 10 on GitHub's Linux and Windows runners (run).Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T08:25:44Z.
Review: APPROVED
Re-reviewed exact head
e88598fd9e9e933fa281e54993bff47a0c7692b9against currentupstream/main4c7d275bef89d309313d16bc2bc05d37a1b50be2. The PR’s previously raised test issue is resolved: the assertions that pinned valid-but-unimplemented scope/default-route forms to throwing were removed, and the remaining malformed-input, numeric IPv6, and success/no-write cases are retained. The author reports the focused Linux and Windows suites passing 10 runs on this exact head. I refreshed the head, verifiedgit merge-tree --write-treeproduces a clean current-main preview, and rangit diff --checkandpython3 tools/check_conventions.py --base upstream/main; all passed. I found no remaining blocking issue.