Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e74c751f authored by Ken Chen's avatar Ken Chen
Browse files

Add trace for GetHostByName and GetHostByAddr

Like GetAddrInfo and ResNSend, GetHostByName and GetHostByAddr should
print the caller uid so that we can know which app is flooding DNS
queries.

Bug: 246102271
Test: run ResolverTest#GetHostByAddr_ReverseDns64Query,
      ResolverTest#GetHostByName and check resolver logs.
Change-Id: Id81f952836facec66c0f4ab86c1d9d384962a23e
parent 8b815120
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1243,6 +1243,9 @@ void DnsProxyListener::GetHostByNameHandler::doDns64Synthesis(int32_t* rv, hoste
}

void DnsProxyListener::GetHostByNameHandler::run() {
    LOG(INFO) << "GetHostByNameHandler::run: {" << mNetContext.app_netid << " "
              << mNetContext.app_mark << " " << mNetContext.dns_netid << " " << mNetContext.dns_mark
              << " " << mNetContext.uid << " " << mNetContext.flags << "}";
    Stopwatch s;
    maybeFixupNetContext(&mNetContext, mClient->getPid());
    const uid_t uid = mClient->getUid();
@@ -1404,6 +1407,9 @@ void DnsProxyListener::GetHostByAddrHandler::doDns64ReverseLookup(hostent* hbuf,
}

void DnsProxyListener::GetHostByAddrHandler::run() {
    LOG(INFO) << "GetHostByAddrHandler::run: {" << mNetContext.app_netid << " "
              << mNetContext.app_mark << " " << mNetContext.dns_netid << " " << mNetContext.dns_mark
              << " " << mNetContext.uid << " " << mNetContext.flags << "}";
    Stopwatch s;
    maybeFixupNetContext(&mNetContext, mClient->getPid());
    const uid_t uid = mClient->getUid();