• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

public/H16-Feb-2021-1,280817

BUILD.gnH A D16-Feb-202114.3 KiB589518

DIR_METADATAH A D16-Feb-2021410 1110

OWNERSH A D16-Feb-202122 21

README.mdH A D16-Feb-202116.9 KiB392289

address_info.ccH A D03-May-20225 KiB197145

address_info.hH A D16-Feb-20212.8 KiB10064

address_info_test_util.ccH A D16-Feb-20212.1 KiB7052

address_info_test_util.hH A D16-Feb-2021960 3925

address_info_unittest.ccH A D16-Feb-20217.3 KiB255205

address_sorter.hH A D16-Feb-20211.3 KiB4722

address_sorter_posix.ccH A D03-May-202213.7 KiB414305

address_sorter_posix.hH A D16-Feb-20212.5 KiB9457

address_sorter_posix_unittest.ccH A D16-Feb-202113.3 KiB395330

address_sorter_unittest.ccH A D16-Feb-20211.9 KiB7257

address_sorter_win.ccH A D16-Feb-20214.9 KiB152117

context_host_resolver.ccH A D16-Feb-202111.5 KiB375277

context_host_resolver.hH A D16-Feb-20213.6 KiB10462

context_host_resolver_unittest.ccH A D16-Feb-202130.9 KiB739570

dns_client.ccH A D16-Feb-20219 KiB296216

dns_client.hH A D16-Feb-20214.3 KiB11149

dns_client_unittest.ccH A D16-Feb-202112.2 KiB344276

dns_config.ccH A D16-Feb-20214.7 KiB132103

dns_config.hH A D16-Feb-20214 KiB12154

dns_config_service.ccH A D16-Feb-20214.8 KiB167129

dns_config_service.hH A D16-Feb-20214.4 KiB12659

dns_config_service_fuchsia.ccH A D16-Feb-2021877 3518

dns_config_service_fuchsia.hH A D16-Feb-2021952 3519

dns_config_service_posix.ccH A D03-May-202219.3 KiB595463

dns_config_service_posix.hH A D16-Feb-20212.7 KiB9360

dns_config_service_posix_unittest.ccH A D03-May-20228.4 KiB275211

dns_config_service_unittest.ccH A D16-Feb-20216.7 KiB217164

dns_config_service_win.ccH A D16-Feb-202128.8 KiB814597

dns_config_service_win.hH A D16-Feb-20216.1 KiB17487

dns_config_service_win_unittest.ccH A D16-Feb-202116.5 KiB504443

dns_config_watcher_mac.ccH A D16-Feb-20213.2 KiB10780

dns_config_watcher_mac.hH A D16-Feb-2021850 3217

dns_hosts.ccH A D16-Feb-20215.9 KiB215151

dns_hosts.hH A D16-Feb-20212.5 KiB7835

dns_hosts_parse_fuzzer.ccH A D16-Feb-2021763 2314

dns_hosts_unittest.ccH A D16-Feb-20215.8 KiB185152

dns_parse_domain_ascii_win_fuzzer.ccH A D16-Feb-2021785 2916

dns_query.ccH A D16-Feb-20219.2 KiB280205

dns_query.hH A D16-Feb-20214 KiB12454

dns_query_parse_fuzzer.ccH A D16-Feb-2021591 2112

dns_query_unittest.ccH A D16-Feb-202110.1 KiB293235

dns_record_fuzzer.ccH A D16-Feb-20211.2 KiB4932

dns_reloader.ccH A D03-May-20223.9 KiB12063

dns_reloader.hH A D16-Feb-2021758 2410

dns_response.ccH A D16-Feb-202120 KiB634486

dns_response.hH A D16-Feb-20218.7 KiB244118

dns_response_fuzzer.ccH A D16-Feb-20211.2 KiB3725

dns_response_unittest.ccH A D16-Feb-202148.4 KiB1,2751,035

dns_server_iterator.ccH A D16-Feb-20215.8 KiB163103

dns_server_iterator.hH A D16-Feb-20215.9 KiB15879

dns_session.ccH A D16-Feb-20211.4 KiB4733

dns_session.hH A D16-Feb-20212.3 KiB8046

dns_socket_allocator.ccH A D16-Feb-20212.6 KiB8055

dns_socket_allocator.hH A D16-Feb-20211.7 KiB5533

dns_socket_allocator_unittest.ccH A D16-Feb-20212.7 KiB8359

dns_test_util.ccH A D16-Feb-202123.9 KiB725581

dns_test_util.hH A D16-Feb-202117.6 KiB444327

dns_transaction.ccH A D16-Feb-202156.6 KiB1,6881,325

dns_transaction.hH A D16-Feb-20215.4 KiB14660

dns_transaction_unittest.ccH A D16-Feb-2021162.2 KiB3,8773,034

dns_udp_tracker.ccH A D16-Feb-20216.5 KiB206153

dns_udp_tracker.hH A D16-Feb-20212.8 KiB8644

dns_udp_tracker_unittest.ccH A D16-Feb-20215.5 KiB190137

dns_util.ccH A D03-May-202211.9 KiB398330

dns_util.hH A D16-Feb-20216.9 KiB16672

dns_util_unittest.ccH A D16-Feb-202120.8 KiB526404

fuzzed_host_resolver_util.ccH A D16-Feb-202115.9 KiB446333

fuzzed_host_resolver_util.hH A D16-Feb-20211.6 KiB4715

host_cache.ccH A D16-Feb-202129.7 KiB881687

host_cache.hH A D16-Feb-202115.8 KiB432259

host_cache_fuzzer.ccH A D16-Feb-20211.9 KiB5529

host_cache_unittest.ccH A D16-Feb-202154.4 KiB1,5151,083

host_resolver.ccH A D16-Feb-20218.1 KiB270199

host_resolver.hH A D16-Feb-202115.6 KiB387157

host_resolver_manager.ccH A D16-Feb-2021144.7 KiB3,9952,916

host_resolver_manager.hH A D16-Feb-202121.8 KiB538252

host_resolver_manager_fuzzer.ccH A D16-Feb-20219.2 KiB272199

host_resolver_manager_unittest.ccH A D16-Feb-2021459.4 KiB10,6518,036

host_resolver_mdns_listener_impl.ccH A D16-Feb-20213.5 KiB11184

host_resolver_mdns_listener_impl.hH A D16-Feb-20212 KiB6743

host_resolver_mdns_task.ccH A D16-Feb-20219.4 KiB274200

host_resolver_mdns_task.hH A D16-Feb-20212.1 KiB7442

host_resolver_proc.ccH A D03-May-20227.8 KiB236150

host_resolver_proc.hH A D16-Feb-20216 KiB15870

host_resolver_source.hH A D16-Feb-20211.5 KiB5122

https_record_rdata.ccH A D16-Feb-202114.1 KiB485382

https_record_rdata.hH A D16-Feb-20215.2 KiB153108

https_record_rdata_fuzzer.ccH A D16-Feb-20212.6 KiB8962

https_record_rdata_unittest.ccH A D16-Feb-20216.9 KiB203149

httpssvc_metrics.ccH A D16-Feb-202113.5 KiB367260

httpssvc_metrics.hH A D16-Feb-20214.3 KiB12480

httpssvc_metrics_unittest.ccH A D16-Feb-202135.2 KiB847657

integrity_record_fuzzer.ccH A D16-Feb-20212.5 KiB7246

mapped_host_resolver.ccH A D16-Feb-20211.8 KiB6444

mapped_host_resolver.hH A D16-Feb-20212.5 KiB7439

mapped_host_resolver_unittest.ccH A D16-Feb-20219.7 KiB248174

mdns_cache.ccH A D16-Feb-20215.8 KiB201142

mdns_cache.hH A D16-Feb-20214.1 KiB12666

mdns_cache_unittest.ccH A D16-Feb-202117 KiB450321

mdns_client.ccH A D16-Feb-20212.5 KiB8462

mdns_client.hH A D16-Feb-20217.5 KiB21396

mdns_client_impl.ccH A D16-Feb-202123.2 KiB766587

mdns_client_impl.hH A D16-Feb-202110.4 KiB355223

mdns_client_unittest.ccH A D16-Feb-202153 KiB1,4861,080

mock_host_resolver.ccH A D16-Feb-202136.5 KiB1,104875

mock_host_resolver.hH A D16-Feb-202119.8 KiB537299

mock_mdns_client.ccH A D16-Feb-2021444 187

mock_mdns_client.hH A D16-Feb-20211.4 KiB4935

mock_mdns_socket_factory.ccH A D16-Feb-20214.2 KiB133104

mock_mdns_socket_factory.hH A D16-Feb-20214.4 KiB13895

notify_watcher_mac.ccH A D16-Feb-20212.2 KiB8664

notify_watcher_mac.hH A D16-Feb-20211.4 KiB5024

record_parsed.ccH A D16-Feb-20213.2 KiB10684

record_parsed.hH A D16-Feb-20212.1 KiB7845

record_parsed_unittest.ccH A D16-Feb-20215.7 KiB176120

record_rdata.ccH A D16-Feb-202115.3 KiB493342

record_rdata.hH A D16-Feb-202110.7 KiB351204

record_rdata_unittest.ccH A D16-Feb-202116.6 KiB459328

resolve_context.ccH A D16-Feb-202119.1 KiB545398

resolve_context.hH A D16-Feb-202111.6 KiB280133

resolve_context_unittest.ccH A D16-Feb-202155.6 KiB1,3261,017

serial_worker.ccH A D16-Feb-20212.2 KiB7759

serial_worker.hH A D16-Feb-20212.7 KiB8739

serial_worker_unittest.ccH A D16-Feb-20214.9 KiB180127

system_dns_config_change_notifier.ccH A D16-Feb-20217.3 KiB227158

system_dns_config_change_notifier.hH A D16-Feb-20213.3 KiB8734

system_dns_config_change_notifier_unittest.ccH A D16-Feb-202110.9 KiB329238

test_dns_config_service.ccH A D16-Feb-2021683 2716

test_dns_config_service.hH A D16-Feb-20211.4 KiB5734

README.md

1# Chrome Host Resolution
2
3Implementation and support of host resolution for the Chrome network stack.
4Includes client implementations of host resolution protocols (DNS and mDNS),
5host resolution caching, support for dealing with system host resolution
6(including reading HOSTS files and tracking system network settings related to
7host resolution), and various related utilities.
8
9*** promo
10Note: "DNS" in this directory (including the directory name) is often used as
11shorthand for all host resolution, not just that using the Domain Name System.
12This document attempts to use "DNS" only to refer to the actual Domain Name
13System, except when referring to strings or paths that contain other usage of
14"DNS".
15***
16
17[TOC]
18
19## Usage
20
21### From outside the network service
22
23Most interaction with host resolution should be through the [network service](/services/network/README.md)
24[`network::HostResolver`](/services/network/public/mojom/host_resolver.mojom),
25retrieved from [`network::NetworkContext`](/services/network/public/mojom/network_context.mojom)
26using `network::NetworkContext::CreateHostResolver()`.
27
28Host resolution is requested using `network::HostResolver::ResolveHost()`. There
29is also a shortcut using `network::NetworkContext::ResolveHost()` when a
30separate passable object is not needed.
31
32Some general utilities are also available in [`/net/dns/public/`](/net/dns/public/)
33that are intended for use by any code, inside or outside the network service.
34Otherwise, code outside the network service should never interact directly with
35the code in [`/net/dns/`](/net/dns/).
36
37### From inside the network service
38
39Inside the network service or inside the Chrome networking stack, host
40resolution goes through [`net::HostResolver`](/net/dns/host_resolver.h),
41retrieved from [`net::URLRequestContext`](/net/url_request/url_request_context.h).
42
43### Stand-alone tools
44
45Tests and stand-alone tools not part of the browser may interact with host
46resolution directly by creating their own HostResolvers using
47`net::HostResolver::CreateStandaloneResolver()`.
48
49## Test support
50
51### MockHostResolver
52
53[`net::MockHostResolver`](/net/dns/mock_host_resolver.h)
54
55Tests with the ability to inject and replace the used `net::HostResolver` should
56replace it with a `net::MockHostResolver`, allowing rule-based results.
57`net::MockCachingHostResolver` is the same except it includes basic support for
58the caching functionality normally done by prod `net::HostResolver`s.
59
60Some tests may also find `net::HangingHostResolver` useful. It will begin host
61resolution requests, but never complete them until cancellation.
62
63### TestHostResolver
64
65[`content::TestHostResolver`](/content/public/test/test_host_resolver.h)
66
67Used by most browser tests (via [`content::BrowserTestBase`](/content/public/test/browser_test_base.h)),
68`content::TestHostResolver` installs itself on creation globally into all host
69resolvers in the process. By default, only allows resolution of the local host
70and returns `net::ERR_NOT_IMPLEMENTED` for other hostnames. Allows setting rules
71for other results using a [net::RuleBasedHostResolverProc](/net/dns/mock_host_resolver.h).
72
73*** note
74**Warning:** `content::TestHostResolver` only replaces host address resolution
75to the system and then artificially uses such system resolution for many
76requests that would normally be handled differently (e.g. using the built-in DNS
77client). This means a significant amount of normal prod host resolution logic
78will be bypassed in tests using `content::TestHostResolver`.
79***
80
81### Request remapping
82
83Most prod logic for creating HostResolvers will check if any global remappings
84have been requested. In the browser, this is requested using the
85["host-resolver-rules"](/services/network/public/cpp/network_switches.h)
86commandline flag.
87
88See [`net::HostMappingRules`](/net/base/host_mapping_rules.h) for details on the
89format of the rules string. Allows remapping any request hostname to another
90hostname, an IP address, or a NOTFOUND error.
91
92## Implementation
93
94### HostResolver
95
96[`net::HostResolver`](/net/dns/host_resolver.h)
97
98The main interface for requesting host resolution within the network stack or
99network service. In prod, generally owned, and retrieved as-needed from
100[`net::URLRequestContext`](/net/url_request/url_request_context.h)s. Created
101using `net::HostResolver::CreateResolver()` or
102`net::HostResolver::CreateStandaloneResolver()`.
103
104Various implementations are used in prod.
105
106#### ContextHostResolver
107
108[`net::ContextHostResolver`](/net/dns/context_host_resolver.h)
109
110The main prod implementation of `net::HostResolver`. Expected to be owned 1:1 by
111a single `net::URLRequestContext`, the `net::ContextHostResolver` owns or keeps
112references to per-URLRequestContext properties used for host resolution,
113including an owned [`net::HostCache`](/net/dns/host_cache.h).
114
115On resolution, calls into an underlying `net::HostResolverManager` with the per-
116context properties.
117
118On destruction, silently cancels all host resolution requests made through the
119`net::ContextHostResolver` instance. This prevents the underlying
120`net::HostResolverManager` from continuing to reference the per-context
121properties that may be destroyed on destruction of the `net::URLRequestContext`
122or `net::ContextHostResolver`.
123
124#### MappedHostResolver
125
126[`net::MappedHostResolver`](/net/dns/mapped_host_resolver.h)
127
128A wrapping implementation around another `net::HostResolver`. Maintains request
129remapping rules to remap request hostnames to other hostnames or IP addresses.
130
131Used to implement the ["host-resolver-rules"](/services/network/public/cpp/network_switches.h)
132commandline flag.
133
134#### StaleHostResolver
135
136[`cronet::StaleHostResolver`](/components/cronet/stale_host_resolver.h)
137
138A wrapping implementation around another `net::HostResolver`. Returns stale
139(expired or invalidated by network changes) data from the `net::HostCache` when
140non-stale results take longer than a configurable timeout. Reduces host
141resolution latency at the expense of accuracy.
142
143Only used and created by [Cronet](/components/cronet/README.md).
144
145### HostResolverManager
146
147[`net::HostResolverManager`](/net/dns/host_resolver_manager.h)
148
149Scheduler and controller of host resolution requests. Contains the logic for
150immediate host resolution from fast local sources (e.g. querying
151`net::HostCache`s, IP address literals, etc). Throttles, schedules, and merges
152asynchronous jobs for resolution from slower network sources.
153
154On destruction, silently cancels all in-progress host resolution requests.
155
156In prod, a single shared `net::HostResolverManager` is generally used for the
157entire browser. The shared manager is owned and configured by the
158[`network::NetworkService`](/services/network/network_service.h).
159
160#### Request
161
162`net::HostResolverManager::RequestImpl`
163
164Implementation of [`net::HostResolver::ResolveHostRequest`](/net/dns/host_resolver.h)
165and overall representation of a single request for resolution from a
166`net::HostResolverManager`. The `RequestImpl` object itself primarily acts only
167as a container of parameters and results for the request, leaving the actual
168logic to the `net::HostResolverManager` itself.
169
170Data collected at this layer:
171
172* "Net.DNS.Request.TotalTime" (recommended for experiments)
173* "Net.DNS.Request.TotalTimeAsync"
174
175#### Job
176
177`net::HostResolverManager::Job`
178
179Representation of an asynchronous job for resolution from slower network
180sources. Contains the logic to determine and query the appropriate source for
181host resolution results with retry and fallback support to other sources. On
182completion adds results to relevant `net::HostCache`s and invokes request
183callbacks.
184
185Multiple requests can be merged into a single Job if compatible. This includes
186merging newly-started Jobs with already-running Jobs.
187
188`net::HostResolverManager` schedules and throttles running
189`net::HostResolverManager::Job`s using a [`net::PrioritizedDispatcher`](/net/base/prioritized_dispatcher.h).
190The throttling is important to avoid overworking network sources, especially
191poorly designed home routers that may crash on only a small number of concurrent
192DNS resolves.
193
194Data collected at this layer:
195
196* "Net.DNS.ResolveSuccessTime"
197* "Net.DNS.ResolveFailureTime"
198* "Net.DNS.ResolveCategory"
199* "Net.DNS.ResolveError.Fast"
200* "Net.DNS.ResolveError.Slow"
201* "Net.DNS.SecureDnsMode.[Off/Automatic/Secure].ResolveTime"
202
203### Host resolution sources
204
205Various sources are used to query host resolution. The sources to be used by a
206`net::HostResolverManager::Job` are determined in advance of running the Job by
207`net::HostResolverManager::CreateTaskSequence()`, which outputs a list of
208`net::HostResolverManager::TaskType` specifying the order of sources to attempt.
209By default, this will use internal logic to decide the source to use and will
210often allow fallback to additional sources.
211
212The sources chosen by default are also affected by the Secure DNS mode, by
213default determined from
214[`net::DnsConfig::secure_dns_mode`](/net/dns/dns_config.h) but overridable for
215individual requests using
216`net::HostResolver::ResolveHostParameters::secure_dns_mode_override`.
217
218Specific sources for a request can be
219specified using `net::HostResolver::ResolveHostParameters::source` and
220[`net::HostResolverSource`](/net/dns/host_resolver_source.h).
221
222The Job will then use *Task objects that implement the behavior specific to the
223particular resolution sources.
224
225#### SYSTEM
226
227`net::HostResolverSource::SYSTEM`
228`net::HostResolverManager::TaskType::PROC`
229
230Implemented by: `net::HostResolverManager::ProcTask`
231
232Usually called the "system resolver" or sometimes the "proc resolver". Results
233are queried from the system or OS using the `getaddrinfo()` OS API call. This
234source is only capable of address (A and AAAA) resolves but will also query for
235canonname info if the request includes the `HOST_RESOLVER_CANONNAME` flag. The
236system will query from its own internal cache, HOSTS files, DNS, and sometimes
237mDNS, depending on the capabilities of the system.
238
239When host resolution requests do not specify a source, the system resolver will
240always be used for **address resolves** when **any** of the following are true:
241
242* Requests with the `HOST_RESOLVER_CANONNAME` flag
243* For hostnames ending in ".local"
244* When the Secure DNS mode is `net::SecureDnsMode::OFF` and
245  `net::HostResolverSource::DNS` is not enabled via
246  `net::HostResolverManager::SetInsecureDnsClientEnabled(true)`
247* When a system DNS configuration could not be determined
248
249Secure DNS requests cannot be made using the system resolver.
250
251`net::HostResolverManager::ProcTask` uses a blocking
252[`base::TaskRunner`](/base/task_runner.h) to make blocking resolution requests.
253On a timeout, additional attempts are made, but previous attempts are not
254cancelled as there is no cancellation mechanism for `getaddrinfo()`. The first
255attempt to complete is used and any other attempt completions are ignored.
256
257Each attempt calls [`net::HostResolverProc`](/net/dns/host_resolver_proc.h). In
258prod, this is always implemented by a `net::SystemHostResolverProc`, which makes
259the actual call to `getaddrinfo()` using the
260[`net::AddressInfo`](/net/dns/address_info.h) helper, but in tests, the
261`net::HostResolverProc` may be replaced by a chain of test implementations to
262override behavior.
263
264Data collected specifically for this source:
265
266* "Net.DNS.SecureDnsTaskFailure.FallbackProcTask.Error"
267
268#### DNS
269
270`net::HostResolverSource::DNS`
271`net::HostResolverManager::TaskType::DNS`
272`net::HostResolverManager::TaskType::SECURE_DNS`
273
274Implemented by: `net::HostResolverManager::DnsTask`
275
276Usually called the "built-in resolver" or the "async resolver". Results are
277queried from DNS using [`net::DnsClient`](/net/dns/dns_client.h), a Chrome
278network stack implementation of a DNS "stub resolver" or "DNS client".
279
280When host resolution requests do not specify a source, the built-in resolver
281will be used when **all** of the following are true:
282
283* DnsClient is enabled for insecure requests enabled via
284  `net::HostResolverManager::SetInsecureDnsClientEnabled(true)` or
285  the Secure DNS mode is not `net::SecureDnsMode::OFF`.
286* The system DNS configuration could be determined successfully
287* The request hostname does not end in ".local"
288* The request is not an address query with the `HOST_RESOLVER_CANONNAME` flag
289
290The `net::HostResolverManager::DnsTask` will create and run a
291[`net::DnsTransaction`](/net/dns/dns_transaction.h) for each DNS name/type pair
292to be queried. The task will then process successful results from the returned
293[`net::DnsResponse`](/net/dns/dns_response.h).
294
295When a request requires both A and AAAA results, they are handled via two
296separate `net::DnsTransaction`s and the `net::HostResolverManager::DnsTask` will
297request a second slots from the `net::PrioritizedDispatcher` used by
298`net::HostResolverManager`. The A transaction is started immediately on starting
299the `net::HostResolverManager::DnsTask`, and the AAAA transaction is started
300once a second dispatcher slot can be obtained.
301
302Each `net::DnsTransaction` internally makes a series of `net::DnsAttempt`s, each
303representing an individual DNS request. A single `net::DnsTransaction` can run
304many `net::DnsAttempt`s due to retry logic, fallback between multiple configured
305DNS servers, and name permutation due to configured search suffixes.
306
307Data collected specifically for this source (more internally to
308`net::DnsTransaction` implementation not listed here):
309
310* "Net.DNS.DnsTask.ErrorBeforeFallback.Fast"
311* "Net.DNS.DnsTask.ErrorBeforeFallback.Slow"
312* "Net.DNS.DnsTask.SuccessTime"
313* "Net.DNS.InsecureDnsTask.FailureTime"
314* "Net.DNS.JobQueueTime.PerTransaction"
315* "Net.DNS.JobQueueTime.Failure"
316* "Net.DNS.JobQueueTime.Success"
317* "Net.DNS.SecureDnsTask.DnsModeSecure.FailureTime"
318* "Net.DNS.SecureDnsTask.DnsModeAutomatic.FailureTime"
319* "Net.DNS.SecureDnsTask.ErrorBeforeFallback.Fast"
320* "Net.DNS.SecureDnsTask.ErrorBeforeFallback.Slow"
321* "Net.DNS.SecureDnsTaskFailure.FallbackDnsTask.Error"
322
323#### MULTICAST_DNS
324
325`net::HostResolverSource::MULTICAST_DNS`
326`net::HostResolverManager::TaskType::MDNS`
327
328Implemented by [`net::HostResolverMdnsTask`](/net/dns/host_resolver_mdns_task.h)
329
330Results are queried from mDNS using [`net::MDnsClient`](/net/dns/mdns_client.h).
331
332When host resolution requests do not specify a source, mDNS is only used for
333non-address requests when the request hostname ends in ".local".
334
335mDNS requests start with [`net::HostResolverMdnsTask`](/net/dns/host_resolver_mdns_task.h),
336which will create and run a [`net::MDnsTransaction`](/net/dns/mdns_client.h) for
337each query type needed.
338
339Unlike `net::HostResolverManager::DnsTask`, each `net::HostResolverMdnsTask`
340will only ever use a single dispatcher slot, even when both A and AAAA types are
341queried concurrently.
342
343`net::MDnsClient` maintains its own cache, separate from the main
344[`net::HostCache`](/net/dns/host_cache.h) owned by the
345[`net::ContextHostResolver`](/net/dns/context_host_resolver.h). As such, mDNS
346results are never cached in the `net::HostCache`.
347
348### IPv6 and connectivity
349
350Some poorly written DNS servers, especially on home routers, are unaware of the
351existence of IPv6 and will result in bad performance or even crash when sent
352AAAA DNS queries.
353
354To avoid such issues, `net::HostResolverManager` heuristically detects IPv4-only
355networks by attempting a UDP connection to `2001:4860:4860::8888` (the IPv6
356address for Google Public DNS). If the connection fails, Chrome will convert
357host resolution requests for `net::DnsQueryType::UNSPECIFIED` to
358`net::DnsQueryType::A`. This generally results in disallowing AAAA requests.
359
360Exceptions when AAAA requests are always allowed despite a failed connectivity
361check:
362
363* The host resolution request explicitly requests `net::DnsQueryType::AAAA`
364* IP address literal resolution including when a hostname request has been
365  rewritten to an IP address literal using `net::MappedHostResolver`
366* Results read from HOSTS files where there is no non-loopback IPv4 result. Note
367  that this exception only applies when Chrome does the read from HOSTS. When
368  Chrome's built-in DNS client is not used, HOSTS is only read by the system
369  where Chrome would only request A results to avoid the system making AAAA DNS
370  queries.
371
372The heuristic for detecting IPv4-only networks is not perfect. E.g., it fails
373and disallows AAAA requests in private (no global internet access including to
374Google Public DNS) IPv6-only networks, which could then break most Chrome usage
375on the network because, being an IPv6-only network, AAAA results are necessary.
376
377Workarounds to allow Chrome to attempt to load IPv6 endpoints when the
378connectivity check fails:
379
380* Starting Chrome with
381  `--host-resolver-rules="MAP the.hostname.com [dead::beef]"` where
382  `the.hostname.com` is the hostname to allow resolving and `dead::beef` is the
383  IPv6 address to resolve it to. `net::MappedHostResolver` acts at a level
384  before IPv6 connectivity checks, and if a hostname is remapped to an IP
385  literal, connectivity checks do not apply.
386* Add entries for the hostnames to resolve to the HOSTS file with just IPv6
387  results.  Only works with the built-in DNS client is used.
388* Add a network route to `2001:4860:4860::8888`. Doesn't have to actually be
389  functional (could just drop requests to it).  As long as Chrome can connect a
390  UDP socket to the address, it will pass the heuristic checking
391  IPv6-connectivity.
392