fix(libkernel): report SO_ERROR and the other SOL_SOCKET options like FreeBSD #4796

Merged
xXPBSXx merged 1 commit from upstream-pr/4796 into main 2026-10-14 02:37:42 +00:00
xXPBSXx commented 2026-10-12 22:11:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-12T22:11:47Z.


What

getsockopt and setsockopt on a libkernel socket knew four SOL_SOCKET options (SO_REUSEADDR, SO_BROADCAST, SO_SNDBUF, SO_RCVBUF) and failed every other one with ENOPROTOOPT. The options now follow FreeBSD 11.4's sosetopt and sogetopt (the same constants libSceNet already uses, for example NET_SO_RCVTIMEO = 0x1006):

  • SO_ERROR (0x1007) returns the socket's pending error as a FreeBSD errno and reports it once. On Windows the host does not clear it when read, so the library does.

  • SO_KEEPALIVE, SO_DONTROUTE, SO_OOBINLINE and SO_LINGER are read from and set on the host socket; SO_TYPE and SO_ACCEPTCONN are read only (as is SO_ERROR), and setsockopt on any of the three fails with ENOPROTOOPT, as FreeBSD's sosetopt has no case for them (they reach its default; the test does not cover this). A boolean option reads back as its own bit (FreeBSD returns so_options & option), SO_LINGER as {SO_LINGER bit, seconds}.

  • SO_DEBUG, SO_USELOOPBACK, SO_REUSEPORT, SO_TIMESTAMP and SO_NOSIGPIPE are left out and still fail with ENOPROTOOPT, as on main, until a title needs one (review of this PR).

  • Lengths follow sooptcopyin / sooptcopyout: a value is read from its first int and fails with EINVAL when shorter; a getsockopt buffer gets as many bytes as it holds and its own length back. SO_SNDBUF / SO_RCVBUF below 1 fail with EINVAL, SO_LINGER outside 0 to 65535 seconds with EDOM.

  • A connect on a non-blocking socket on Windows fails with EINPROGRESS (36) now; it returned EWOULDBLOCK (35), which a program waiting for the connection does not expect. This is the other half of what SO_ERROR is for, so it is in the same change.

Title: The Mound (PPSA26223, EOS SDK). With a temporary trace in socket and getsockopt (not part of this PR), a Windows run (it ended after a few seconds at an unrelated GPU error, #1409) showed 6 calls socket(2, 1, 0) (AF_INET, SOCK_STREAM) and 2 calls getsockopt(fd, 0xffff, 0x1007), SO_ERROR, on two different sockets; no setsockopt and no other option was requested. Those two calls failed with ENOPROTOOPT before. Stray and Harmony's Odyssey made no libkernel socket call in the same kind of run. Palworld (also EOS SDK) was not measured. A separate Linux run by coltken95 with Nuvio Max'd (PPSA99288), reported in the comments below, shows the same SO_ERROR failure of curl's connect check and its fix by this PR. The options other than SO_ERROR are not requested by any title I ran; they follow FreeBSD for completeness.

Overlap: #4903 also changes Udp.cpp and conflicts with this branch there (reported by the overlap bot), so whichever lands second needs a small rebase. #5403 contains #4903's commit and conflicts here for that reason: both add fields to struct Socket at the same place (options here, receiveShut and sendShut there). Keeping all three fields resolves it, in either order. #4658 (accepting option values longer than an int) and #4391 (descriptor numbering) are merged; the routing in SocketOptions.cpp covers every option (the GuestUdp test still passes). The test registration and the TechnicalDebt entry sit at their own places in CMakeLists.txt and libkernel.md (next to guest_udp and the socket error numbers entry), away from the other socket PRs. Receive and send timeouts, the low-water marks and the IPPROTO_TCP, IPPROTO_IP and IPPROTO_IPV6 levels are not part of this PR (they still fail with ENOPROTOOPT). #5510 (simonbronk, EPIPE for a stream send after the peer closed) conflicts with this PR in docs/dev/debt/libkernel.md (git merge-tree of the two heads, re-checked against main ce5c83953; both heads are clean against main); whichever lands second rebases the debt entry. #5565 (Dripl1x, TCP_NODELAY, SO_NOSIGPIPE and SO_NBIO) conflicts with this PR in core/libs/prx/libkernel/Socket/src/Udp.cpp, in the lines of setsockopt and getsockopt this PR rewrites (git merge-tree of the two heads, re-checked against main ce5c83953; both heads are clean against main); its text already says it goes after this PR, and its three options move into SocketOptions.cpp on the rebase.

Title evidence from screamm's Windows validation on this PR (comment of 13 October, 07:46Z; head e6740bc6): traced on main in ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 and OpenSSL 3.5.2 over libkernel sockets), connect(12, 91.98.4.78:443) returns errno 35, poll then reports POLLOUT, and getsockopt(12, SOL_SOCKET, SO_ERROR) fails with errno 42, which curl's verifyconnect() takes as the connect error (Could not connect to server, curl 7); ProsperoRadio is the title that was traced, PSXS5, SwanStation and ProsperoTV bundle the same libcurl. With this PR the same trace shows errno 36 and SO_ERROR 0, and the TCP connection succeeds; the next failure there is OpenSSL's CA file path (a separate gap, issue #5001). The trace is screamm's, not run by me.

More title evidence, from p3n1cillin's comment on this PR (13 October, 14:48Z): PS5MC (PPSA99420, Kodi 22) on main 3faa9cb40 merged with other open PRs it needs to start. Without this PR Kodi's connectivity check fails about 10 ms after each connect (sceNetResolverStartNtoa for www.msftconnecttest.com and www.w3.org, then libkernel connect to port 80; Kodi logs CCurlFile::Exists ... Failed: Could not connect to server(7)); with this PR merged too, no CCurlFile errors appear in the same 60 s run. This is their measurement, not mine.

Tested

Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, built and run on main c2565f014 after #4391 (the branch is one commit on it); the branch has since been moved to a newer main (git merge-tree of the head 79e162110 against main bf8dc610e is clean; not rebuilt there) with its test registration and debt entry at new places and merges with the other branches of this series without conflicts:

  • guest_socket_options (new) passes: types, SO_ACCEPTCONN before and after listen, SO_ERROR after a successful and a refused non-blocking connect (the second read is 0), the boolean bits, SO_LINGER values and errors, the length rules, unknown options and a bad descriptor.

  • It fails without the change to Udp.cpp (getsockopt of an integer option failed (errno 42)).

  • guest_udp, guest_tcp, guest_sce_net, guest_poll, guest_dup and the other socket tests: pass.

  • guest_socket_options takes about 2 seconds on Windows (4 runs, 2.07 to 2.16 s; most of it is the refused loopback connect), the other new test about 0.2 s; its wait for the connect is at most 6 s, well below the 30 s limit.

  • python tools/check_conventions.py --base upstream/main passes.

  • Measured on a combined build of the twelve open branches of this series (this PR and the others) merged onto main 0f2683cb7: guest_socket_options takes 2.58 s (ctest, serial, Windows). The full guest_* / libc / libkernel group passes (391 of 391, 0 failed; the build also contains the other branches of this series).

  • Not tested: Linux (the code compiles the Winsock and POSIX forms from one source, only the Windows one was built), a console, a title run with this change.

  • On Windows SO_ERROR is emulated for the connect error only: the library reports it once and clears it on the next connect; a later asynchronous error of the same socket without a new connect is not modelled. A null optval with a length returns EINVAL (FreeBSD: EFAULT).

Checklist

  • Merges onto main bf8dc610e without a conflict (git merge-tree, not rebuilt); no other open PR implements the same functions (overlap with #4903 described above)

  • One topic per PR; follow-ups go in a new PR

  • No comments in code except technical debt

  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (docs/dev/debt/libkernel.md)

  • No notes, investigation .md files or images added to the repository

  • New third-party code is a submodule built from source (none added)

  • Generic behaviour, not specific to one title

  • Depends on: none

  • Unblocks: PPSA99288 Nuvio Max'd, sign-in fails without it (confirmed on Linux by coltken95 in the comments; no Game bring-up discussion exists); also PPSA99420 (PS5MC, p3n1cillin's trace) and PPSA99001 ProsperoRadio with its group (screamm's trace), see above

  • AI-assisted: yes

AI-assisted (Claude Code).

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4835581180 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-12T22:11:47Z. --- ### What `getsockopt` and `setsockopt` on a libkernel socket knew four `SOL_SOCKET` options (`SO_REUSEADDR`, `SO_BROADCAST`, `SO_SNDBUF`, `SO_RCVBUF`) and failed every other one with `ENOPROTOOPT`. The options now follow FreeBSD 11.4's [`sosetopt` and `sogetopt`](https://github.com/freebsd/freebsd-src/blob/release/11.4.0/sys/kern/uipc_socket.c) (the same constants libSceNet already uses, for example `NET_SO_RCVTIMEO = 0x1006`): - `SO_ERROR` (`0x1007`) returns the socket's pending error as a FreeBSD errno and reports it once. On Windows the host does not clear it when read, so the library does. - `SO_KEEPALIVE`, `SO_DONTROUTE`, `SO_OOBINLINE` and `SO_LINGER` are read from and set on the host socket; `SO_TYPE` and `SO_ACCEPTCONN` are read only (as is `SO_ERROR`), and `setsockopt` on any of the three fails with `ENOPROTOOPT`, as FreeBSD's `sosetopt` has no case for them (they reach its default; the test does not cover this). A boolean option reads back as its own bit (FreeBSD returns `so_options & option`), `SO_LINGER` as `{SO_LINGER bit, seconds}`. - `SO_DEBUG`, `SO_USELOOPBACK`, `SO_REUSEPORT`, `SO_TIMESTAMP` and `SO_NOSIGPIPE` are left out and still fail with `ENOPROTOOPT`, as on `main`, until a title needs one (review of this PR). - Lengths follow `sooptcopyin` / `sooptcopyout`: a value is read from its first `int` and fails with `EINVAL` when shorter; a `getsockopt` buffer gets as many bytes as it holds and its own length back. `SO_SNDBUF` / `SO_RCVBUF` below 1 fail with `EINVAL`, `SO_LINGER` outside 0 to 65535 seconds with `EDOM`. - A `connect` on a non-blocking socket on Windows fails with `EINPROGRESS` (36) now; it returned `EWOULDBLOCK` (35), which a program waiting for the connection does not expect. This is the other half of what `SO_ERROR` is for, so it is in the same change. Title: The Mound (PPSA26223, EOS SDK). With a temporary trace in `socket` and `getsockopt` (not part of this PR), a Windows run (it ended after a few seconds at an unrelated GPU error, #1409) showed 6 calls `socket(2, 1, 0)` (`AF_INET`, `SOCK_STREAM`) and 2 calls `getsockopt(fd, 0xffff, 0x1007)`, `SO_ERROR`, on two different sockets; no `setsockopt` and no other option was requested. Those two calls failed with `ENOPROTOOPT` before. Stray and Harmony's Odyssey made no libkernel socket call in the same kind of run. Palworld (also EOS SDK) was not measured. A separate Linux run by coltken95 with Nuvio Max'd (PPSA99288), reported in the comments below, shows the same `SO_ERROR` failure of curl's connect check and its fix by this PR. The options other than `SO_ERROR` are not requested by any title I ran; they follow FreeBSD for completeness. Overlap: #4903 also changes `Udp.cpp` and conflicts with this branch there (reported by the overlap bot), so whichever lands second needs a small rebase. #5403 contains #4903's commit and conflicts here for that reason: both add fields to `struct Socket` at the same place (`options` here, `receiveShut` and `sendShut` there). Keeping all three fields resolves it, in either order. #4658 (accepting option values longer than an `int`) and #4391 (descriptor numbering) are merged; the routing in `SocketOptions.cpp` covers every option (the `GuestUdp` test still passes). The test registration and the TechnicalDebt entry sit at their own places in `CMakeLists.txt` and `libkernel.md` (next to `guest_udp` and the socket error numbers entry), away from the other socket PRs. Receive and send timeouts, the low-water marks and the `IPPROTO_TCP`, `IPPROTO_IP` and `IPPROTO_IPV6` levels are not part of this PR (they still fail with `ENOPROTOOPT`). #5510 (simonbronk, EPIPE for a stream send after the peer closed) conflicts with this PR in `docs/dev/debt/libkernel.md` (`git merge-tree` of the two heads, re-checked against `main` `ce5c83953`; both heads are clean against `main`); whichever lands second rebases the debt entry. #5565 (Dripl1x, `TCP_NODELAY`, `SO_NOSIGPIPE` and `SO_NBIO`) conflicts with this PR in `core/libs/prx/libkernel/Socket/src/Udp.cpp`, in the lines of `setsockopt` and `getsockopt` this PR rewrites (`git merge-tree` of the two heads, re-checked against `main` `ce5c83953`; both heads are clean against `main`); its text already says it goes after this PR, and its three options move into `SocketOptions.cpp` on the rebase. Title evidence from screamm's Windows validation on this PR (comment of 13 October, 07:46Z; head `e6740bc6`): traced on `main` in ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 and OpenSSL 3.5.2 over libkernel sockets), `connect(12, 91.98.4.78:443)` returns errno 35, `poll` then reports `POLLOUT`, and `getsockopt(12, SOL_SOCKET, SO_ERROR)` fails with errno 42, which curl's `verifyconnect()` takes as the connect error (`Could not connect to server`, curl 7); ProsperoRadio is the title that was traced, PSXS5, SwanStation and ProsperoTV bundle the same libcurl. With this PR the same trace shows errno 36 and `SO_ERROR` 0, and the TCP connection succeeds; the next failure there is OpenSSL's CA file path (a separate gap, issue #5001). The trace is screamm's, not run by me. More title evidence, from p3n1cillin's comment on this PR (13 October, 14:48Z): PS5MC (PPSA99420, Kodi 22) on `main` `3faa9cb40` merged with other open PRs it needs to start. Without this PR Kodi's connectivity check fails about 10 ms after each `connect` (`sceNetResolverStartNtoa` for `www.msftconnecttest.com` and `www.w3.org`, then libkernel `connect` to port 80; Kodi logs `CCurlFile::Exists ... Failed: Could not connect to server(7)`); with this PR merged too, no `CCurlFile` errors appear in the same 60 s run. This is their measurement, not mine. ### Tested Windows 10 (19045), MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, built and run on `main` `c2565f014` after #4391 (the branch is one commit on it); the branch has since been moved to a newer `main` (`git merge-tree` of the head `79e162110` against `main` `bf8dc610e` is clean; not rebuilt there) with its test registration and debt entry at new places and merges with the other branches of this series without conflicts: - `guest_socket_options` (new) passes: types, `SO_ACCEPTCONN` before and after `listen`, `SO_ERROR` after a successful and a refused non-blocking connect (the second read is 0), the boolean bits, `SO_LINGER` values and errors, the length rules, unknown options and a bad descriptor. - It fails without the change to `Udp.cpp` (`getsockopt of an integer option failed (errno 42)`). - `guest_udp`, `guest_tcp`, `guest_sce_net`, `guest_poll`, `guest_dup` and the other socket tests: pass. - `guest_socket_options` takes about 2 seconds on Windows (4 runs, 2.07 to 2.16 s; most of it is the refused loopback connect), the other new test about 0.2 s; its wait for the connect is at most 6 s, well below the 30 s limit. - `python tools/check_conventions.py --base upstream/main` passes. - Measured on a combined build of the twelve open branches of this series (this PR and the others) merged onto `main` `0f2683cb7`: `guest_socket_options` takes 2.58 s (ctest, serial, Windows). The full `guest_*` / libc / libkernel group passes (391 of 391, 0 failed; the build also contains the other branches of this series). - Not tested: Linux (the code compiles the Winsock and POSIX forms from one source, only the Windows one was built), a console, a title run with this change. - On Windows `SO_ERROR` is emulated for the connect error only: the library reports it once and clears it on the next `connect`; a later asynchronous error of the same socket without a new `connect` is not modelled. A null `optval` with a length returns `EINVAL` (FreeBSD: `EFAULT`). ### Checklist - [x] Merges onto `main` `bf8dc610e` without a conflict (`git merge-tree`, not rebuilt); no other open PR implements the same functions (overlap with #4903 described above) - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in TechnicalDebt (`docs/dev/debt/libkernel.md`) - [x] No notes, investigation `.md` files or images added to the repository - [x] New third-party code is a submodule built from source (none added) - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Unblocks: PPSA99288 Nuvio Max'd, sign-in fails without it (confirmed on Linux by coltken95 in the comments; no Game bring-up discussion exists); also PPSA99420 (PS5MC, p3n1cillin's trace) and PPSA99001 ProsperoRadio with its group (screamm's trace), see above - [x] AI-assisted: yes AI-assisted (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
coltken95 commented 2026-10-13 00:15:44 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T00:15:44Z.


Tested on Linux (CachyOS, RTX 2070, NVIDIA 615.71.09) with Nuvio Max'd (PPSA99288): main at e6ecece94 with this PR and #3644 merged on top.

Without this PR, every HTTPS request fails: curl's getsockopt(SOL_SOCKET, SO_ERROR) after a nonblocking connect gets ENOPROTOOPT, so the sign-in screen shows "Failed to connect to api.nuvio.tv port 443 after 45 ms". strace shows the host connect returning EINPROGRESS and no host getsockopt following it. With this PR, the connection completes and the sign-in screen receives its link code from api.nuvio.tv. guest_socket_options passes.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6135125507 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6135125507). Originally posted by [coltken95](https://github.com/coltken95) on 2026-10-13T00:15:44Z. --- Tested on Linux (CachyOS, RTX 2070, NVIDIA 615.71.09) with Nuvio Max'd (PPSA99288): `main` at e6ecece94 with this PR and #3644 merged on top. Without this PR, every HTTPS request fails: curl's `getsockopt(SOL_SOCKET, SO_ERROR)` after a nonblocking `connect` gets `ENOPROTOOPT`, so the sign-in screen shows "Failed to connect to api.nuvio.tv port 443 after 45 ms". `strace` shows the host `connect` returning `EINPROGRESS` and no host `getsockopt` following it. With this PR, the connection completes and the sign-in screen receives its link code from api.nuvio.tv. `guest_socket_options` passes. AI-assisted: yes
xXPBSXx commented 2026-10-13 02:37:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T02:37:13Z.


Thanks for testing this, that is a useful confirmation.

One question, only if it is easy for you: could you share which setsockopt calls the Nuvio run makes on the host (for example strace -f -e trace=setsockopt during sign-in, levels and option names only)? curl normally sets TCP_NODELAY and the TCP keep-alive options and ignores a failure; a follow-up PR for the IPPROTO_TCP level (not part of this one) only makes sense if a title actually asks for them.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136973633 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6136973633). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T02:37:13Z. --- Thanks for testing this, that is a useful confirmation. One question, only if it is easy for you: could you share which `setsockopt` calls the Nuvio run makes on the host (for example `strace -f -e trace=setsockopt` during sign-in, levels and option names only)? curl normally sets `TCP_NODELAY` and the TCP keep-alive options and ignores a failure; a follow-up PR for the `IPPROTO_TCP` level (not part of this one) only makes sense if a title actually asks for them. AI-assisted (Claude Code).
oneandonlydean commented 2026-10-13 02:45:25 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T02:45:25Z.


SO_DEBUG, SO_USELOOPBACK, SO_REUSEPORT, SO_TIMESTAMP and SO_NOSIGPIPE are accepted and only kept by the library (SocketOptions.cpp:66-77). The description says no title sets them, and a title that sets SO_REUSEPORT or SO_TIMESTAMP would get success without the behaviour. Please leave those five out (ENOPROTOOPT, as on main) until a title needs one.

The SO_ERROR and EINPROGRESS part, with The Mound and PPSA99288, is fine as it is.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137066497 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6137066497). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T02:45:25Z. --- `SO_DEBUG`, `SO_USELOOPBACK`, `SO_REUSEPORT`, `SO_TIMESTAMP` and `SO_NOSIGPIPE` are accepted and only kept by the library (`SocketOptions.cpp:66-77`). The description says no title sets them, and a title that sets `SO_REUSEPORT` or `SO_TIMESTAMP` would get success without the behaviour. Please leave those five out (`ENOPROTOOPT`, as on main) until a title needs one. The `SO_ERROR` and `EINPROGRESS` part, with The Mound and PPSA99288, is fine as it is.
xXPBSXx commented 2026-10-13 03:02:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T03:02:43Z.


Updated as requested: SO_DEBUG, SO_USELOOPBACK, SO_REUSEPORT, SO_TIMESTAMP and SO_NOSIGPIPE are left out again (ENOPROTOOPT, as on main), the test checks that, and the stored-only state is gone. The branch is one commit on main c13dc7e6b; guest_socket_options (still fails without the Udp.cpp change) and the other socket tests pass on Windows (22 of 22).

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137257331 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6137257331). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T03:02:43Z. --- Updated as requested: `SO_DEBUG`, `SO_USELOOPBACK`, `SO_REUSEPORT`, `SO_TIMESTAMP` and `SO_NOSIGPIPE` are left out again (`ENOPROTOOPT`, as on `main`), the test checks that, and the stored-only state is gone. The branch is one commit on `main` `c13dc7e6b`; `guest_socket_options` (still fails without the `Udp.cpp` change) and the other socket tests pass on Windows (22 of 22). AI-assisted (Claude Code).
screamm commented 2026-10-13 07:46:47 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by screamm on 2026-10-13T07:46:47Z.


Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, BUILD_TESTING=ON; head e6740bc6 on main c2565f01, with #4525 applied as well because curl polls POLLOUT|POLLPRI): the 17 socket/poll/net tests including the new guest_socket_options pass 3/3; the non-GPU suite passes apart from the GPU-only agc_* targets I did not build; conventions clean.

This PR is what makes HTTPS work from inside the guest. Traced on main in ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 + OpenSSL 3.5.2 over libkernel sockets): connect(12, 91.98.4.78:443) = -1 errno 35, poll then reports POLLOUT, and getsockopt(12, SOL_SOCKET, SO_ERROR) = -1 errno 42 (ENOPROTOOPT), which curl's verifyconnect() takes as the connect error, hence Failed to connect to all.api.radio-browser.info port 443 after 51 ms: Could not connect to server (curl 7) in every title of this group (PSXS5, SwanStation, ProsperoTV, ProsperoRadio). With this PR: connect = -1 errno 36, getsockopt(SO_ERROR) = 0 value 0, the TCP connection succeeds, and the next failure is OpenSSL's CA path /<sandbox word>/common/cert/CA_LIST.cer (curl 77, a separate gap I'm filing). With a PEM bundle placed at that path for the test, ProsperoRadio downloads its catalog (11838693 bytes in 845 ms, accepted=9556, six pages) and SwanStation (PPSA98510) goes from gamedb.yaml -> curl 7, http 0 to gamedb: index written. Smaller mismatches curl tolerates, for later: fcntl(F_SETFD) on a socket returns EINVAL, and setsockopt TCP_NODELAY, SO_NOSIGPIPE and option 0x1200 return ENOPROTOOPT.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140849638 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6140849638). Originally posted by [screamm](https://github.com/screamm) on 2026-10-13T07:46:47Z. --- Windows validation with title evidence (Windows 11 Pro 26220, WinLibs MinGW-w64 GCC 15.2.0 r7, Release, `BUILD_TESTING=ON`; head `e6740bc6` on `main` `c2565f01`, with #4525 applied as well because curl polls `POLLOUT|POLLPRI`): the 17 socket/poll/net tests including the new `guest_socket_options` pass 3/3; the non-GPU suite passes apart from the GPU-only `agc_*` targets I did not build; conventions clean. This PR is what makes HTTPS work from inside the guest. Traced on `main` in ProsperoRadio (PPSA99001, bundled libcurl 8.18.0 + OpenSSL 3.5.2 over libkernel sockets): `connect(12, 91.98.4.78:443) = -1 errno 35`, `poll` then reports `POLLOUT`, and `getsockopt(12, SOL_SOCKET, SO_ERROR) = -1 errno 42` (`ENOPROTOOPT`), which curl's `verifyconnect()` takes as the connect error, hence `Failed to connect to all.api.radio-browser.info port 443 after 51 ms: Could not connect to server` (curl 7) in every title of this group (PSXS5, SwanStation, ProsperoTV, ProsperoRadio). With this PR: `connect = -1 errno 36`, `getsockopt(SO_ERROR) = 0 value 0`, the TCP connection succeeds, and the next failure is OpenSSL's CA path `/<sandbox word>/common/cert/CA_LIST.cer` (curl 77, a separate gap I'm filing). With a PEM bundle placed at that path for the test, ProsperoRadio downloads its catalog (`11838693 bytes in 845 ms`, `accepted=9556`, six pages) and SwanStation (PPSA98510) goes from `gamedb.yaml -> curl 7, http 0` to `gamedb: index written`. Smaller mismatches curl tolerates, for later: `fcntl(F_SETFD)` on a socket returns `EINVAL`, and `setsockopt` `TCP_NODELAY`, `SO_NOSIGPIPE` and option 0x1200 return `ENOPROTOOPT`.
p3n1cillin commented 2026-10-13 14:48:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by p3n1cillin on 2026-10-13T14:48:34Z.


Title evidence for this PR: PS5MC (PPSA99420, Kodi 22, catalog release) on Windows 11, MinGW GCC 15.2.0, Release, on main 3faa9cb40 merged with the open PRs it needs to start (#4379, #4374, #4383, #5183, #5184, #5185, #5186).

  • Without this PR, Kodi's connectivity check fails about 10 ms after each connect: gdb shows sceNetResolverStartNtoa resolving www.msftconnecttest.com and www.w3.org (2.21.64.155 and 104.18.23.19), then libkernel connect to port 80, and Kodi logs CCurlFile::Exists - <http://www.w3.org/> Failed: Could not connect to server(7) (the same for msftconnecttest.com). That is curl reading the non-blocking connect's result through getsockopt(SO_ERROR).
  • With this PR merged too, the checks no longer fail: no CCurlFile errors in the same 60 s run.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6148270588 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6148270588). Originally posted by [p3n1cillin](https://github.com/p3n1cillin) on 2026-10-13T14:48:34Z. --- Title evidence for this PR: PS5MC (PPSA99420, Kodi 22, catalog release) on Windows 11, MinGW GCC 15.2.0, Release, on `main` `3faa9cb40` merged with the open PRs it needs to start (#4379, #4374, #4383, #5183, #5184, #5185, #5186). - Without this PR, Kodi's connectivity check fails about 10 ms after each `connect`: gdb shows `sceNetResolverStartNtoa` resolving `www.msftconnecttest.com` and `www.w3.org` (2.21.64.155 and 104.18.23.19), then libkernel `connect` to port 80, and Kodi logs `CCurlFile::Exists - <http://www.w3.org/> Failed: Could not connect to server(7)` (the same for `msftconnecttest.com`). That is curl reading the non-blocking connect's result through `getsockopt(SO_ERROR)`. - With this PR merged too, the checks no longer fail: no `CCurlFile` errors in the same 60 s run. AI-assisted (Claude Code).
coltken95 commented 2026-10-13 15:50:13 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-13T15:50:13Z.


Still needed on main 842766d39: without this PR Nuvio Max'd (PPSA99288) shows "Failed to connect to v3-cinemeta.strem.io port 443" (tested on main 0f2683cb7, CachyOS, RTX 2070). With d748c659e (this PR cherry-picked onto 842766d39) the addons and all 8 home catalogs load. The cherry-pick applies cleanly.

AI-assisted: yes (Claude Code)

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6149500439 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6149500439). Originally posted by [coltken95](https://github.com/coltken95) on 2026-10-13T15:50:13Z. --- Still needed on main 842766d39: without this PR Nuvio Max'd (PPSA99288) shows "Failed to connect to v3-cinemeta.strem.io port 443" (tested on main 0f2683cb7, CachyOS, RTX 2070). With d748c659e (this PR cherry-picked onto 842766d39) the addons and all 8 home catalogs load. The cherry-pick applies cleanly. AI-assisted: yes (Claude Code)
xXPBSXx commented 2026-10-13 21:18:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by xXPBSXx on 2026-10-13T21:18:23Z.


Thank you for the validations and title traces, @screamm, @p3n1cillin and @coltken95. They are quoted in the description (ProsperoRadio and its group, PS5MC, Nuvio Max'd).

On the mismatches mentioned in the comments: fcntl(F_SETFD) on a socket is #5020. TCP_NODELAY, SO_NOSIGPIPE and option 0x1200 are not part of this PR; the maintainer's comment above asks to leave options out until a title needs them, and screamm's ProsperoRadio trace is the evidence for those three, so they would be a separate change if wanted.

@coltken95, my earlier question about which setsockopt calls the Nuvio run makes still stands; screamm's list is from ProsperoRadio, not from Nuvio. It is not needed for this PR.

AI-assisted (Claude Code).

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155397533 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/4796#issuecomment-6155397533). Originally posted by [xXPBSXx](https://github.com/xXPBSXx) on 2026-10-13T21:18:23Z. --- Thank you for the validations and title traces, @screamm, @p3n1cillin and @coltken95. They are quoted in the description (ProsperoRadio and its group, PS5MC, Nuvio Max'd). On the mismatches mentioned in the comments: `fcntl(F_SETFD)` on a socket is #5020. `TCP_NODELAY`, `SO_NOSIGPIPE` and option 0x1200 are not part of this PR; the maintainer's comment above asks to leave options out until a title needs them, and screamm's ProsperoRadio trace is the evidence for those three, so they would be a separate change if wanted. @coltken95, my earlier question about which `setsockopt` calls the Nuvio run makes still stands; screamm's list is from ProsperoRadio, not from Nuvio. It is not needed for this PR. AI-assisted (Claude Code).
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!4796
No description provided.