diff --git a/Core/HLE/proAdhoc.cpp b/Core/HLE/proAdhoc.cpp index 41e9800cca..73784a3846 100644 --- a/Core/HLE/proAdhoc.cpp +++ b/Core/HLE/proAdhoc.cpp @@ -170,10 +170,13 @@ bool isPTPPortInUse(uint16_t port, bool forListen, SceNetEtherAddr* dstmac, uint } // Replacement for inet_ntoa since it's getting deprecated -std::string ip2str(in_addr in) { +std::string ip2str(in_addr in, bool maskPublicIP) { char str[INET_ADDRSTRLEN] = "..."; u8* ipptr = (u8*)∈ - snprintf(str, sizeof(str), "%u.%u.%u.%u", ipptr[0], ipptr[1], ipptr[2], ipptr[3]); + if (maskPublicIP && !isPrivateIP(in.s_addr)) + snprintf(str, sizeof(str), "%u.%u.xx.%u", ipptr[0], ipptr[1], ipptr[3]); + else + snprintf(str, sizeof(str), "%u.%u.%u.%u", ipptr[0], ipptr[1], ipptr[2], ipptr[3]); return std::string(str); } diff --git a/Core/HLE/proAdhoc.h b/Core/HLE/proAdhoc.h index ded4808f2e..b3594e5a7b 100644 --- a/Core/HLE/proAdhoc.h +++ b/Core/HLE/proAdhoc.h @@ -1014,7 +1014,7 @@ bool isPDPPortInUse(uint16_t port); bool isPTPPortInUse(uint16_t port, bool forListen, SceNetEtherAddr* dstmac = nullptr, uint16_t dstport = 0); // Convert IPv4 address to string (Replacement for inet_ntoa since it's getting deprecated) -std::string ip2str(in_addr in); +std::string ip2str(in_addr in, bool maskPublicIP = true); // Convert MAC address to string std::string mac2str(SceNetEtherAddr* mac);