fix(libSceNet): report SO_SNDBUF and SO_RCVBUF from sceNetGetsockopt #5536
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5536"
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 milescoviello on 2026-10-13T23:07:30Z.
What
Steam Remote Play (PPSA99350, from the homebrew catalog) reads
SO_RCVBUFon its UDP socket withsceNetGetsockopt. Onmainthat fails withEOPNOTSUPP(0x8041012d), althoughsceNetSetsockoptalready acceptsSO_SNDBUFandSO_RCVBUF.FreeBSD 11.4 answers both options with the buffer's high-water mark (
sogetopt,sys/kern/uipc_socket.c):sosetoptsets that mark to the requested size throughsbreserve(chgsbsize(..., &sb->sb_hiwat, cc, ...)), so a guest reads back exactly the size it set.sceNetGetsockoptnow answers both options:sceNetSetsockoptis reported as it was set. Reading the host instead would give twice the value on Linux, which doubles it.guest_sce_netgainsCheckBufferSizes. On a UDP socket both options are readable with a positive size before any set, andSO_SNDBUF32768 andSO_RCVBUF65536 read back exactly aftersceNetSetsockopt.Rebased onto #4988, which added
SO_ERRORto the sameswitchand a field to the sameSockstruct; both cases and both fields are kept. #5349 changes a nearby line ofGuestSceNet.cppand does not change these two options.Tested
Ubuntu 24.04, GCC 13.3 (CI's compiler), Release with CI's configure flags, on
main30f961266:main'sExport.cppand the new test,guest_sce_netfails; with the change it passes 20/20.guest_*tests pass in two runs.-fsyntax-only -Wall -Wextracompile ofExport.cppis clean.--to-inteland run on Linux under gdb, logging every libSceNet and other service call that returns an error code:main's libSceNet,sceNetGetsockoptreturns0x8041012d.sceNetSendtowithENETUNREACH, because the run has no network.tools/check_conventions.py --base upstream/mainpasses.Checked on Windows by orishamir (comment): Windows 11, RTX 4080, WinLibs GCC 15.2, this head on
maine34c47921.guest_sce_netpasses 5 of 5 and aborts withExport.cpptaken back tomain; the fullctesthas no failures. Steam Remote Play (PPSA99350) logsSO_RCVBUF 0onmainand the socket's own4194304with this change.Not checked on a console.
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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T02:58:05Z.
Rebased onto
main486420f91after #4988 merged. The conflict was itsSO_ERRORcase andreported_errorfield next to these; both are kept. After the rebase: the build is clean,guest_sce_netpasses 5/5 and all 357guest_*tests pass (Ubuntu 24.04, GCC 13.3, Release). A MinGW-w64 GCC 13-fsyntax-only -Wall -Wextracompile ofExport.cpphas no errors.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by orishamir on 2026-10-14T16:57:50Z.
Windows run, since the description says Windows wasn't checked. Windows 11, RTX 4080, WinLibs GCC 15.2.0 r7, Release, this head (
2c25b181f) merged ontomaine34c47921.guest_sce_netpasses 5 of 5. The fullctesthas 0 failures out of 1198; the 14 skips come from the tests' own checks.core/libs/prx/libSceNet/Export.cpptaken back tomain,guest_sce_netaborts (exit 0xC0000409).SO_RCVBUFon a new UDP socket and logs it (src/main.cpp). Onmainit logssocket self-test: SO_RCVBUF 0. With this PR it logsSO_RCVBUF 4194304, which is the Winsock socket's own size here: nothing in libSceNet sets it before the read. Otherwise the two runs match: same state (LOOKING FOR A PC RUNNING STEAM), 16 dumped frames each and no new stderr line.AI-assisted: yes (Claude Code Opus 5.5)
Imported from boykopovar/AnyPS5. Originally posted by milescoviello on 2026-10-14T17:02:32Z.
Thanks for the Windows run, and for checking that the test aborts with
main'sExport.cpp. I added it to the description.AI-assisted: yes
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T21:47:18Z.
Checked the diff against FreeBSD
sogetopt(sb_hiwat),guest_sce_net(passes; aborts withExport.cppreverted tomain), and orishamir's Windows run; merging.