fix(libSceNet): fill the address and port fields in sceNetGetSockInfo #7959

Merged
Lindamea1 merged 1 commit from upstream-pr/7959 into main 2026-10-20 07:07:23 +00:00
Lindamea1 commented 2026-10-19 16:06:23 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Lindamea1 on 2026-10-19T16:06:23Z.


What

On main, sceNetGetSockInfo(s, info, n, flags) returns 0 for any socket in the library's table and writes nothing to info; only an unknown s fails, with 0x80410109 (EBADF). It was not listed under Silent stubs either. A probe that fills the record with 0xAA before the call prints, against main:

udp after bind(127.0.0.1:0): sceNetGetSockInfo(s=6, info, 1, 0)=0  info.s=0xaaaaaaaa local_adr=aaaaaaaa local_port=0xaaaa remote_adr=aaaaaaaa remote_port=0xaaaa  (getsockname port 44814)

and the same for a connected TCP client and the socket sceNetAccept returned.

Monster Hunter Wilds (PPSA24191, v01.041.040) reads these fields. In its relinked executable, the socket class calls sceNetGetSockInfo(s, &info, 1, 0) on an uninitialised 0xA0-byte stack buffer at 0xedd5f9b, 0xedd6296 and 0xedd63e2, after sceNetConnect (0xedd5f65), sceNetBind (0xedd6273) and sceNetAccept (0xedd63b7). It stores info+0x34 and sceNetNtohs(info+0x3c) as the socket's local address and port, and after the accept also info+0x38 and sceNetNtohs(info+0x3e) as the peer's. It checks only the sign of the result. This is from the disassembly (the PLT slots resolve to the NIDs of sceNetGetSockInfo, sceNetNtohs, sceNetConnect, sceNetBind and sceNetAccept); I have not seen these calls in a run.

SharpProspero and shadPS4 give the same 0xA0-byte layout: s at 0x24, socket_type at 0x28, local_adr and remote_adr at 0x34 and 0x38, local_port and remote_port at 0x3c and 0x3e, flags at 0x48, and recv_buffer_size and send_buffer_size at 0x64 and 0x68. shadPS4 marks the ports as network byte order (net_types.h#L302), and the title passes them through sceNetNtohs. Both give the status flags SELF as 0x1 and NONBLOCK as 0x200000 (Socket.cs#L665-L687, net_types.h#L278-L288). SharpProspero documents the result as the number of records written (Socket.cs#L802-L808). shadPS4 fills one record from the host socket's name and peer, SELF plus NONBLOCK for a non-blocking socket, and the buffer sizes set on the socket (net.cpp#L428-L492). Its sceNetGetSockInfo returns 1 for one socket, EINVAL for a null info (the socket count when s is below 0) or an n of 0 or less, and lists every socket for an s below 0. SharpProspero also names two request flags (Socket.cs#L701-L705): SockInfoTimeWait (0x40), "also list sockets in the TIME_WAIT state", and, for sceNetGetSockInfo6, SockInfo6Ipv46 (0x1000), "report both IPv4 and IPv6 sockets".

sceNetGetSockInfo now writes one record for an IPv4 socket and returns 1. The record holds s, socket_type, the local address and port from the host socket's getsockname and the remote ones from getpeername (0 while it has no peer) in network byte order, flags with SELF and, when SO_NBIO is set, NONBLOCK, and the receive and send buffer sizes sceNetGetsockopt returns for SO_RCVBUF and SO_SNDBUF: the size set on the socket, else the host socket's. Every other field is 0. A null info or an n below 1 fails with 0x80410116 (EINVAL), and an unknown socket still fails with EBADF.

An s below 0 lists the library's sockets as shadPS4 does: with a null info the call returns their number, otherwise it writes their records in socket-number order until n are written and returns how many it wrote. A socket closed during the call is skipped. Two answers differ from shadPS4. An IPv6 socket fails with 0x8041012f (EAFNOSUPPORT), since the record has room only for an IPv4 address, and is left out of the count and the list; shadPS4 lists it with the addresses and ports 0 and returns 1 for it alone. SockInfo6Ipv46 suggests that IPv6 sockets are listed by sceNetGetSockInfo6. And a flags bit other than 0x40 fails with EINVAL, where shadPS4 ignores flags. 0x40 is accepted and lists the same sockets: a closed socket leaves the library's table at once, so none is kept in TIME_WAIT.

The name, pid, policy, priority, queue lengths, virtual ports, state, bandwidth, and drop and wait counts are 0, and no status flag other than SELF and NONBLOCK is set. shadPS4 also fills the name, policy, priority and state (and, on its current main, the receive queue length), and falls back to its DefaultSendBuffer and DefaultReceiveBuffer where no size was set; here a socket without a set size reports the host's, as sceNetGetsockopt already does. The new entry in docs/dev/debt/libSceNet.md lists these and the IPv6 and flags handling. Not measured on a console.

Tested

Gentoo Linux, kernel 7.2.8, GCC 16.2.1, glibc 2.43, Release, BUILD_TESTING=ON, on main 1ed63f63c.

  • guest_sce_net with the new CheckSockInfo: for an unbound UDP socket, the same socket bound to 127.0.0.1:0 and later connected, a listening TCP socket, a connected TCP client and the accepted socket, sceNetGetSockInfo(s, buffer, 2, 0) returns 1 and leaves the second record as it was. The first 0xA0 bytes equal a record built from sceNetGetsockname, sceNetGetpeername and sceNetGetsockopt: s at 0x24, the type at 0x28, the addresses at 0x34 and 0x38, the ports at 0x3c and 0x3e, flags 0x1 at 0x48, the SO_RCVBUF and SO_SNDBUF sizes (above 0) at 0x64 and 0x68, and every other byte 0. After SO_NBIO 1, SO_RCVBUF 65536 and SO_SNDBUF 32768 on the UDP socket, flags is 0x200001 and the sizes are 65536 and 32768. A null info and an n of 0 fail with errno 22, and so does an n of 0 with s -1; flags 1, 0x41 and 0x1000 fail with errno 22, for one socket and for the count; an IPv6 socket fails with errno 47 (where the host has no IPv6, creating the socket fails with 47 instead); none of these writes the buffer. With flags 0x40 the UDP socket's record is the same. A closed socket fails with errno 9.

  • The new RequireSockInfoList reads the count (s -1, null info), lists one record more than that and checks that the call returns the count and leaves the extra record as it was, that the sockets come in increasing order, that each record equals the one sceNetGetSockInfo returns for that socket alone, and that n 1 writes only the first. With the four IPv4 sockets and the IPv6 one open, the list for flags 0 and for 0x40 is the sockets open before the check plus the four IPv4 ones; after they are closed it is the sockets open before. The test passed 20 runs in a row, about 1.2 s each.

  • With only Export.cpp taken from main, the test aborts in RequireSockInfoList (gdb backtrace): its first call expects the count where main fails s -1 with EBADF. With Export.cpp from this PR's previous revision, the first listing throws runtime_error (listing all sockets (s < 0) is not supported) and the test terminates.

  • The probe above against this branch prints sceNetGetSockInfo(s=6, info, 1, 0)=1 info.s=0x6 local_adr=0100007f local_port=0x8eac remote_adr=00000000 remote_port=000000 (getsockname port 44174): 127.0.0.1 and port 44174, both in network byte order. For the TCP pair, the accepted socket's remote port is the client's local port and the other way round. A second probe prints flags=0x1 recv_buffer_size=212992 send_buffer_size=212992 for a new UDP socket, the sizes sceNetGetsockopt returns for it, and flags=0x200001 recv_buffer_size=65536 send_buffer_size=32768 after SO_NBIO 1, SO_RCVBUF 65536 and SO_SNDBUF 32768. Against main the call returns 0 and these fields keep the 0xAA fill.

  • A third probe opens a UDP socket bound to 127.0.0.1 and made non-blocking (6), a listening TCP socket (8), a connected client (10), the accepted socket (12) and an IPv6 UDP socket (14). It prints the ports in host order:

    count: sceNetGetSockInfo(-1, NULL, 0, 0) = 0x4  errno=0
    list, n=8: sceNetGetSockInfo(-1, info, 8, 0) = 0x4  errno=0
        s=6 type=2 local=0100007f:42669 remote=00000000:0 flags=0x200001
        s=8 type=1 local=0100007f:40179 remote=00000000:0 flags=0x1
        s=10 type=1 local=0100007f:35604 remote=0100007f:40179 flags=0x1
        s=12 type=1 local=0100007f:40179 remote=0100007f:35604 flags=0x1
    list, n=2: sceNetGetSockInfo(-1, info, 2, 0) = 0x2  errno=0
    list, flags 0x40: sceNetGetSockInfo(-1, info, 8, 0x40) = 0x4  errno=0
    flags 1: sceNetGetSockInfo(6, info, 1, 0x1) = 0x80410116  errno=22
    IPv6 socket: sceNetGetSockInfo(14, info, 1, 0) = 0x8041012f  errno=47
    list after closing the client: sceNetGetSockInfo(-1, info, 8, 0) = 0x3  errno=0
    

    The two-record list holds sockets 6 and 8, the 0x40 list the same four records as the first, and the last list sockets 6, 8 and 12.

  • Tests selected by tools/select_tests.py for this diff (227 of 1672): 227 passed, 0 failed, 0 skipped.

  • tools/check_compile.py: the 2 changed translation units compile.

  • Windows: Export.cpp and GuestSceNet.cpp compile with x86_64-w64-mingw32-g++ 16.2.0 (-fsyntax-only -Wall -Wextra) without warnings, as on main. This is a syntax check, not a Windows build or run.

  • tools/check_conventions.py passes against main.

  • tools/pr_overlap.py --branch reports no overlapping lines. It could not compare #5836, #6044, #7201, #7332 and #8106, which conflict with main; merged with this branch, each conflicts in the same files, with as many conflict hunks, as with main.

Not run on Windows, macOS or a console.

Checklist

  • Based on current main; no other open PR implements the same functions
  • 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 under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4923831111 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7959). Originally posted by [Lindamea1](https://github.com/Lindamea1) on 2026-10-19T16:06:23Z. --- ### What On `main`, `sceNetGetSockInfo(s, info, n, flags)` returns 0 for any socket in the library's table and writes nothing to `info`; only an unknown `s` fails, with `0x80410109` (`EBADF`). It was not listed under Silent stubs either. A probe that fills the record with `0xAA` before the call prints, against `main`: ``` udp after bind(127.0.0.1:0): sceNetGetSockInfo(s=6, info, 1, 0)=0 info.s=0xaaaaaaaa local_adr=aaaaaaaa local_port=0xaaaa remote_adr=aaaaaaaa remote_port=0xaaaa (getsockname port 44814) ``` and the same for a connected TCP client and the socket `sceNetAccept` returned. Monster Hunter Wilds (PPSA24191, v01.041.040) reads these fields. In its relinked executable, the socket class calls `sceNetGetSockInfo(s, &info, 1, 0)` on an uninitialised 0xA0-byte stack buffer at `0xedd5f9b`, `0xedd6296` and `0xedd63e2`, after `sceNetConnect` (`0xedd5f65`), `sceNetBind` (`0xedd6273`) and `sceNetAccept` (`0xedd63b7`). It stores `info+0x34` and `sceNetNtohs(info+0x3c)` as the socket's local address and port, and after the accept also `info+0x38` and `sceNetNtohs(info+0x3e)` as the peer's. It checks only the sign of the result. This is from the disassembly (the PLT slots resolve to the NIDs of `sceNetGetSockInfo`, `sceNetNtohs`, `sceNetConnect`, `sceNetBind` and `sceNetAccept`); I have not seen these calls in a run. [SharpProspero](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/Socket.cs#L157-L247) and [shadPS4](https://github.com/shadps4-emu/shadPS4/blob/06e813ff8c8e2a6d81b02cabfcc9543c3debf78e/src/core/libraries/net/net_types.h#L290-L321) give the same 0xA0-byte layout: `s` at 0x24, `socket_type` at 0x28, `local_adr` and `remote_adr` at 0x34 and 0x38, `local_port` and `remote_port` at 0x3c and 0x3e, `flags` at 0x48, and `recv_buffer_size` and `send_buffer_size` at 0x64 and 0x68. shadPS4 marks the ports as network byte order ([net_types.h#L302](https://github.com/shadps4-emu/shadPS4/blob/06e813ff8c8e2a6d81b02cabfcc9543c3debf78e/src/core/libraries/net/net_types.h#L302)), and the title passes them through `sceNetNtohs`. Both give the status flags `SELF` as 0x1 and `NONBLOCK` as 0x200000 ([Socket.cs#L665-L687](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/Socket.cs#L665-L687), [net_types.h#L278-L288](https://github.com/shadps4-emu/shadPS4/blob/06e813ff8c8e2a6d81b02cabfcc9543c3debf78e/src/core/libraries/net/net_types.h#L278-L288)). SharpProspero documents the result as the number of records written ([Socket.cs#L802-L808](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/Socket.cs#L802-L808)). shadPS4 fills one record from the host socket's name and peer, `SELF` plus `NONBLOCK` for a non-blocking socket, and the buffer sizes set on the socket ([net.cpp#L428-L492](https://github.com/shadps4-emu/shadPS4/blob/06e813ff8c8e2a6d81b02cabfcc9543c3debf78e/src/core/libraries/net/net.cpp#L428-L492)). Its [`sceNetGetSockInfo`](https://github.com/shadps4-emu/shadPS4/blob/06e813ff8c8e2a6d81b02cabfcc9543c3debf78e/src/core/libraries/net/net.cpp#L1498-L1522) returns 1 for one socket, `EINVAL` for a null `info` (the socket count when `s` is below 0) or an `n` of 0 or less, and lists every socket for an `s` below 0. SharpProspero also names two request flags ([Socket.cs#L701-L705](https://github.com/SvenGDK/SharpProspero/blob/5dfdb4b0b166e83dc9ae275001afb695f12c7174/src/SharpProspero/Interop/Net/Socket.cs#L701-L705)): `SockInfoTimeWait` (0x40), "also list sockets in the TIME_WAIT state", and, for `sceNetGetSockInfo6`, `SockInfo6Ipv46` (0x1000), "report both IPv4 and IPv6 sockets". `sceNetGetSockInfo` now writes one record for an IPv4 socket and returns 1. The record holds `s`, `socket_type`, the local address and port from the host socket's `getsockname` and the remote ones from `getpeername` (0 while it has no peer) in network byte order, `flags` with `SELF` and, when `SO_NBIO` is set, `NONBLOCK`, and the receive and send buffer sizes `sceNetGetsockopt` returns for `SO_RCVBUF` and `SO_SNDBUF`: the size set on the socket, else the host socket's. Every other field is 0. A null `info` or an `n` below 1 fails with `0x80410116` (`EINVAL`), and an unknown socket still fails with `EBADF`. An `s` below 0 lists the library's sockets as shadPS4 does: with a null `info` the call returns their number, otherwise it writes their records in socket-number order until `n` are written and returns how many it wrote. A socket closed during the call is skipped. Two answers differ from shadPS4. An IPv6 socket fails with `0x8041012f` (`EAFNOSUPPORT`), since the record has room only for an IPv4 address, and is left out of the count and the list; shadPS4 lists it with the addresses and ports 0 and returns 1 for it alone. `SockInfo6Ipv46` suggests that IPv6 sockets are listed by `sceNetGetSockInfo6`. And a `flags` bit other than 0x40 fails with `EINVAL`, where shadPS4 ignores `flags`. 0x40 is accepted and lists the same sockets: a closed socket leaves the library's table at once, so none is kept in TIME_WAIT. The name, pid, policy, priority, queue lengths, virtual ports, state, bandwidth, and drop and wait counts are 0, and no status flag other than `SELF` and `NONBLOCK` is set. shadPS4 also fills the name, policy, priority and state (and, on its current `main`, the receive queue length), and falls back to its `DefaultSendBuffer` and `DefaultReceiveBuffer` where no size was set; here a socket without a set size reports the host's, as `sceNetGetsockopt` already does. The new entry in `docs/dev/debt/libSceNet.md` lists these and the IPv6 and `flags` handling. Not measured on a console. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Gentoo Linux, kernel 7.2.8, GCC 16.2.1, glibc 2.43, Release, `BUILD_TESTING=ON`, on `main` 1ed63f63c. - `guest_sce_net` with the new `CheckSockInfo`: for an unbound UDP socket, the same socket bound to 127.0.0.1:0 and later connected, a listening TCP socket, a connected TCP client and the accepted socket, `sceNetGetSockInfo(s, buffer, 2, 0)` returns 1 and leaves the second record as it was. The first 0xA0 bytes equal a record built from `sceNetGetsockname`, `sceNetGetpeername` and `sceNetGetsockopt`: `s` at 0x24, the type at 0x28, the addresses at 0x34 and 0x38, the ports at 0x3c and 0x3e, `flags` 0x1 at 0x48, the `SO_RCVBUF` and `SO_SNDBUF` sizes (above 0) at 0x64 and 0x68, and every other byte 0. After `SO_NBIO` 1, `SO_RCVBUF` 65536 and `SO_SNDBUF` 32768 on the UDP socket, `flags` is 0x200001 and the sizes are 65536 and 32768. A null `info` and an `n` of 0 fail with errno 22, and so does an `n` of 0 with `s` -1; `flags` 1, 0x41 and 0x1000 fail with errno 22, for one socket and for the count; an IPv6 socket fails with errno 47 (where the host has no IPv6, creating the socket fails with 47 instead); none of these writes the buffer. With `flags` 0x40 the UDP socket's record is the same. A closed socket fails with errno 9. - The new `RequireSockInfoList` reads the count (`s` -1, null `info`), lists one record more than that and checks that the call returns the count and leaves the extra record as it was, that the sockets come in increasing order, that each record equals the one `sceNetGetSockInfo` returns for that socket alone, and that `n` 1 writes only the first. With the four IPv4 sockets and the IPv6 one open, the list for `flags` 0 and for 0x40 is the sockets open before the check plus the four IPv4 ones; after they are closed it is the sockets open before. The test passed 20 runs in a row, about 1.2 s each. - With only `Export.cpp` taken from `main`, the test aborts in `RequireSockInfoList` (gdb backtrace): its first call expects the count where `main` fails `s` -1 with `EBADF`. With `Export.cpp` from this PR's previous revision, the first listing throws `runtime_error` (`listing all sockets (s < 0) is not supported`) and the test terminates. - The probe above against this branch prints `sceNetGetSockInfo(s=6, info, 1, 0)=1 info.s=0x6 local_adr=0100007f local_port=0x8eac remote_adr=00000000 remote_port=000000 (getsockname port 44174)`: 127.0.0.1 and port 44174, both in network byte order. For the TCP pair, the accepted socket's remote port is the client's local port and the other way round. A second probe prints `flags=0x1 recv_buffer_size=212992 send_buffer_size=212992` for a new UDP socket, the sizes `sceNetGetsockopt` returns for it, and `flags=0x200001 recv_buffer_size=65536 send_buffer_size=32768` after `SO_NBIO` 1, `SO_RCVBUF` 65536 and `SO_SNDBUF` 32768. Against `main` the call returns 0 and these fields keep the `0xAA` fill. - A third probe opens a UDP socket bound to 127.0.0.1 and made non-blocking (6), a listening TCP socket (8), a connected client (10), the accepted socket (12) and an IPv6 UDP socket (14). It prints the ports in host order: ``` count: sceNetGetSockInfo(-1, NULL, 0, 0) = 0x4 errno=0 list, n=8: sceNetGetSockInfo(-1, info, 8, 0) = 0x4 errno=0 s=6 type=2 local=0100007f:42669 remote=00000000:0 flags=0x200001 s=8 type=1 local=0100007f:40179 remote=00000000:0 flags=0x1 s=10 type=1 local=0100007f:35604 remote=0100007f:40179 flags=0x1 s=12 type=1 local=0100007f:40179 remote=0100007f:35604 flags=0x1 list, n=2: sceNetGetSockInfo(-1, info, 2, 0) = 0x2 errno=0 list, flags 0x40: sceNetGetSockInfo(-1, info, 8, 0x40) = 0x4 errno=0 flags 1: sceNetGetSockInfo(6, info, 1, 0x1) = 0x80410116 errno=22 IPv6 socket: sceNetGetSockInfo(14, info, 1, 0) = 0x8041012f errno=47 list after closing the client: sceNetGetSockInfo(-1, info, 8, 0) = 0x3 errno=0 ``` The two-record list holds sockets 6 and 8, the 0x40 list the same four records as the first, and the last list sockets 6, 8 and 12. - Tests selected by `tools/select_tests.py` for this diff (227 of 1672): 227 passed, 0 failed, 0 skipped. - `tools/check_compile.py`: the 2 changed translation units compile. - Windows: `Export.cpp` and `GuestSceNet.cpp` compile with `x86_64-w64-mingw32-g++` 16.2.0 (`-fsyntax-only -Wall -Wextra`) without warnings, as on `main`. This is a syntax check, not a Windows build or run. - `tools/check_conventions.py` passes against `main`. - `tools/pr_overlap.py --branch` reports no overlapping lines. It could not compare #5836, #6044, #7201, #7332 and #8106, which conflict with `main`; merged with this branch, each conflicts in the same files, with as many conflict hunks, as with `main`. Not run on Windows, macOS or a console. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none <!-- #PR, or none --> - [x] Fixes: none <!-- issue it closes as Fixes #N, or none --> - [x] Unblocks: none <!-- title ID and Game bring-up discussion, e.g. PPSA01325 #3232, or none --> - [x] GPUs tested: n/a <!-- for AGC, shader recompiler or VideoOut changes: vendor, model, driver and OS of each GPU the GPU tests ran on; otherwise n/a --> - [x] AI-assisted: yes <!-- yes / no --> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-actions[bot] commented 2026-10-19 16:25:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T16:25:57Z.


Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 5836 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
docs/dev/debt/libSceNet.md
PR 6044 core/libs/tests/GuestSceNet.cpp
PR 7201 core/libs/prx/libSceNet/Export.cpp
PR 7332 core/libs/prx/libSceNet/Export.cpp
core/libs/tests/GuestSceNet.cpp
PR 8106 core/libs/prx/libSceNet/Export.cpp
docs/dev/debt/libSceNet.md
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6271967756 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7959#issuecomment-6271967756). Originally posted by [github-actions[bot]](https://github.com/apps/github-actions) on 2026-10-19T16:25:57Z. --- <!-- pr-overlap --> Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap. | Pull request | Shared files not compared | |---|---| | [PR 5836](https://www.github.com/boykopovar/AnyPS5/pull/5836) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp`<br>`docs/dev/debt/libSceNet.md` | | [PR 6044](https://www.github.com/boykopovar/AnyPS5/pull/6044) | `core/libs/tests/GuestSceNet.cpp` | | [PR 7201](https://www.github.com/boykopovar/AnyPS5/pull/7201) | `core/libs/prx/libSceNet/Export.cpp` | | [PR 7332](https://www.github.com/boykopovar/AnyPS5/pull/7332) | `core/libs/prx/libSceNet/Export.cpp`<br>`core/libs/tests/GuestSceNet.cpp` | | [PR 8106](https://www.github.com/boykopovar/AnyPS5/pull/8106) | `core/libs/prx/libSceNet/Export.cpp`<br>`docs/dev/debt/libSceNet.md` |
oneandonlydean commented 2026-10-20 04:11:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T04:11:42Z.


Thanks, the single-socket record looks right and matches shadPS4's layout and return value (one record, returns 1). One concern before merge: some calls that main answers without stopping now throw.

  • s < 0 (all sockets) used to fail with EBADF; now it throws. shadPS4 implements it: with info == nullptr it returns the number of sockets, otherwise it fills up to n records for every open socket and returns how many it wrote. Could you implement that here (the table is g_socks), or at least keep returning an error instead of throwing?
  • flags != 0 and IPv6 sockets used to return 0 and now throw. If you know what the console does for nonzero flags, please note it; otherwise an error return would be safer than a throw for a call that previously succeeded.

The debt-file conflict with main is only the neighbouring TCP_NODELAY entry.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6283189466 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7959#issuecomment-6283189466). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T04:11:42Z. --- Thanks, the single-socket record looks right and matches shadPS4's layout and return value (one record, returns 1). One concern before merge: some calls that `main` answers without stopping now throw. - `s < 0` (all sockets) used to fail with `EBADF`; now it throws. shadPS4 implements it: with `info == nullptr` it returns the number of sockets, otherwise it fills up to `n` records for every open socket and returns how many it wrote. Could you implement that here (the table is `g_socks`), or at least keep returning an error instead of throwing? - `flags != 0` and IPv6 sockets used to return 0 and now throw. If you know what the console does for nonzero flags, please note it; otherwise an error return would be safer than a throw for a call that previously succeeded. The debt-file conflict with `main` is only the neighbouring `TCP_NODELAY` entry.
Lindamea1 commented 2026-10-20 06:27:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Lindamea1 on 2026-10-20T06:27:49Z.


Thanks. Pushed a05db60c8, rebased onto main 1ed63f63c (the debt conflict was the TCP_NODELAY entry next to this one):

  • s < 0 now lists the sockets as shadPS4 does: with info == nullptr it returns their number, otherwise it writes up to n records in socket order and returns how many it wrote, skipping a socket closed during the call.
  • Nothing throws any more, but two answers differ from shadPS4:
    • An IPv6 socket fails with EAFNOSUPPORT, since the record has room only for an IPv4 address, and is left out of the count and the list. shadPS4 lists it with the addresses and ports 0 and returns 1 for it alone. SharpProspero's SockInfo6Ipv46 request flag (0x1000, "report both IPv4 and IPv6 sockets") suggests sceNetGetSockInfo6 is where IPv6 sockets are listed. If you'd rather keep that call succeeding the way shadPS4 does, I can switch to that.
    • A flags bit other than 0x40 fails with EINVAL, where shadPS4 ignores flags. SharpProspero names 0x40 SockInfoTimeWait ("also list sockets in the TIME_WAIT state"); closed sockets leave the table at once here, so 0x40 lists the same sockets. I don't know what the console does with the other bits.

guest_sce_net now also checks the count, the full list against the per-socket records, n 1, 0x40, the rejected flags and the IPv6 error. The description and the debt entry are updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6284864529 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/7959#issuecomment-6284864529). Originally posted by [Lindamea1](https://github.com/Lindamea1) on 2026-10-20T06:27:49Z. --- Thanks. Pushed `a05db60c8`, rebased onto `main` `1ed63f63c` (the debt conflict was the `TCP_NODELAY` entry next to this one): - `s < 0` now lists the sockets as shadPS4 does: with `info == nullptr` it returns their number, otherwise it writes up to `n` records in socket order and returns how many it wrote, skipping a socket closed during the call. - Nothing throws any more, but two answers differ from shadPS4: - An IPv6 socket fails with `EAFNOSUPPORT`, since the record has room only for an IPv4 address, and is left out of the count and the list. shadPS4 lists it with the addresses and ports 0 and returns 1 for it alone. SharpProspero's `SockInfo6Ipv46` request flag (0x1000, "report both IPv4 and IPv6 sockets") suggests `sceNetGetSockInfo6` is where IPv6 sockets are listed. If you'd rather keep that call succeeding the way shadPS4 does, I can switch to that. - A `flags` bit other than 0x40 fails with `EINVAL`, where shadPS4 ignores `flags`. SharpProspero names 0x40 `SockInfoTimeWait` ("also list sockets in the TIME_WAIT state"); closed sockets leave the table at once here, so 0x40 lists the same sockets. I don't know what the console does with the other bits. `guest_sce_net` now also checks the count, the full list against the per-socket records, `n` 1, 0x40, the rejected flags and the IPv6 error. The description and the debt entry are updated.
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!7959
No description provided.