fix(libSceNet): preserve successful stream recvfrom results #4394
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4394"
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 AaravMehta-07 on 2026-10-12T09:07:28Z.
What
Recognize
AF_UNSPECas an absent native address in the existing address converter: set the output length to zero without touching the address buffer. This keeps a successfulsceNetRecvfromresult when a TCP receive returns no sender, matching the no-sender resultsceNetRecvmsgalready produces. Other unsupported native families still fail conversion. Previously a TCP read with a sender buffer consumed the bytes, then returnedNET_EAFNOSUPPORTinstead of the received byte count.A guest-export loopback probe on unpatched code received
Xbut returned-2143223505with errno 47 and address length 16. With this change it returns 1, preserves errno 123, reports address length 0 and leaves the address canary unchanged.This is the SceNet counterpart of libkernel's already-merged #3957. FreeBSD 11.4
kern_recvitreports zero name length when no sender is returned. Console hardware behavior has not been measured. No fake peer address or silent stub is introduced.The guest regression covers IPv4/IPv6 TCP in both directions, zero/short/full/oversized address capacities, zero-byte and ordinary peeks, consuming reads, EOF, unchanged address buffers and preserved errno. It also checks that an invalid null length is rejected before consuming data and that a null address leaves an unrelated length unchanged. Existing datagram tests protect UDP behavior.
The conversion-helper change is independent of #4092 (receive timeouts), #4112 (errno propagation) and #4272 (receive write guards); it leaves their receive-call edits alone.
Tested
BUILD_TESTING=ON: full CMake configuration and default build passed. All 14 networking/address CTest cases passed;guest_sce_netpassed ten repeated runs.BUILD_TESTING=ON: full CMake configuration and default build passed. All 15 networking/address CTest cases passed (the Windows selection plusguest_select);guest_sce_netpassed ten repeated runs.guest_sce_netaborts on unpatched code on Windows and Ubuntu under WSL2, and passes with this fix on both.check_conventions.pypassed with this title/body;pr_overlap.pyreported no overlap with open pull requests. Three-way merges with #4092, #4112 and #4272 were also clean.Checklist
main; no other open PR implements the same functions.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T09:55:34Z.
Windows test: head
74defef67merged onto currentmain9aa5fd290(clean merge, no conflicts). Windows 10, MinGW GCC (WinLibs), Ninja Release,-j4: the full build finished with 0 errors;ctest -R guest_sce_net: 1/1 passed (guest_sce_net, 0.39 s, includes the new test code incore/libs/tests/GuestSceNet.cpp);python tools/check_conventions.py --base upstream/main: passed. I did not run the new test againstmainwithout the change.AI-assisted (Claude Code).