mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Add CELL_NET_CTL_INFO_DHCP_HOSTNAME impl
This commit is contained in:
parent
c13039396c
commit
67378c7dea
@ -216,6 +216,7 @@ error_code cellNetCtlGetInfo(s32 code, vm::ptr<CellNetCtlInfo> 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_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_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_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;
|
default: cellNetCtl.error("Unsupported request: %s", InfoCodeToName(code)); break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,8 @@ np_handler::np_handler()
|
|||||||
|
|
||||||
bool np_handler::discover_ip_address()
|
bool np_handler::discover_ip_address()
|
||||||
{
|
{
|
||||||
std::array<char, 1024> hostname;
|
hostname.clear();
|
||||||
|
hostname.resize(1024);
|
||||||
|
|
||||||
if (gethostname(hostname.data(), hostname.size()) == -1)
|
if (gethostname(hostname.data(), hostname.size()) == -1)
|
||||||
{
|
{
|
||||||
@ -111,6 +112,8 @@ bool np_handler::discover_ip_address()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nph_log.notice("Hostname was determined to be %s", hostname);
|
||||||
|
|
||||||
hostent *host = gethostbyname(hostname.data());
|
hostent *host = gethostbyname(hostname.data());
|
||||||
if (!host)
|
if (!host)
|
||||||
{
|
{
|
||||||
@ -221,6 +224,11 @@ const std::array<u8, 6>& np_handler::get_ether_addr() const
|
|||||||
return ether_address;
|
return ether_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& np_handler::get_hostname() const
|
||||||
|
{
|
||||||
|
return hostname;
|
||||||
|
}
|
||||||
|
|
||||||
u32 np_handler::get_local_ip_addr() const
|
u32 np_handler::get_local_ip_addr() const
|
||||||
{
|
{
|
||||||
return local_ip_addr;
|
return local_ip_addr;
|
||||||
|
@ -19,6 +19,7 @@ public:
|
|||||||
np_handler();
|
np_handler();
|
||||||
|
|
||||||
const std::array<u8, 6>& get_ether_addr() const;
|
const std::array<u8, 6>& get_ether_addr() const;
|
||||||
|
const std::string& get_hostname() const;
|
||||||
u32 get_local_ip_addr() const;
|
u32 get_local_ip_addr() const;
|
||||||
u32 get_public_ip_addr() const;
|
u32 get_public_ip_addr() const;
|
||||||
u32 get_dns_ip() const;
|
u32 get_dns_ip() const;
|
||||||
@ -174,6 +175,7 @@ protected:
|
|||||||
std::vector<u8> current_ticket;
|
std::vector<u8> current_ticket;
|
||||||
|
|
||||||
// IP & DNS info
|
// IP & DNS info
|
||||||
|
std::string hostname = "localhost";
|
||||||
std::array<u8, 6> ether_address{};
|
std::array<u8, 6> ether_address{};
|
||||||
be_t<u32> local_ip_addr{};
|
be_t<u32> local_ip_addr{};
|
||||||
be_t<u32> public_ip_addr{};
|
be_t<u32> public_ip_addr{};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user