fix(libSceNet): follow FreeBSD inet text rules for IPv6 #9494
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9494"
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-21T23:21:47Z.
Opened again from #4886: title-less conformance fixes of this kind are merged now, for example #7365 and #8411.
What
On Windows,
sceNetInetPtonandsceNetInetNtop(libSceNet/Export.cpp) convert IPv6 text with Winsock'sInetPtonAandInetNtopA, whose text rules differ from FreeBSD 11.4's. This is the libSceNet half of #3126: #3530 fixed the same difference in libkernel'sinet_ptonandinet_ntop.With Winsock, which
main's functions return as is, and with glibc, whose rules match FreeBSD's:mainsceNetInetNtopof::ffff:0.0.0.1::ffff:0:1::ffff:0.0.0.1sceNetInetNtopof::ffff:0:102:304::ffff:0:1.2.3.4::ffff:0:102:304sceNetInetNtopoffe80::5efe:102:304fe80::5efe:1.2.3.4fe80::5efe:102:304sceNetInetPtonof::01.2.3.4sceNetInetPtonof::1.2.3.04sceNetInetPtonof::ffff:01.2.3.4FreeBSD:
::a.b.c.dand::ffff:a.b.c.d(inet_ntop.cL167-L170);inet_pton4(inet_pton.cL181-L182), which rejects a leading zero (L94-L95).Both functions now convert IPv6 text with libkernel's
__inet_pton_nid_postfixand__inet_ntop_nid_postfix, on every host. IPv4 text keeps the host conversion: #7921 and #8056 gavesceNetInetPtonIPv4 rules measured on a PS4 since #4886 was opened, so this PR no longer touches IPv4. libSceNet's own handling around the conversion stays asmainhas it:EINVAL, and another family givesEAFNOSUPPORT;sceNetInetNtopstill converts into its own buffer and copies the text, so a short buffer still givesENOSPC(28) throughsceNetErrnoLoc.Linux already follows these rules through glibc, so nothing changes there. No title is claimed. The new debt entry says that the IPv6 rules are libkernel's and unverified on a console, as libkernel's own entry does.
Overlap: #9231 (Gonic0) adds a macOS check of an IPv4 address's leading zeros in
sceNetInetPton, before the host conversion this PR leaves IPv4 to. The two merge without a conflict in either order, and Gonic0 agreed that neither waits for the other (comment). #9506 (Noxy-HNR) changes the DNS functions in the sameExport.cppand other lines of libSceNet's debt file; it merges cleanly with this PR, and no order is needed.Tested
On GitHub's runners from my fork, merged with
mainata6dcea9279(run):guest_sce_netchecks three more round trips withCheckAddressText:::ffff:0.0.0.1,::ffff:0:102:304andfe80::5efe:102:304. Each goes from text to an address and back, withENOSPCfor every buffer shorter than the text.CheckRejectedAddressTextchecks thatsceNetInetPtonreturns 0 and leaves the destination untouched for::01.2.3.4and::ffff:01.2.3.4.main'sExport.cppguest_sce_netfails. With the change it passes 10 runs in a row, withmain's IPv4 whitespace andsceNetInetPtonExchecks.guest_sce_netpasses withmain's code, because glibc already follows these rules, and 10 runs in a row with the change.core/libs/prx/libcandcore/libs/prx/libkernelpasses: 115 and 197 on Linux, 142 and 207 on Windows.mainat4a17c71757(094e920c5d, no conflicts, the PR's own diff unchanged; run):guest_sce_netfails on Windows withmain'sExport.cppand passes 10 runs in a row with the change; on Linux it passes both ways. The libc and libkernel suites pass on both (116 and 197 on Linux, 143 and 207 on Windows).tools/check_conventions.py --base origin/mainpasses.fca8266468, 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_sce_netpasses 10 runs in a row on both runners, 1 of 1 each, none skipped. The libc suite passes on both; in the Windows libkernel suiteguest_raise_in_system_calltimed out, a known intermittent timeout on GitHub's Windows runner. The suites run withAPS5_SKIP_TIMING_TESTS=1, which relaxesprecise_wait's median bounds on GitHub's hosted runners.fc881b9259, a merge ofmaine05ba6feeb(run).main's #10706 removes the local declarations at the top of libSceNet'sExport.cpp, where this PR had added__inet_ptonand__inet_ntop. libkernel'sApi.hpp, whichExport.cppincludes, now declares both, so the merge takesmain's side there. Theguest_sce_netandpublic_headerstests pass 10 runs in a row. Linux: 2 run, 2 pass, 0 skip, 0 fail. Windows: 2 run, 2 pass, 0 skip, 0 fail. The before arm failsguest_sce_neton Windows. 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.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-21T23:27:16Z.
Review: APPROVED
Reviewed the IPv6 conversion routing and regression coverage. The change delegates only IPv6 text conversion to libkernel’s FreeBSD-compatible helpers, leaves IPv4 conversion untouched, and retains libSceNet’s surrounding error and destination-buffer behavior. The tests cover mapped and embedded IPv4 forms, rejection of dotted octets with leading zeroes, and destination preservation. The reported Linux and Windows guest suites pass; conventions, intake, eligibility, labels and report checks pass, while hosted product builds are skipped.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T02:11:19Z.
Review: APPROVED
Re-reviewed the current head and manually checked the shared-file warnings. The open PRs listed there change adjacent socket functions, other exports, or unrelated test cases; none overlaps the IPv6 text-conversion implementation or its assertions. The conversion change remains limited to IPv6 and uses libkernel's FreeBSD-compatible helpers; IPv4 host conversion and libSceNet's error handling remain intact. The reported Windows and Linux guest suites cover the changed behavior. Hosted policy checks pass; product and relinker jobs are skipped. No local tests were run.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:26:51Z.
Review: DISMISSED
The IPv6 conversion change remains narrowly scoped and the reported tests cover the changed Windows behavior, invalid dotted-tail leading zeroes and output preservation; IPv4 conversion and the surrounding error contract stay intact. I manually checked the uncomparable export warnings at a high level, but the live overlap table now includes #9506 touching
Export.cppand the same debt file. Its DNS implementation and this PR’s IPv6 conversion are distinct behavior, but the shared export/debt hunks need a current combined-base check and both registrations/entries must survive. The PR is based ona6dcea9279while current upstream main isab347d144d. Please rebase, coordinate/record any needed merge order with #9506, and rerun the focusedguest_sce_nettest and conventions/overlap checks on current main. Hosted product jobs are skipped; I did not run local tests.Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-22T06:00:48Z.
Thanks, @MarcZX10. The branch now has
mainat4a17c71757merged in (094e920c5d), with the PR's own diff unchanged. On GitHub's runners (run)guest_sce_netpasses 10 runs in a row on both and fails on Windows withmain's code; the libc and libkernel suites pass on both, and conventions pass. Tested now says so. #9506 merges cleanly with this PR: its DNS changes and debt lines don't meet this PR's, so no order is needed, and Overlap and Depends on now say so.