Commit Graph
352 Commits
Author SHA1 Message Date
Dean a74a4c370c Merge pull request #14310 from XatiX/fix/libkernel-net-socket-forwards
fix(libkernel): forward socket calls on sceNetSocket descriptors to libSceNet
2026-11-03 21:08:43 +13:00
Dean c43de86da8 Merge pull request #14250 from johnohhh1/fix/net-resolver-error-guest-pointer
fix(net): reject unwritable resolver error outputs
2026-11-03 08:47:08 +13:00
Dean df60655af3 Merge pull request #14244 from johnohhh1/fix/net-mac-address-guest-pointer
fix(net): reject unwritable MAC address outputs
2026-11-03 08:46:59 +13:00
XatiXandClaude Opus 5.5 7a4fa3865b fix(libkernel): keep the libkernel contract on forwarded socket calls
bind, getsockname, sendto and recvfrom validate as for a libkernel socket
before they reach libSceNet, so a forwarded descriptor reports the same
errors. recvfrom keeps its guest address handling and MSG_WAITALL, and a
zero-length datagram receive does not wait.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 17:33:10 +00:00
XatiXandClaude Opus 5.5 91311f1bf4 fix(libkernel): forward socket calls on sceNetSocket descriptors to libSceNet
A title can create a socket with sceNetSocket and then call bind, getsockname, sendto or recvfrom from libkernel, which does not hold that descriptor, so the call failed with EBADF. PPSA06866's RakNet does this, its local server fails to start and the load after difficulty selection never ends. libSceNet now registers these four calls with libkernel, as it does for setsockopt and getsockopt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 17:32:55 +00:00
Dean 841c8790c7 Merge pull request #12744 from DeveshB-1/fix/scenet-ioctl-safe-copy
fix(libSceNet): return EFAULT from sceNetIoctl for invalid memory pointers
2026-11-03 02:39:26 +13:00
Dean 22c6b12503 Merge pull request #11472 from ycbuzi/fix/net-sendmsg-guest-faults
fix(libSceNet): return EFAULT from sceNetSendmsg and sceNetSendto for unreadable guest memory
2026-11-02 23:28:19 +13:00
Dean 459f61ea02 Merge pull request #9578 from EagleBearerYS/feat/libscenet-ex-forwards
feat(libSceNet): implement the Ex and Internal socket forms, sceNetSysctl, scope-ID text and the default route
2026-11-02 23:25:39 +13:00
Yunus Shaikhandrooklz 0a4d4e792c fix(libSceNet): answer sceNetConfigGetDefaultRoute as the module does
rooklz read sceNetConfigGetDefaultRoute (NID lFJb+BlPK1c, wrapper at
0x153f0) in libSceNet.sprx. Before sceNetInit it returns 0x804101C8
with errno 200. Without a default route it returns 0x8041130C and
leaves the output alone. With one it stores the route and returns 1,
not 0. The wrapper never checks the output pointer.

The not-initialized answer reads the library's sceNetInit/sceNetTerm
flag through fail(), as the other exports do. The route is still the
host gateway. A null output with a route throws std::invalid_argument,
where the module faults.

Co-authored-by: rooklz <[email protected]>
2026-11-01 23:21:53 +00:00
Yunus Shaikhandrooklz 81bc358860 fix(libSceNet): take interface-name zones in the scope-ID text forms
rooklz read sceNetInetNtopWithScopeId (FUN_00006be0) and
sceNetInetPtonWithScopeId (FUN_000072d0) in libSceNet.sprx. The zone
after '%' is one of the ten interface names, never a number, and ntop
prints the name of the interface whose index is the scope. A null
address or text and a short buffer set ENOSPC, and another family sets
EAFNOSUPPORT. Pton reads a zone only when the scope output is not null,
and answers another family with EAFNOSUPPORT and a null text with
EINVAL.

The host has none of these interfaces. Names and indexes go through the
interface table and host-index mapping of rooklz's "feat(net): resolve
interface ids to host indexes", taken with the same text so the two
changes merge without conflict there. A null destination throws
std::invalid_argument, where the module faults.

Co-authored-by: rooklz <[email protected]>
2026-11-01 23:21:53 +00:00
Dean Galvin ee5677e10f Merge main into fix/ps4-net-sockinfo-recv-queue 2026-11-01 18:45:38 +13:00
johnohhh1 98991c19d8 fix(net): reject unwritable resolver error outputs 2026-11-01 00:04:38 -04:00
johnohhh1 2f09de250c fix(net): reject unwritable MAC address outputs 2026-10-31 23:33:49 -04:00
zaryabzip ce093095ff fix(libSceNet): refuse resolver timeouts below one second as firmware 13.42 does
sceNetResolverStartNtoa refuses a timeout from 1 to 999999 with EINVAL
before the resolver is looked up, and takes 0 as 1000000, as a run of
firmware 13.42's module shows.
2026-10-31 14:20:43 +05:00
Adrià bf9f4eca53 Merge pull request #13558 from kyon-eth/feat/net-ipv6-data
feat(libSceNet): expose remaining IPv6 data constants
2026-10-31 02:59:44 +01:00
Adrià 1c3a42c39f Merge pull request #13234 from kyon-eth/feat/net-320-exports
feat(libSceNet): declare 8 callable exports
2026-10-31 00:10:04 +01:00
Kyon 0918719f6e feat(libSceNet): expose remaining IPv6 data constants 2026-10-30 18:11:58 +00:00
Kyon 1a01acf0c4 feat(libSceNet): declare 8 callable exports 2026-10-30 07:22:20 +00:00
pista d64e85164b build(libs): let the system libraries compile with Emscripten
Emscripten targets wasm64 without x86 assembly, Linux-only headers or the
x87 long double. These changes add __EMSCRIPTEN__ paths beside the host
ones; native builds compile the same code as before.

- libc: long doubles in guest varargs and scanf go through
  GuestLongDouble, a plain copy where long double is the x87 format;
  APS5_EXPORT emits no assembler alias; the guest arena is one aligned
  allocation that zeroes pages when they are committed again; getifaddrs
  keeps its link-level entries on Linux; /proc lookups and the host
  stderr duplicate are left out.
- libkernel: file-backed mmap, EVFILT_VNODE watches, getcontext and
  setcontext throw; getdents replaces the raw getdents64 syscall;
  getdtablesize takes the resource limit alone.
- VideoOut leaves SDL, the display window and the HDR probe out,
  Sysmodule asks libkernel for unwind information and Net includes
  sys/time.h.
2026-10-30 10:50:57 +09:00
blu 5f29795a8c Merge remote-tracking branch 'origin/main' into fix/net-sendmsg-guest-faults 2026-10-29 13:00:27 -07:00
Adrià f7e84c4cf1 Merge pull request #12426 from meh7an/fix/mingw-runtime-path-prx-loader-tests
test(libs): give the prx loader tests the MinGW runtime on their PATH
2026-10-29 10:41:49 +01:00
DeveshB-1 8bfddfb6ba fix(libSceNet): return EFAULT from sceNetIoctl for invalid memory pointers 2026-10-29 12:16:50 +05:30
Yunus Shaikh e88598fd9e Merge main into feat/libscenet-ex-forwards 2026-10-28 22:59:25 -07:00
Dean e0a11b3fba Merge pull request #9515 from EagleBearerYS/fix/libkernel-getsockopt-net-sockets
fix(libkernel): getsockopt reads options of libSceNet sockets
2026-10-29 18:49:11 +13:00
MarcZX10 c1e321f26d feat(libSceNet): implement sceNetGetStatisticsInfo
sceNetGetStatisticsInfo threw NotImplemented_nid_no_patch. It now fills
the six 32-bit fields of the statistics block (kernel memory free and
minimum free, packet count, QoS packet count, library memory free and
minimum free) and fails with NET_EFAULT, setting errno, for a null
pointer. The layout and the "plenty free, nothing queued" answer follow
shadPS4's net.cpp and net_types.h; the host has no counter for the
console's network memory, so the values are not measured. The debt file
records this, and the test checks the null pointer, the field
invariants and that the flags argument is ignored.
2026-10-28 13:07:48 +00:00
MarcZX10 d7c13a621e feat(libSceNet): implement the pool-checked Show*WithMemory diagnostics
sceNetShowIfconfigWithMemory, sceNetShowPolicyWithMemory and
sceNetShowRoute6WithMemory threw NotImplemented_nid_no_patch. They now
behave like the existing sceNetShowRouteWithMemory: an unknown memory
pool id fails with NET_EBADF (errno set), a live pool returns success
without printing. The behaviour follows shadPS4's net.cpp, which does
the same for these three. The new silent stubs are listed in the
libSceNet technical debt file, and the tests cover the invalid id, live
pool and destroyed pool cases.
2026-10-28 13:07:48 +00:00
Mehran 90a9ab60c0 test(libs): give the prx loader tests the MinGW runtime on their PATH
guest_kernel_sys_threads_main, guest_kernel_sys_threads_main_patched and
net_ipv6only_patched link the MinGW runtime statically and load
libkernel_sys.prx or libSceNet.prx with LoadLibraryExW and
LOAD_WITH_ALTERED_SEARCH_PATH. Windows then looks for the libraries'
libstdc++-6.dll next to the .prx and on PATH, not next to the test
executable where the build copies the runtime. From Git Bash, whose PATH
starts with Git's mingw64/bin, the loader took Git's libstdc++-6.dll,
which lacks the std::__codecvt_utf8_utf16_base<wchar_t> members that
libkernel_sys, libkernel and libc import. The threads tests hung on an
"Entry Point Not Found" dialog until their 20 s timeout, and
net_ipv6only_patched, which suppresses the dialog, got error 127 and
aborted.

On MinGW, prepend the compiler's directory to their PATH, as
patched_libraries does since #10101.
2026-10-28 15:40:02 +03:00
Yunus Shaikh 8c13ac3865 Merge main into feat/libscenet-ex-forwards
# Conflicts:
#	core/libs/prx/libSceNet/Export.cpp
2026-10-28 01:57:32 -07:00
frankea 2129d1f7b5 fix(libSceNet): print the interface and socket tables from sceNetShowIfconfig and sceNetShowNetstat
Since #9137 both throw after sceNetInit. A PS5 on firmware 13.40
returns 0 from each and prints plain-text tables to stdout. They now
print the console's layout with what the emulator knows: ifconfig an
eth0 block from the host interface sceNetCtlGetInfo reports (the same
MAC, address, netmask and MTU), the console's lo0 block and the DNS
servers; netstat the header and one entry per socket and epoll of the
title, with the self and non-blocking flags, addresses, buffer sizes and
the names given to sceNetSocket and sceNetEpollCreate, which are now
kept. The debt entry lists what the console prints that is left out.

guest_sce_net captures both outputs: the lo0 block and DNS section, a
named unbound UDP socket, a non-blocking listening TCP socket bound to
127.0.0.1, an epoll, a 40-character name cut to 31, and the entries gone
after close.
2026-10-28 09:05:58 +01:00
Yunus Shaikh 57ba2fc47c Merge #9515's main merge into feat/libscenet-ex-forwards 2026-10-27 21:04:01 -07:00
Yunus Shaikh 4432e8aa57 Merge main into fix/libkernel-getsockopt-net-sockets 2026-10-27 21:03:12 -07:00
Adrià 5c8beca92c Merge pull request #11676 from al3w0f205/test/net-getsockopt-null-and-bad-descriptor-coverage
test(libSceNet): cover null length pointer and invalid descriptor in socket option calls
2026-10-28 04:27:01 +01:00
Yunus Shaikh f051532324 Merge main into feat/libscenet-ex-internal-scope
# Conflicts:
#	core/libs/prx/libSceNetCtl/Export.cpp
2026-10-27 20:25:19 -07:00
Dean 9014065731 Merge pull request #9231 from Gonic0/fix/macos-sce-net-freebsd-errors
fix(libSceNet): match FreeBSD's inet_pton and socket errors on macOS
2026-10-28 12:59:52 +13:00
blu 38c3845149 Merge remote-tracking branch 'origin/main' into fix/net-sendmsg-guest-faults 2026-10-27 14:32:47 -07:00
Adrià ddd72f488b Merge pull request #10628 from maximilianfv/fix/libscenet-macos-datagram-fionread
fix(libSceNet): count only datagram bytes in sceNetIoctl FIONREAD on macOS
2026-10-27 05:38:46 +01:00
al3w0f205 90b10d8b54 test(libSceNet): cover null length pointer and invalid descriptor in socket option calls 2026-10-26 22:17:55 -05:00
MaxandClaude Opus 5.5 ff5e67de15 fix(libSceNet): keep the iovec copy empty for a receive without iovecs
Copy the iovec table only when there is one, and receive a datagram
with no iovecs in guest_sce_net: it returns 0 with MSG_TRUNC and the
sender's address.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 00:21:05 +01:00
MaxandClaude Opus 5.5 3d2b723f71 fix(libSceNet): receive sceNetRecvmsg through the iovecs it had at entry
sceNetRecvmsg guarded the destinations of the iovec table it saw at
entry, then read the live table again to scatter the received bytes.
When an earlier destination overlapped a later iovec, the received
bytes replaced that iovec and the rest of the data went to an address
that was never guarded, which crashed the host when that address was
not writable. Copy the header and the iovec table once, as FreeBSD
11.4's sys_recvmsg does with copyin and copyiniov, use that copy for
the guards, the scatter and the address, and write the header back
from it as sys_recvmsg's copyout does.

Fixes #11610

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 23:53:11 +01:00
Dean abfa119d02 Merge pull request #11243 from parl0v/fix/getsockopt-kernel-sockets
fix(libSceNet): read an option of a libkernel socket through sceNetGetsockopt
2026-10-27 11:05:26 +13:00
Dean d9c7bb5ffe Merge pull request #11242 from parl0v/fix/epoll-kernel-sockets
fix(libSceNet): register libkernel sockets with sceNetEpollControl
2026-10-27 11:05:08 +13:00
Dean 998e9e5da4 Merge pull request #11037 from Bram910/fix/net-send-nosignal
fix(libSceNet): accept MSG_NOSIGNAL in send, sendto and sendmsg
2026-10-27 10:59:36 +13:00
Dean 77d9056574 Merge pull request #10949 from AZLisme/feat/net-ipv6only
feat(libSceNet): support IPv6 dual-stack socket options
2026-10-27 10:57:32 +13:00
Dean 43c0841507 Merge pull request #10881 from EagleBearerYS/feat/scenet-config-and-ether-calls
feat(libSceNet): implement sceNetInitParam and the loopback answer of sceNetConfigGetIfFlags
2026-10-27 09:07:50 +13:00
bluandClaude Opus 5.5 5780180b94 fix(libSceNet): return EFAULT from sceNetSendmsg and sceNetSendto for unreadable guest memory
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-26 08:44:32 -07:00
Queuze eebedb6427 feat(libSceNet): receive urgent TCP data inline 2026-10-26 14:03:15 +01:00
Adrià 0c6a6be7fe Merge pull request #9542 from Queuse/codex/net-boolean-readback
feat(libSceNet): read reuse and broadcast flags
2026-10-26 12:58:12 +01:00
AZLisme ada64cab1e fix(net): preserve IPv6 socket option bridges in patched modules 2026-10-26 19:16:52 +08:00
AZLisme e846e0c7b2 fix(libSceNet): guard socket option guest outputs 2026-10-26 19:16:52 +08:00
AZLisme 5f332dcaed feat(libSceNet): support IPv6-only socket configuration 2026-10-26 19:16:52 +08:00