Repository navigation
feat(libSceNet): implement the Ex and Internal socket forms, sceNetSysctl, scope-ID text and the default route - #9578
EagleBearerYS wants to merge 13 commits into
Conversation
sceNetInetPton and sceNetInetNtop called Winsock's InetPtonA and InetNtopA on Windows. Those print IPv4-translated and ISATAP addresses with a dotted tail, print ::ffff:0.0.0.1 as ::ffff:0:1, and accept a leading zero in a dotted tail, where FreeBSD does neither. Both now convert with libkernel's inet_pton and inet_ntop, which follow the FreeBSD 11.4 rules since boykopovar#3530.
boykopovar#5124 adds an entry after sceNetShowNetstat at the end of the unknown function info list, so adding the inet entry there made the two pull requests conflict.
…ockopt sceNetSetsockopt takes both, but sceNetGetsockopt failed them with EOPNOTSUPP. It now reads them from the host socket. FreeBSD's sogetopt returns so_options & option for the boolean options, so they read back as 0x4 and 0x20 when set.
setsockopt reaches a socket created with sceNetSocket through the option setter libSceNet registers, but getsockopt looked the descriptor up only among libkernel's own sockets and failed, so a title could set an option on such a socket through the BSD call and not read it back. libSceNet now registers an option getter with libkernel next to its setter, which answers through sceNetGetsockopt, so SO_RCVTIMEO and SO_SNDTIMEO come back as a struct timeval.
…ns to their public twins sceNetSocketInternal, sceNetGetsockoptEx and sceNetSetsockoptEx threw. Their argument lists, restored with the rest of the firmware exports in 4d6942f, are the same as sceNetSocket, sceNetGetsockopt and sceNetSetsockopt, so they now call those. Nothing in the tree records how the console tells the entry points apart (for example by the calling process); the debt file says so. Tested: guest_sce_net_tests creates a datagram socket through sceNetSocketInternal, sets SO_REUSEADDR and SO_RCVTIMEO through sceNetSetsockoptEx and reads them back through sceNetGetsockoptEx and sceNetGetsockopt with the same values. On a closed socket and on -1, and for an unsupported family and type, each Ex/Internal call returns the same error and errno as its public twin.
sceNetSysctl threw. Its restored argument list is FreeBSD's sysctl(3) (name, name length, old value and size, new value and size), so it now calls libkernel's sysctl. It answers exactly the MIBs libkernel models, and a failure is returned as the library's other calls return one (0x80410100 | errno, with the errno set). Tested: guest_sce_net_tests reads hw.pagesize (6.7) through both sysctl and sceNetSysctl and gets the same value and size, including a size-only query. A one-level name gives EINVAL, a null name EFAULT, a write EPERM and a one-byte buffer ENOMEM, each as 0x804101xx with the errno set.
sceNetInetNtopWithScopeId and sceNetInetPtonWithScopeId threw. They now handle AF_INET6 text with an RFC 4007 numeric zone (fe80::1%2): the address part goes through sceNetInetNtop and sceNetInetPton, so it follows the FreeBSD inet text rules, and the zone is printed and parsed as FreeBSD 11.4's getnameinfo (NI_NUMERICSCOPE) and getaddrinfo do. A zero scope ID prints the address alone and text without a zone parses to scope ID 0. An empty zone, one above 2^32 - 1, or an invalid address part returns 0 and leaves both outputs untouched; a buffer too small for the scoped text gives ENOSPC. A zone given as an interface name, and AF_INET, still throw: the tree has no mapping from interface names to the console's interface indexes and no answer for an IPv4 zone. The debt file says so. Tested: guest_sce_net_tests round-trips fe80::1%2 (same address bytes as fe80::1, scope ID 2) and ff02::1%4294967295, checks the exact buffer size and ENOSPC one byte short, the unscoped forms, four rejected texts with untouched outputs, EINVAL for null pointers, and that an interface-name zone and AF_INET throw.
…ultRoute sceNetConfigGetDefaultRoute threw. It now writes the IPv4 gateway of the host interface that libSceNetCtl's sceNetCtlGetInfo already describes as DEFAULT_ROUTE, in network byte order, the order sceNetInetPton writes an AF_INET address in, and returns 0. libSceNetCtl exports NetCtlHostIpv4Gateway_nid_no_patch for it, next to the DNS helper sceNetGetDnsInfo uses. Without a gateway, or for a null pointer, it still throws: the console's answer for a missing route is not measured. Tested: guest_sce_net_tests, after sceNetCtlInit, prints the gateway with sceNetInetNtop and compares it with sceNetCtlGetInfo's DEFAULT_ROUTE text (192.0.2.1 on this host); a null pointer throws. On a host without a default route the case checks that the call throws and leaves the output untouched.
Progress report (3b6613e → dda8c45)📈 System libraries: 47.47% (+0.06%, +7 implemented functions) ✅ 7 implemented
|
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
I reviewed the current overlap report against the declared dependency branches. #9515 changes One additional overlap needs coordination: #9231 remains open and changes The no-gateway branch of |
MarcZX10
left a comment
There was a problem hiding this comment.
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.
|
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 |
There was a problem hiding this comment.
Follow-up to my earlier approval after refreshing upstream/main and rerunning the focused target on this exact head. The local guest_sce_net_tests target builds successfully from this PR head. CTest starts the test, but the process aborts in HostCpu before 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 current main and rerun the focused Linux/Windows checks before merge. check_main_sync.py reports 10 ahead / 116 behind (merge base 94fbb8cea), despite a clean merge. Since the PR's last checked base 6ef5a1c and that merge base, main changed libSceNet/Export.cpp, libSceNetCtl/Export.cpp, GuestSceNet.cpp and both debt files. In particular, GuestSceNet.cpp now has additional tests, and libSceNetCtl initialization 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.
|
I also withdraw the stale-base request. The current head |
|
I’ve noticed that asking you to hold this PR was unnecessary. It’s fine to keep submitting PRs; maintainers will handle them in due course. |
# Conflicts: # docs/dev/debt/libkernel.md
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.fe80::1%2, RFC 4007 section 11) through sceNetInetNtop and sceNetInetPton. They print and parse it as FreeBSD's getnameinfo with NI_NUMERICSCOPE and getaddrinfo do. Interface-name zones and AF_INET throw.Still throwing:
This is stacked on #9494 and #9515. 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, onmain6ef5a1c. The conflicts the check reports all come from #9515's commits in this branch's base, not from this PR's own commits: #9365, #9099 and #8359 indocs/dev/debt/libkernel.md, and #7511 inSocket/src/Udp.cpp. This PR's commits change only libSceNet, libSceNetCtl,GuestSceNet.cppand libSceNet's debt file. #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). #9542 (Queuse) duplicates thesceNetGetsockoptreadback of #9515's e887616, which this branch carries. Under the order agreed on #9515 (comment), #9523 → #9542 → #9515 → this PR, #9515 drops that hunk once #9542 lands, and this PR follows at its next merge ofmain.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.main8b3e398 merged 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.main938812d (efd999c). 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.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)