Repository navigation
fix(libSceNet): follow FreeBSD inet text rules - #4886
Closed
EagleBearerYS wants to merge 2 commits into
Closed
EagleBearerYS wants to merge 2 commits into
EagleBearerYS wants to merge 2 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.
This was referenced Oct 13, 2026
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.
11 tasks done
Collaborator
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, onmainat 0c3dc9c: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)