From 939e3690aeb0142679678313a74bf024cfba7129 Mon Sep 17 00:00:00 2001 From: Mike Yu Date: Tue, 29 Oct 2019 17:28:34 +0800 Subject: Log DNS resolved answers Introduce a thread-safe queue, DnsQueryLog, to log the DNS resolved answers which are not found in the cache. The sensitive data is masked in order not to reveal privacy information. The log can be shown only by "dumpsys dnsresolver querylog", and it can show only the most-recent-one-hour queries. Example output: DNS query log (last 60 minutes): time=17:27:09.262 netId=100 uid=10107 pid=3322 hostname=w*** answer=[2404:***, 216.***] (33ms) time=17:27:14.303 netId=100 uid=10097 pid=3363 hostname=w*** answer=[13.***] (21ms) Bug: 139040977 Test: cd packages/modules/DnsResolver && atest Test: "adb shell dumpsys dnsresolver querylog" passed Change-Id: I8d063f4ac920f41c4fbc77e60a3e3a919d9daa62 --- Android.bp | 1 + 1 file changed, 1 insertion(+) (limited to 'Android.bp') diff --git a/Android.bp b/Android.bp index 735902b0..50d5dabe 100644 --- a/Android.bp +++ b/Android.bp @@ -60,6 +60,7 @@ cc_library { "util.cpp", "Dns64Configuration.cpp", "DnsProxyListener.cpp", + "DnsQueryLog.cpp", "DnsResolver.cpp", "DnsResolverService.cpp", "DnsStats.cpp", -- cgit v1.2.3