Repository navigation
fix(libSceNet): follow FreeBSD inet text rules for IPv6 - #9494
EagleBearerYS wants to merge 4 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.
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 |
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.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)