diff --git a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp index af3152d726..cb3e313042 100644 --- a/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp +++ b/rpcs3/Emu/Cell/Modules/cellNetCtl.cpp @@ -216,6 +216,7 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr info) case CELL_NET_CTL_INFO_IP_ADDRESS: strcpy_trunc(info->ip_address, np_handler::ip_to_string(nph->get_local_ip_addr())); break; case CELL_NET_CTL_INFO_NETMASK: strcpy_trunc(info->netmask, "255.255.255.255"); break; case CELL_NET_CTL_INFO_HTTP_PROXY_CONFIG: info->http_proxy_config = 0; break; + case CELL_NET_CTL_INFO_DHCP_HOSTNAME: strcpy_trunc(info->dhcp_hostname, nph->get_hostname()); break; default: cellNetCtl.error("Unsupported request: %s", InfoCodeToName(code)); break; } diff --git a/rpcs3/Emu/NP/np_handler.cpp b/rpcs3/Emu/NP/np_handler.cpp index 373d1a672d..024fb5b840 100644 --- a/rpcs3/Emu/NP/np_handler.cpp +++ b/rpcs3/Emu/NP/np_handler.cpp @@ -103,7 +103,8 @@ np_handler::np_handler() bool np_handler::discover_ip_address() { - std::array hostname; + hostname.clear(); + hostname.resize(1024); if (gethostname(hostname.data(), hostname.size()) == -1) { @@ -111,6 +112,8 @@ bool np_handler::discover_ip_address() return false; } + nph_log.notice("Hostname was determined to be %s", hostname); + hostent *host = gethostbyname(hostname.data()); if (!host) { @@ -221,6 +224,11 @@ const std::array& np_handler::get_ether_addr() const return ether_address; } +const std::string& np_handler::get_hostname() const +{ + return hostname; +} + u32 np_handler::get_local_ip_addr() const { return local_ip_addr; diff --git a/rpcs3/Emu/NP/np_handler.h b/rpcs3/Emu/NP/np_handler.h index 9bf909c49d..ee54977a44 100644 --- a/rpcs3/Emu/NP/np_handler.h +++ b/rpcs3/Emu/NP/np_handler.h @@ -19,6 +19,7 @@ public: np_handler(); const std::array& get_ether_addr() const; + const std::string& get_hostname() const; u32 get_local_ip_addr() const; u32 get_public_ip_addr() const; u32 get_dns_ip() const; @@ -174,6 +175,7 @@ protected: std::vector current_ticket; // IP & DNS info + std::string hostname = "localhost"; std::array ether_address{}; be_t local_ip_addr{}; be_t public_ip_addr{};