mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Mask some part of public IP in the logs for security reason.
This commit is contained in:
parent
4b78224d22
commit
ea6e5c8f74
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user