diff options
author | Yuyang Huang <yuyanghuang@google.com> | 2024-01-04 13:10:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2024-01-04 13:10:00 +0000 |
commit | 681ef1d9c36499b869ead0b13ff2d4f6fa0f3678 (patch) | |
tree | c09018bf590f02ff20d5c47dc3f65132de0cbcb7 | |
parent | 570c65e41e35ec331b66d2b8e350974eace0d4e0 (diff) | |
parent | 40c47da2001fcc0c22b59dff28d222d19ae609b0 (diff) | |
download | netd-681ef1d9c36499b869ead0b13ff2d4f6fa0f3678.tar.gz |
Merge "Fix IPV4/6 privacy leak" into main
-rw-r--r-- | server/SockDiag.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/server/SockDiag.cpp b/server/SockDiag.cpp index 49ca8d71..ef3a840b 100644 --- a/server/SockDiag.cpp +++ b/server/SockDiag.cpp @@ -55,6 +55,8 @@ using netdutils::Stopwatch; namespace net { namespace { +static const bool isUser = (android::base::GetProperty("ro.build.type", "") == "user"); + int getAdbPort() { return android::base::GetIntProperty("service.adb.tcp.port", 0); } @@ -335,18 +337,20 @@ int SockDiag::destroySockets(const char* addrstr, int ifindex) { if (!strchr(addrstr, ':')) { // inet_ntop never returns something like ::ffff:192.0.2.1 if (int ret = destroySockets(IPPROTO_TCP, AF_INET, addrstr, ifindex)) { - ALOGE("Failed to destroy IPv4 sockets on %s: %s", where.c_str(), strerror(-ret)); + ALOGE("Failed to destroy IPv4 sockets on %s: %s", + (isUser ? "[hidden: user build]" : where.c_str()), strerror(-ret)); return ret; } } if (int ret = destroySockets(IPPROTO_TCP, AF_INET6, addrstr, ifindex)) { - ALOGE("Failed to destroy IPv6 sockets on %s: %s", where.c_str(), strerror(-ret)); + ALOGE("Failed to destroy IPv6 sockets on %s: %s", + (isUser ? "[hidden: user build]" : where.c_str()), strerror(-ret)); return ret; } if (mSocketsDestroyed > 0) { - ALOGI("Destroyed %d sockets on %s in %" PRId64 "us", mSocketsDestroyed, where.c_str(), - s.timeTakenUs()); + ALOGI("Destroyed %d sockets on %s in %" PRId64 "us", mSocketsDestroyed, + (isUser ? "[hidden: user build]" : where.c_str()), s.timeTakenUs()); } return mSocketsDestroyed; |