fix(libSceNet): follow FreeBSD inet text rules #4886
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4886"
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-13T01:49:23Z.
What
On Windows,
sceNetInetPtonandsceNetInetNtop(libSceNet/Export.cpp) call 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, and #3126 notes that the libSceNet calls "still use the host functions and have the same difference".Measured on this PC 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 with libkernel's
__inet_pton_nid_postfixand__inet_ntop_nid_postfix. libSceNet's own checks stay:EINVAL, and another family givesEAFNOSUPPORT;ENOSPC(28) throughsceNetErrnoLoc, now taken from libkernel's errno.The
NET_ENOSPCconstant had no other use and is removed. Linux already follows these rules through glibc, so nothing changes there. No title is claimed. The new debt entry says that the rules are libkernel's and unverified on a console, as libkernel's own entry does.Tested
Windows 11 (10.0.26300), WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release,
-DBUILD_TESTING=ON, onmainat0c3dc9ca2: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.cppthe test aborts at the first new check, wheresceNetInetNtopreturns::ffff:0:1. With the change it passes 20 runs in a row.guest_sce_net,guest_memory_pool_statsandguest_resolver;guest_datagram_*andguest_socket_host_write_*tests;core/libs/prx/libc/CMakeLists.txtandcore/libs/prx/libkernel/CMakeLists.txtthat build on Windows, libkernel'sguest_addressesamong them.tools/check_conventions.py --base origin/mainpasses.guest_sce_netpasses withmain'sExport.cpp, because glibc already follows these rules. With the change it passes 20 runs in a row.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 github-actions[bot] on 2026-10-13T21:25:12Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceNet.mdL6Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T02:36:43Z.
Closing: no title is known to reach this. With the queue at 700+ open PRs, please hold off on new PRs that don't name a title needing the change until it's down. If a title stops on this on current main, reopen with the title ID and the log line.
Pull request closed