From 625525de79d3f5667ec521f51220ea8ea2132edc Mon Sep 17 00:00:00 2001 From: Celegans12 <53881228+Celegans12@users.noreply.github.com> Date: Thu, 15 Oct 2026 05:55:30 +0200 Subject: [PATCH] fix(libSceNetCtl): answer the DHCP host name, PPPoE name and proxy server as empty strings Since #5056, sceNetCtlGetInfo throws for every info code it does not model. Ghost of Yotei (PPSA26344) asks for code 12, the DHCP host name, during boot and now aborts one second in. The configuration #5056 reports (wired, DHCP, HTTP proxy off) sets no DHCP host name, no PPPoE user name and no proxy server, so codes 12, 13 and 20 now return 0 with an empty string. The Wi-Fi codes (5-10) and the proxy port (21) still throw. GuestNetCtl checks the three empty answers and keeps the throw check for the rest; the libSceNetCtl debt line says the same. --- core/libs/prx/libSceNetCtl/Export.cpp | 6 ++++++ core/libs/tests/GuestNetCtl.cpp | 7 ++++++- docs/dev/debt/libSceNetCtl.md | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/core/libs/prx/libSceNetCtl/Export.cpp b/core/libs/prx/libSceNetCtl/Export.cpp index 27bdd35a7c..d6cac2011c 100644 --- a/core/libs/prx/libSceNetCtl/Export.cpp +++ b/core/libs/prx/libSceNetCtl/Export.cpp @@ -43,12 +43,15 @@ static constexpr int NET_CTL_INFO_ETHER_ADDR = 2; static constexpr int NET_CTL_INFO_MTU = 3; static constexpr int NET_CTL_INFO_LINK = 4; static constexpr int NET_CTL_INFO_IP_CONFIG = 11; +static constexpr int NET_CTL_INFO_DHCP_HOSTNAME = 12; +static constexpr int NET_CTL_INFO_PPPOE_AUTH_NAME = 13; static constexpr int NET_CTL_INFO_IP_ADDRESS = 14; static constexpr int NET_CTL_INFO_NETMASK = 15; static constexpr int NET_CTL_INFO_DEFAULT_ROUTE = 16; static constexpr int NET_CTL_INFO_PRIMARY_DNS = 17; static constexpr int NET_CTL_INFO_SECONDARY_DNS = 18; static constexpr int NET_CTL_INFO_HTTP_PROXY_CONFIG = 19; +static constexpr int NET_CTL_INFO_HTTP_PROXY_SERVER = 20; static constexpr int NET_CTL_INFO_HTTP_PROXY_PORT = 21; static constexpr std::uint32_t NET_CTL_DEVICE_WIRED = 0; static constexpr std::uint32_t NET_CTL_LINK_CONNECTED = 1; @@ -349,6 +352,9 @@ int APS5_VABI sceNetCtlGetInfo(int code, NetCtlInfo* info) { case NET_CTL_INFO_PRIMARY_DNS: WriteInfoAddress(info, host.dns.size() > 0 ? host.dns[0] : in_addr{}); break; case NET_CTL_INFO_SECONDARY_DNS: WriteInfoAddress(info, host.dns.size() > 1 ? host.dns[1] : in_addr{}); break; case NET_CTL_INFO_HTTP_PROXY_CONFIG: WriteInfoWord(info, NET_CTL_HTTP_PROXY_OFF); break; + case NET_CTL_INFO_DHCP_HOSTNAME: + case NET_CTL_INFO_PPPOE_AUTH_NAME: + case NET_CTL_INFO_HTTP_PROXY_SERVER: std::memset(info->opaque, 0, sizeof(info->opaque)); break; default: throw std::runtime_error("sceNetCtlGetInfo: info code " + std::to_string(code) + " is not implemented"); } return 0; diff --git a/core/libs/tests/GuestNetCtl.cpp b/core/libs/tests/GuestNetCtl.cpp index f0196de5a7..92c51b9a39 100644 --- a/core/libs/tests/GuestNetCtl.cpp +++ b/core/libs/tests/GuestNetCtl.cpp @@ -124,7 +124,12 @@ int main() { QueryAddress(17); QueryAddress(18); - for (const int code : {5, 6, 7, 8, 9, 10, 12, 13, 20, 21}) { + for (const int code : {12, 13, 20}) { + std::memset(&info, 0x5a, sizeof(info)); + Require(sceNetCtlGetInfo(code, &info) == 0 && info.opaque[0] == 0); + } + + for (const int code : {5, 6, 7, 8, 9, 10, 21}) { bool threw = false; try { sceNetCtlGetInfo(code, &info); diff --git a/docs/dev/debt/libSceNetCtl.md b/docs/dev/debt/libSceNetCtl.md index 4da9e097aa..317150823e 100644 --- a/docs/dev/debt/libSceNetCtl.md +++ b/docs/dev/debt/libSceNetCtl.md @@ -2,4 +2,4 @@ ### Unknown function info -- [sceNetCtlGetInfo](../../../core/libs/prx/libSceNetCtl/Export.cpp) (libSceNetCtl) - answers from the host interface that holds an IPv4 address, preferring the one that carries the default route: its address, netmask, gateway, MTU and first two IPv4 DNS servers. The device is reported as wired, the link as connected, the IP configuration as DHCP and the HTTP proxy as off, whatever the host uses, and the Ethernet address is the one `sceNetGetMacAddress` reports. A gateway or DNS server the interface does not have is reported as `0.0.0.0`; what a console reports then is unknown. The Wi-Fi codes (5-10), the DHCP host name (12), the PPPoE user name (13) and the HTTP proxy server and port (20, 21) throw +- [sceNetCtlGetInfo](../../../core/libs/prx/libSceNetCtl/Export.cpp) (libSceNetCtl) - answers from the host interface that holds an IPv4 address, preferring the one that carries the default route: its address, netmask, gateway, MTU and first two IPv4 DNS servers. The device is reported as wired, the link as connected, the IP configuration as DHCP and the HTTP proxy as off, whatever the host uses, and the Ethernet address is the one `sceNetGetMacAddress` reports. A gateway or DNS server the interface does not have is reported as `0.0.0.0`; what a console reports then is unknown. The DHCP host name (12), the PPPoE user name (13) and the HTTP proxy server (20) are empty strings, as that configuration sets none of them; the Wi-Fi codes (5-10) and the HTTP proxy port (21) throw