mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-18 11:54:30 +01:00
Merge pull request #15625 from ANR2ME/adhoc
Mask some part of public IP in the logs for security reason.
This commit is contained in:
2 files changed
+6
-3
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user