commit | 1aede8135e8a227e127f826f38073eba7447c382 | [log] [tgz] |
---|---|---|
author | Mike Yu <yumike@google.com> | Tue May 11 14:49:30 2021 +0800 |
committer | Mike Yu <yumike@google.com> | Sat Jun 05 23:30:45 2021 +0800 |
tree | 7359b314bb0e92d2e78b49598ffe96afd38b98a7 | |
parent | 8d636aebd52fca96b732a44792a1918cd9ac0143 [diff] |
Support evaluating private DNS by latency The evaluation is limited to opportunistic mode and is implemented as a flag-off feature. It is introduced to avoid from using high latency private DNS servers. The latency of a server is considered high if it's higher than a latency threshold which is calculated based on the average latency of cleartext DNS server: latency threshold = std::clamp(3 * mean_do53_latency_ms, min_private_dns_latency_threshold_ms, max_private_dns_latency_threshold_ms) , where min_private_dns_latency_threshold_ms is 500 ms by default and max_private_dns_latency_threshold_ms is 2000 ms by default. If there's no Do53 average latency for reference, the latency threshold is min_private_dns_latency_threshold_ms. The evaluation of a private DNS server works in two phases. Phase 1: In this phase, Private DNS Validation is being performed, and the server is not considered validated. The server latency is evaluated by sending a probe. If the latency is lower than a the latency threshold, the server state is transitioned to Validation::success. The evaluation goes to phase 2. Phase 2: In this phase, the server is considered validated and DnsResolver can send DNS queries to the server. The server latency is evaluated by the query response time, and the same latency threshold is used. If there are several, 10 by default, query response time failed to meet the time threshold in a row, the server state is transitioned to Validation::in_process. The evaluation goes to phase 1. Bug: 188153519 Test: run atest with all the flags off/on avoid_bad_private_dns: 0 / 1 sort_nameservers: 0 / 1 dot_xport_unusable_threshold: -1 / 20 dot_query_timeout_ms: -1 / 10000 min_private_dns_latency_threshold_ms: -1 / 500 keep_listening_udp: 0 / 1 parallel_lookup_sleep_time: 2 / 2 dot_revalidation_threshold: -1 / 10 max_private_dns_latency_threshold_ms: -1 / 2000 dot_async_handshake: 0 / 1 dot_maxtries: 3 / 1 dot_connect_timeout_ms: 127000 / 10000 parallel_lookup_release: UNSET / UNSET Change-Id: Ib681b1ea1417eadac9c013f19549a9fa7c408696
This code uses LOG(X) for logging. Log levels are VERBOSE,DEBUG,INFO,WARNING and ERROR. The default setting is WARNING and logs relate to WARNING and ERROR will be shown. If you want to enable the DEBUG level logs, using following command. adb shell service call dnsresolver 10 i32 1 VERBOSE 0 DEBUG 1 INFO 2 WARNING 3 ERROR 4 Verbose resolver logs could contain PII -- do NOT enable in production builds.