Commit Graph
160 Commits
Author SHA1 Message Date
Yunus Shaikh dda8c45be7 Merge #9515's main merge into feat/libscenet-ex-forwards 2026-10-23 06:50:35 -07:00
Yunus Shaikh efd999c8ed Merge main into fix/libkernel-getsockopt-net-sockets
# Conflicts:
#	docs/dev/debt/libkernel.md
2026-10-23 06:49:51 -07:00
Dean da46482789 Merge pull request #9872 from MarcZX10/test/net-resolver-family-coverage
test(net): preserve resolver address-family coverage
2026-10-24 01:13:52 +13:00
Arnab Ghosh 5dfa258d9f feat(libSceNet): implement sceNetIoctl 2026-10-23 10:07:18 +06:00
Dean 1da03c6f34 Merge pull request #9076 from orezraey/fix/net-utilities-measured-ps5
fix(libSceNet): accept every sceNetMemoryAllocate flag as measured on a PS5
2026-10-23 09:22:21 +13:00
Dean 5d40eb3fdc Merge pull request #9106 from Retr0G28/fix/scenet-stream-recv-timeout-eagain
fix(libSceNet): report EAGAIN when a stream receive times out on Windows
2026-10-23 09:22:12 +13:00
MarcZX10 53d3d8674e test(net): constrain deterministic resolver failures 2026-10-22 20:07:41 +00:00
MarcZX10 d37f11e424 test(net): preserve real address-family failure coverage 2026-10-22 20:07:41 +00:00
Yunus Shaikh 43ea7772bb Merge main into feat/libscenet-ex-forwards 2026-10-22 06:35:18 -07:00
MarcZX10 548aecf030 test(net): make resolver failures deterministic 2026-10-22 05:36:57 +00:00
ShinMalphur 24b7977241 Merge branch 'main' into feat/net-ether-address-parser 2026-10-22 09:44:29 +06:30
Yunus Shaikh a19d110222 feat(libSceNet): report the IPv4 default route in sceNetConfigGetDefaultRoute
sceNetConfigGetDefaultRoute threw. It now writes the IPv4 gateway of the
host interface that libSceNetCtl's sceNetCtlGetInfo already describes as
DEFAULT_ROUTE, in network byte order, the order sceNetInetPton writes an
AF_INET address in, and returns 0. libSceNetCtl exports
NetCtlHostIpv4Gateway_nid_no_patch for it, next to the DNS helper
sceNetGetDnsInfo uses. Without a gateway, or for a null pointer, it
still throws: the console's answer for a missing route is not measured.

Tested: guest_sce_net_tests, after sceNetCtlInit, prints the gateway
with sceNetInetNtop and compares it with sceNetCtlGetInfo's
DEFAULT_ROUTE text (192.0.2.1 on this host); a null pointer throws.
On a host without a default route the case checks that the call
throws and leaves the output untouched.
2026-10-22 01:44:35 +00:00
Yunus Shaikh b44ee56f7d feat(libSceNet): convert IPv6 text with a numeric scope ID
sceNetInetNtopWithScopeId and sceNetInetPtonWithScopeId threw. They now
handle AF_INET6 text with an RFC 4007 numeric zone (fe80::1%2): the
address part goes through sceNetInetNtop and sceNetInetPton, so it
follows the FreeBSD inet text rules, and the zone is printed and parsed
as FreeBSD 11.4's getnameinfo (NI_NUMERICSCOPE) and getaddrinfo do. A
zero scope ID prints the address alone and text without a zone parses
to scope ID 0. An empty zone, one above 2^32 - 1, or an invalid address
part returns 0 and leaves both outputs untouched; a buffer too small
for the scoped text gives ENOSPC.

A zone given as an interface name, and AF_INET, still throw: the tree
has no mapping from interface names to the console's interface indexes
and no answer for an IPv4 zone. The debt file says so.

Tested: guest_sce_net_tests round-trips fe80::1%2 (same address bytes
as fe80::1, scope ID 2) and ff02::1%4294967295, checks the exact
buffer size and ENOSPC one byte short, the unscoped forms, four
rejected texts with untouched outputs, EINVAL for null pointers, and
that an interface-name zone and AF_INET throw.
2026-10-22 01:39:06 +00:00
Yunus Shaikh 7a48107952 feat(libSceNet): forward sceNetSysctl to libkernel's sysctl
sceNetSysctl threw. Its restored argument list is FreeBSD's sysctl(3)
(name, name length, old value and size, new value and size), so it now
calls libkernel's sysctl. It answers exactly the MIBs libkernel models,
and a failure is returned as the library's other calls return one
(0x80410100 | errno, with the errno set).

Tested: guest_sce_net_tests reads hw.pagesize (6.7) through both
sysctl and sceNetSysctl and gets the same value and size, including a
size-only query. A one-level name gives EINVAL, a null name EFAULT, a
write EPERM and a one-byte buffer ENOMEM, each as 0x804101xx with the
errno set.
2026-10-22 01:37:18 +00:00
Yunus Shaikh 3cd3328124 feat(libSceNet): forward sceNetSocketInternal and the Ex socket options to their public twins
sceNetSocketInternal, sceNetGetsockoptEx and sceNetSetsockoptEx threw.
Their argument lists, restored with the rest of the firmware exports in
4d6942f1e, are the same as sceNetSocket, sceNetGetsockopt and
sceNetSetsockopt, so they now call those. Nothing in the tree records
how the console tells the entry points apart (for example by the
calling process); the debt file says so.

Tested: guest_sce_net_tests creates a datagram socket through
sceNetSocketInternal, sets SO_REUSEADDR and SO_RCVTIMEO through
sceNetSetsockoptEx and reads them back through sceNetGetsockoptEx and
sceNetGetsockopt with the same values. On a closed socket and on -1,
and for an unsupported family and type, each Ex/Internal call returns
the same error and errno as its public twin.
2026-10-22 01:36:24 +00:00
Yunus Shaikh 528ede377d Merge #9494 and #9515 into feat/libscenet-ex-forwards
Base for the libSceNet Ex/Internal forwards: upstream main 94fbb8cea with fix/libscenet-inet-text-rules (ef49574f5) and fix/libkernel-getsockopt-net-sockets (aea804d9f).
2026-10-22 01:31:01 +00:00
orezraeyandClaude Opus 5.5 da0ed3b5c3 Merge main into fix/net-utilities-measured-ps5
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 21:25:51 -03:00
Yunus Shaikh aea804d9fd fix(libkernel): getsockopt reads options of libSceNet sockets
setsockopt reaches a socket created with sceNetSocket through the option setter libSceNet registers, but getsockopt looked the descriptor up only among libkernel's own sockets and failed, so a title could set an option on such a socket through the BSD call and not read it back. libSceNet now registers an option getter with libkernel next to its setter, which answers through sceNetGetsockopt, so SO_RCVTIMEO and SO_SNDTIMEO come back as a struct timeval.
2026-10-21 16:57:33 -07:00
Yunus Shaikh e887616e74 fix(libSceNet): read back SO_REUSEADDR and SO_BROADCAST in sceNetGetsockopt
sceNetSetsockopt takes both, but sceNetGetsockopt failed them with EOPNOTSUPP. It now reads them from the host socket. FreeBSD's sogetopt returns so_options & option for the boolean options, so they read back as 0x4 and 0x20 when set.
2026-10-21 16:47:16 -07:00
Yunus Shaikh ef49574f5a Merge main into fix/libscenet-inet-text-rules 2026-10-21 15:49:51 -07:00
boykopovar ea086b2374 fix(netctl): restore initialization and callback validation 2026-10-21 21:51:41 +03:00
boykopovar 04f2d9a60f fix(net): reject unsupported diagnostic output after initialization 2026-10-21 21:50:44 +03:00
boykopovar 1a214787ce fix(net): correct allocation size and flag handling 2026-10-21 21:47:59 +03:00
boykopovar 0f6161f885 fix(net): enforce initialization for sleep and random calls 2026-10-21 21:47:58 +03:00
boykopovar 9a09fc0a78 fix(net): restore dns cache argument validation 2026-10-21 21:47:32 +03:00
ShinMalphur d5e2042c5b test(net): cover measured decoding and safe short inputs 2026-10-21 23:28:55 +06:30
ShinMalphur b1ccca5cf7 Merge branch 'main' into feat/net-ether-address-parser 2026-10-21 23:24:11 +06:30
Retr0 3509bb528a fix(libSceNet): report EAGAIN when a stream receive times out on Windows
FreeBSD 11.4's soreceive_generic waits in sbwait (sys/kern/uipc_socket.c,
uipc_sockbuf.c), whose msleep_sbt on so_rcv.sb_timeo returns EWOULDBLOCK
(35) for every socket type when SO_RCVTIMEO expires. On Windows the host
socket is non-blocking and native_transfer enforces the timeout itself,
but it reported WSAETIMEDOUT, which only datagram receives turned into
EAGAIN; a stream receive failed with ETIMEDOUT (60). A receive that
reaches the stored timeout now reports WSAEWOULDBLOCK, so every
receive returns EAGAIN, and a host WSAETIMEDOUT still maps to ETIMEDOUT.
2026-10-21 15:26:46 +03:00
orezraeyandClaude Opus 5.5 c5df2f4ce0 fix(libSceNet): accept every sceNetMemoryAllocate flag as measured on a PS5
A PS5 (firmware 13.60) allocates with any flag value, zero-fills only for
flag 2 and returns 64-byte aligned blocks. Record the measured behaviour of
sceNetGetIfName, sceNetGetRandom, sceNetGetSystemTime, sceNetMemoryFree and
sceNetUsleep, which already match the console, and keep only their open gaps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-21 08:48:19 -03:00
jagrat Singh 54d1a8d6d6 feat(libSceNet): implement sceNetShowRoute6 2026-10-21 12:44:40 +02:00
Dean 7ef094f7d4 Merge pull request #8222 from jagrat04/feat/libSceNet-show-route
feat(libSceNet): implement sceNetShowRoute
2026-10-21 20:19:56 +13:00
Dean 7e6830ec55 Merge pull request #8268 from Athen2045/feat/net-dns-info
feat(libSceNet): implement sceNetGetDnsInfo
2026-10-21 11:50:31 +13:00
xXPBSXxandClaude Sonnet 5.5 3fb021f9bb fix(libSceNet): map every host socket error through the guest errno table
sceNet translated only 21 host socket errors and reported every other one
as EIO. libkernel already owns the complete FreeBSD table in
GuestSockets::GuestErrorFromHost, so use it for net_error. The new check
makes a stream socket with the UDP protocol fail with EPROTONOSUPPORT (43)
instead of EIO (5).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 19:24:33 +02:00
Allan JohnandClaude Opus 5.5 8ab6ecb17a feat(libSceNet): implement sceNetGetDnsInfo
Report the host IPv4 DNS servers of the interface sceNetCtlGetInfo
uses, through a helper libSceNetCtl exports, and return their count.
The signature and layout follow the OpenOrbis musl resolver and Net.h.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 13:19:12 +05:30
Dean 26f157ba15 Merge pull request #7959 from Lindamea1/fix/libscenet-getsockinfo-fill
fix(libSceNet): fill the address and port fields in sceNetGetSockInfo
2026-10-20 20:07:23 +13:00
Dean 138351d714 Merge pull request #8056 from ntamas94/fix/sce-net-inet-pton-ex-aton
fix(libSceNet): parse sceNetInetPtonEx IPv4 text as the PS4 does
2026-10-20 19:31:57 +13:00
Lindamea1andClaude Opus 5.5 a05db60c87 fix(libSceNet): fill the address and port fields in sceNetGetSockInfo
sceNetGetSockInfo returned 0 for a known socket and wrote nothing, so
callers read uninitialised bytes as the socket's endpoints. Monster
Hunter Wilds (PPSA24191) calls it after bind, connect and accept and
stores the local and remote address and port it reads back.

It now writes one 0xA0-byte record in the layout SharpProspero and
shadPS4 give: the socket id, the socket type, the local and remote
IPv4 address and port of the host socket in network byte order, the
SELF and NONBLOCK status flags, and the receive and send buffer sizes
sceNetGetsockopt reports for the socket. The other fields are 0. It
returns 1, the number of records written, and EINVAL for a null record
or an n below 1, as shadPS4 does.

An s below 0 lists the sockets as shadPS4 does: with a null record it
returns their number, otherwise it writes up to n records in socket
order and returns how many it wrote. Unlike shadPS4, which lists IPv6
sockets with zero addresses and ignores flags, an IPv6 socket fails
with EAFNOSUPPORT and is left out of the count and the list, and a
flags bit other than 0x40 fails with EINVAL. SharpProspero names 0x40
SockInfoTimeWait; closed sockets leave the table at once, so it lists
the same sockets. docs/dev/debt/libSceNet.md lists the fields left 0
and these differences.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-20 07:23:51 +01:00
Dean df56570fe2 Merge pull request #8054 from HQasper/feat/net-interface-names
feat(libSceNet): implement interface names, random values and net memory
2026-10-20 18:31:02 +13:00
Dean 9d6470ea21 Merge pull request #7991 from MarrasFederico/feat/sce-net-resolver-aton6
feat(libSceNet): reverse-resolve IPv6 addresses in sceNetResolverStartAton6
2026-10-20 17:50:03 +13:00
Dean ca5cd3128b Merge pull request #8013 from MarrasFederico/feat/sce-net-clear-dns-cache
feat(libSceNet): accept sceNetClearDnsCache with no library DNS cache to drop
2026-10-20 17:46:56 +13:00
jagrat Singh 50375074d0 feat(libSceNet): implement sceNetShowRoute
Implement sceNetShowRoute as a silent stub returning 0, matching the (void) signature in shadPS4 and the behavior of sceNetShowIfconfig and sceNetShowNetstat. Adds guest unit tests in GuestSceNet.cpp and updates technical debt documentation.
2026-10-20 09:51:48 +05:30
xXPBSXxandClaude Sonnet 5.5 ba0755337d fix(libSceNet): pass MSG_DONTWAIT to the wait for a local address on Windows
sceNetRecv, sceNetRecvfrom and sceNetRecvmsg on a datagram socket without a
local address waited in wait_for_local_address until the socket was bound,
connected or written to, because only a non-blocking socket made that wait
fail. FreeBSD 11.4 soreceive_dgram fails a MSG_DONTWAIT receive without data
with EWOULDBLOCK. The flags now reach wait_for_local_address and the test
covers an unbound socket.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 06:05:03 +02:00
xXPBSXxandClaude Sonnet 5.5 a39effcef9 fix(libSceNet): honour MSG_DONTWAIT in the send and receive calls on Windows
sceNetSend, sceNetSendto, sceNetSendmsg, sceNetRecv, sceNetRecvfrom and
sceNetRecvmsg failed with EOPNOTSUPP for MSG_DONTWAIT on Windows, where
FreeBSD 11.4 sosend_generic and soreceive_generic make the one call
non-blocking and fail with EWOULDBLOCK when it would wait. Winsock has no
per-call flag, so the call now asks WSAPoll with a zero timeout whether the
socket is ready and fails with EAGAIN when it is not. The Windows branch of
the test that expected EOPNOTSUPP now runs the checks of the other hosts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-20 06:05:03 +02:00
ShinMalphur 44d78d0478 test(net): cover Ethernet address parsing 2026-10-20 09:18:55 +06:30
Dean 500cc640bd Merge pull request #7987 from MarrasFederico/fix/sce-net-ipv6-loopback-errors
test(libSceNet): accept every unusable IPv6 loopback error in guest_sce_net
2026-10-20 14:53:04 +13:00
Adrià 9f9cf38bb0 Merge pull request #7493 from Lindamea1/fix/scenet-tcp-nodelay
fix(libSceNet): support TCP_NODELAY in sceNetSetsockopt and sceNetGetsockopt
2026-10-20 01:01:26 +02:00
ntamas94andClaude Opus 5.5 ad52647cd9 fix(libSceNet): parse sceNetInetPtonEx IPv4 text as the PS4 does
On PS4 firmware 10.71 sceNetInetPtonEx reads IPv4 text the way
inet_aton does, not the way sceNetInetPton does: "1.2.3" is 1.2.0.3,
"127.1" is 127.0.0.1, hex and octal parts are accepted, a part value
wraps at 32 bits ("1.4294967296" is 1.0.0.0) and the text ends at the
first whitespace. Two differences from BSD inet_aton were measured: a
part starting with "09" is decimal ("0989" is 989), and an octal part
containing 8 or 9 fails.

The flags argument changed nothing for 0, every single bit up to
0x100, 0x10000, 0x80000000 and -1, so it is ignored instead of
throwing. IPv6 still converts as sceNetInetPton does, which matches
the console.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-19 21:10:55 +02:00
Claude b0a9676844 feat(libSceNet): implement interface names, random values and net memory
Implement sceNetGetIfName, sceNetGetRandom, sceNetMemoryAllocate and
sceNetMemoryFree with the signatures shadPS4 uses, and cover them in
guest_sce_net_tests.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
2026-10-19 18:29:29 +00:00
Federico Marras 1537dff78b feat(libSceNet): accept sceNetClearDnsCache with no library DNS cache to drop 2026-10-19 19:41:49 +02:00
Federico Marras 87bd71d64c feat(libSceNet): reverse-resolve IPv6 addresses in sceNetResolverStartAton6 2026-10-19 18:57:12 +02:00