fix(libSceNet): print the interface and socket tables from sceNetShowIfconfig and sceNetShowNetstat #10502
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10502"
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 frankea on 2026-10-24T05:04:02Z.
What
Since #9137 (
04f2d9a60),sceNetShowIfconfigandsceNetShowNetstatthrow oncesceNetInithas run (Initialized calls throw because native diagnostic collection and formatting are not implemented), so a title that calls either for its log stops there. On a PS5 both return 0 and print plain-text tables to the caller's stdout. They now do the same, in the console's layout, with what the emulator knows. Before initialization both still return the not-initialized error.sceNetShowIfconfig:eth0 (index=1)block whensceNetCtlGetInfohas a host IPv4 interface to report, with the same values a title reads there: the MAC02:50:53:35:00:01(alsosceNetGetMacAddress's), the address, the netmask, the broadcast address derived from them and the MTU. The interface comes from a newNetCtlHostIpv4Address_nid_no_patch, next to the existingNetCtlHostDnsServers_nid_no_patch.lo0 (index=2)block as it printed it.dns addresseswith the two IPv4 serverssceNetGetDnsInforeturns, and::, ::for IPv6.sceNetShowNetstat:--- ID, type, [self/R/S/RE/SE//NB], ... ---, then one entry per socket (UDP, then TCP, then raw, as the console groups them, each by descending ID) and one line per epoll.SO_NBIO, the state (OPENEDfor UDP and raw;LISTEN,ESTABLISHEDorCLOSEDfor TCP), the title's pid and the name; the local and remote address (*for the IPv4 wildcard and[*]for IPv6's, as the console writes them,*for port 0, and 28 trailing spaces, as the console pads them); and the send and receive buffer sizessceNetGetsockoptreports.sceNetSocketandsceNetEpollCreatewere ignored. They are now kept, cut to 31 characters (the 32-byte name ofSceNetSockInfo), for these lines.Left out, in the debt entry: ifconfig's IPv6 address,
UP6, link status, traffic counters and times foreth0, the wireless interfaces, and the pool and statistics sections. Netstat lists only the title's own sockets and epolls, while the console lists every process's. The R, S, RE and SE flags, the field after the type, the queue lengths, rates and drop counts print as on an idle console socket, and the self flag on epoll lines is inferred from the socket lines.sceNetShowNetstatWithMemorykeeps its existing output.Measurement: PS5 on firmware 13.40, 2026-10-19, from an elfldr payload process that called both after
sceNetInit. Both returned 0. Ifconfig printedeth0,lo0,wlan0andwlan1blocks, then the DNS, pool and statistics sections. Netstat printed the header and an entry for every socket and epoll of every process, for example:Tested
Windows 11 (build 26200), MinGW GCC (WinLibs 15.2) Release build with
BUILD_TESTING=ON, each test run three times (ctest --repeat until-fail:3).guest_sce_netcaptures both outputs aftersceNetInit. Ifconfig: thelo0block byte for byte, the DNS section ending in::, ::, and aneth0block with the emulator's MAC when the host has an interface. Netstat: the header; a UDP socket with a 40-character name, unbound and blocking, as*....-.,OPENED,*:*both ways and the name cut to 31; a non-blocking TCP socket listening on 127.0.0.1 as*....-*,LISTENand its port; an epoll line with its name; the order UDP, TCP, epoll; and none of them once closed. The old check that both throw is gone.guest_sce_net,guest_net_ctl,net_epoll_lifetime, the datagram, dontwait, blocking-send, host-write, refused-connect and buffer-validation sets):main97d33464cmerged in): 41/41.main97d33464cwith only this PR'sGuestSceNet.cpp:guest_sce_netstops onmain's throw (what(): sceNetShowIfconfig); the other 40 pass.main97d33464c: 41/41.tools/check_conventions.py --base origin/mainpasses.Overlap
#8232 (
sceNetShowNetstatEx) and #8225 (sceNetShowPolicy) have merged. Withmainmerged in,CheckNetstatruns this PR's checks and then their two calls, and the debt file keeps their entries before and after this PR's.main's new argument check insceNetEpollCreate(a null name or nonzero flags fail withEINVAL) is kept, so the epoll name this PR stores is never null. No open PR changessceNetShowIfconfigorsceNetShowNetstat.Checklist
main; no other open PR implements the same functions.NotImplemented_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)sceNetInitstops on the throw todayImported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-24T05:19:32Z.
Review: APPROVED
Checked against main
7966e590efand shadPS4 net.cpp at 396c2a09a3 (both functions are logged stubs returning 0):g_socks), never host-wide ones. The MAC is the fixed02:50:53:35:00:01fromsceNetGetMacAddress, not the host adapter's.eth0block and the DNS line put the host's real LAN address, netmask and DNS servers on stdout. Titles already get these fromsceNetCtlGetInfo/sceNetGetDnsInfo, so this is only about them now landing in logs that users paste into issues. Not a blocker.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T11:20:08Z.
Review: DISMISSED
The implementation is carefully scoped to the state the emulator actually knows, and the reported Windows test matrix is strong. I found two merge blockers:
CONFLICTINGwith main (mergeStateStatus: DIRTY). Please rebase on current main and resolve the conflict, especially aroundCheckNetstatand the debt entry. #8225 merged on 2026-10-24, after this head was created.CheckNetstatloop and debt entry, so whichever merges second has a conflict. The checklist currently saysDepends on: none. Please coordinate the order with #8232's author and declare it in the checklist, as CONTRIBUTING requires for overlaps.I found no separate runtime defect in the output formatting/state paths I inspected. The author reports all 41 focused Windows tests passing three times and the control on main behaving as described. Linux and the hosted full build were not run; this review did not rerun the Windows test suite locally.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T02:42:20Z.
Review: COMMENTED
First Linux run, since the description says it was not run on Linux.
Bare-metal Linux x86_64: i7-8700, Ubuntu 26.04, kernel 7.0, glibc 2.43, GCC 15.2, Release,
BUILD_TESTING=ON, full build. Head62a98cb02merged--no-commitontomainabed03546(clean).guest_sce_net: passes 3 of 3.net(the libSceNet and libSceNetCtl sets, among others): 36 of 36 pass.libSceNet/Export.cppandlibSceNetCtl/Export.cppfrommainwith the new test kept (full rebuild):guest_sce_netaborts withwhat(): sceNetShowIfconfig, as on Windows.eth0branch is the one taken, not thelo0-only fallback. I dumped the captured output from a local copy of the test. The machine has a physical NIC plus two Docker bridges (docker0,br-*), andNetCtlHostIpv4Addresspicked the physical NIC: its address,/24netmask and broadcast,MTU:1500(max:1500), with the02:50:53:35:00:01MAC. So the bridges did not get in the way.127.0.0.53, 0.0.0.0, becauseNetCtlHostDnsServersreads/etc/resolv.conf, which points at the local stub. That matches whatsceNetGetDnsInfoalready reports onmain.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T06:33:56Z.
Review: COMMENTED
public_headersfails on this head, both on its own and merged onto currentmain(b7105f728):#10706 (merged 2026-10-24) added this audit: every export must be declared exactly once, in its library's public header. The new
extern "C" int APS5_VABI getpid_nid_postfix(void);inlibSceNet/Export.cppduplicates the libkernel declaration. CI did not catch it because thelinux/windowsjobs were skipped on this head.Fix: delete that line.
Export.cppalready includesprx/libkernel/include/Api.hpp, which declaresgetpid_nid_postfixwith the same signature.With that change the audit passes for this PR. The only remaining error is the
sceKernelGetModuleInfoForUnwindone that is already onmainfrom #9263 (#11718 fixes it).Export.cppalso passes a GCC 15.2-fsyntax-onlycheck with the build flags.Checked on Linux (i7-8700, Ubuntu 26.04, GCC 15.2):
core/libs/tests/test_public_headers.py --audit-onlyon head62a98cb02merged ontomainb7105f728.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.