Repository navigation
fix(libSceNet): follow FreeBSD inet text rules for IPv6 - #9494
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.
MarcZX10
left a comment
There was a problem hiding this comment.
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.
|
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.
|
MarcZX10
left a comment
There was a problem hiding this comment.
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.
MarcZX10
left a comment
There was a problem hiding this comment.
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.cpp and 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 on a6dcea9 while current upstream main is ab347d1. Please rebase, coordinate/record any needed merge order with #9506, and rerun the focused guest_sce_net test and conventions/overlap checks on current main. Hosted product jobs are skipped; I did not run local tests.
|
Thanks, @MarcZX10. The branch now has |
Main's boykopovar#10706 removes the local declarations at the top of libSceNet's Export.cpp, where this branch had added __inet_pton and __inet_ntop. libkernel's Api.hpp, which Export.cpp includes, now declares both, so the merge takes main's side there.
Dismissing a stale review: the requested changes were addressed after it (new head) and the merge queue blocks on it. Please request changes again if anything is still open.
|
Checked the IPv6-only routing through libkernel's |
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
mainat a6dcea9 (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.mainat 4a17c71 (094e920, 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.maindb6af9e (run).mainnow has fix(libSceNet): convert sceNetInetPton text and null outputs as measured on a PS5 #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.maine05ba6f (run).main's refactor(libs): add full export headers for libs #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)