blob: 0c0395312d0242c646412f554671456a167f27e2 [file] [log] [blame]
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//testing/libfuzzer/fuzzer_test.gni")
import("//net/features.gni")
enable_built_in_dns = !is_ios && !is_proto_quic
source_set("dns") {
# Due to circular dependencies, should only be depended on through //net.
visibility = [ "//net" ]
# Internals only intended for use inside network stack (and tests).
friend = [
"//chrome/browser:test_support",
"//chrome/test/*",
"//components/certificate_transparency:unit_tests",
"//components/cronet/*",
"//net/*",
"//services/network/*",
]
public = []
sources = [
"dns_util.cc",
"dns_util.h",
]
if (!is_nacl) {
sources += [
"address_sorter.h",
"address_sorter_win.cc",
"dns_config.cc",
"dns_config_service.cc",
"dns_config_service.h",
"dns_config_service_win.cc",
"dns_config_service_win.h",
"dns_config_watcher_mac.cc",
"dns_config_watcher_mac.h",
"dns_hosts.cc",
"dns_hosts.h",
"dns_query.cc",
"dns_query.h",
"dns_reloader.cc",
"dns_reloader.h",
"dns_response.cc",
"dns_session.cc",
"dns_session.h",
"dns_socket_pool.cc",
"dns_socket_pool.h",
"dns_transaction.cc",
"host_cache.cc",
"host_resolver.cc",
"host_resolver_impl.cc",
"host_resolver_mdns_task.cc",
"host_resolver_mdns_task.h",
"host_resolver_proc.cc",
"host_resolver_proc.h",
"host_resolver_source.h",
"mapped_host_resolver.cc",
"notify_watcher_mac.cc",
"notify_watcher_mac.h",
"record_parsed.cc",
"record_rdata.cc",
"serial_worker.cc",
"serial_worker.h",
]
if (is_posix || is_fuchsia) {
sources += [ "dns_config_service_posix.cc" ]
if (enable_built_in_dns) {
sources += [
"address_sorter_posix.cc",
"address_sorter_posix.h",
]
}
}
if (enable_built_in_dns) {
sources += [ "dns_client.cc" ]
}
if (enable_mdns) {
sources += [
"mdns_cache.cc",
"mdns_cache.h",
"mdns_client.cc",
"mdns_client_impl.cc",
"mdns_client_impl.h",
]
}
}
deps = [
"//net:net_deps",
]
public_deps = [
":dns_client",
":host_resolver",
":host_resolver_impl",
":mdns_client",
"//net:net_public_deps",
]
allow_circular_includes_from = [
":dns_client",
":host_resolver",
":host_resolver_impl",
":mdns_client",
]
}
# The standard API of net/dns.
#
# Should typically only be used within the network service. Usage external to
# the network service should instead use network service Mojo IPCs for host
# resolution. See ResolveHost() in
# /services/network/public/mojom/network_context.mojom and
# /services/network/public/mojom/host_resolver.mojom.
source_set("host_resolver") {
# Due to circular dependencies, should only be depended on through //net.
# Limit visibility to //net and other source_sets with the same access
# restriction.
visibility = [
":dns",
":host_resolver_impl",
":mdns_client",
"//net",
]
# Whitelist-only access so we can keep track of all usage external to the
# network stack and network service.
friend = [
# chrome/browser/devtools/device/tcp_device_provider.cc
# TODO(crbug.com/874653): Remove once migrated to network service IPC.
#
# chrome/browser/devtools/device/port_forwarding_controller.cc
# TODO(crbug.com/874651): Remove once migrated to network service IPC.
"//chrome/browser/devtools",
# chrome/browser/io_thread.cc
# Used to build in-process HostResolver when network service disabled.
#
# chrome/browser/net/dns_probe_service.cc
# TODO(crbug.com/874660): Remove once migrated to network service IPC.
#
# chrome/browser/net/url_info.h
# chrome/browser/net_benchmarking.cc
# HostResolver only used for deprecated net::Predictor.
# TODO(crbug.com/875238): Remove once deprecated code is removed.
"//chrome/browser",
# chrome/browser/ui/webui/net_internals/net_internals_ui.cc
# TODO(crbug.com/876110): Remove once migrated to network service IPC.
"//chrome/browser/ui",
# chromecast/browser/url_request_context_factory.cc
# URLRequestContext creation for chromecast.
"//chromecast/browser",
# components/network_hints/browser/network_hints_message_filter.cc
# TODO(crbug.com/874654): Remove once migrated to network service IPC.
"//components/network_hints/browser",
# content/public/browser/resource_hints.h
# Deprecated and soon to be removed.
# TODO(crbug.com/875238): Remove once code is removed.
"//content/public/browser:browser_sources",
# headless/lib/browser/headless_url_request_context_getter.cc
# URLRequestContext creation for headless.
"//headless",
# URLRequestContext and HttpNetworkSession::Context creation for iOS.
"//ios/components/io_thread",
"//ios/web/shell",
"//ios/web_view:*",
# Tests and test support.
"//chrome/browser:test_support",
"//chrome/test:browser_tests",
"//components/grpc_support/test:unit_tests",
"//content/shell:content_shell_lib",
# Stand-alone tools.
"//components/sync/tools:*",
"//google_apis/gcm:mcs_probe",
# Network stack/service.
"//components/certificate_transparency/*",
"//components/cronet/*",
"//net/*",
"//services/network/*",
]
sources = []
public = []
if (!is_nacl) {
sources += [
"dns_config.h",
"host_cache.h",
"host_resolver.h",
"mapped_host_resolver.h",
]
}
deps = [
"//net:net_deps",
]
public_deps = [
"//net:net_public_deps",
]
}
# Overridable implementation details of HostResolver.
# TODO(crbug.com/846423): Servicify or remove external usage.
source_set("host_resolver_impl") {
# Due to circular dependencies, should only be depended on through //net.
# Limit visibility to //net and other source_sets with the same access
# restriction.
visibility = [
":dns",
"//net",
]
# Whitelist-only access so we can keep track of all usage external to the
# network stack.
friend = [
"//chromeos",
"//components/cronet/*",
"//net/*",
]
sources = []
public = []
if (!is_nacl) {
sources += [ "host_resolver_impl.h" ]
if (is_posix || is_fuchsia) {
sources += [ "dns_config_service_posix.h" ]
}
}
deps = [
":host_resolver",
"//net:net_deps",
]
public_deps = [
"//net:net_public_deps",
]
}
# DnsClient interfaces. Primarily intended as part of the impelementation of the
# standard HostResolver interface, but can be used as an alternative external
# interface for advanced usage.
# TODO(crbug.com/846423): Figure out what we want to do with these for
# servicification.
source_set("dns_client") {
# Due to circular dependencies, should only be depended on through //net.
# Limit visibility to //net and other source_sets with the same access
# restriction.
visibility = [
":dns",
":mdns_client",
"//net",
]
# Whitelist-only access so we can keep track of all usage external to the
# network stack.
friend = [
"//chrome/browser",
"//chrome/browser:test_support",
"//chrome/browser/chromeos",
"//chrome/test/*",
"//components/certificate_transparency/*",
"//net/*",
"//services/network/*",
]
sources = []
public = []
if (!is_nacl) {
sources += [
"dns_client.h",
"dns_protocol.h",
"dns_response.h",
"dns_transaction.h",
"record_parsed.h",
"record_rdata.h",
]
}
deps = [
"//net:net_deps",
]
public_deps = [
"//net:net_public_deps",
]
}
# MdnsClient interfaces.
# TODO(crbug.com/846423): Figure out what we want to do with these for
# servicification.
source_set("mdns_client") {
# Due to circular dependencies, should only be depended on through //net.
# Limit visibility to //net and other source_sets with the same access
# restriction.
visibility = [
":dns",
"//net",
]
# Whitelist-only access so we can keep track of all usage external to the
# network stack.
friend = [
"//chrome/browser",
"//chrome/browser:test_support",
"//chrome/browser/chromeos",
"//chrome/tools/service_discovery_sniffer",
"//net/*",
]
public = []
sources = []
if (!is_nacl && enable_mdns) {
sources += [ "mdns_client.h" ]
}
deps = [
":dns_client",
":host_resolver",
"//net:net_deps",
]
public_deps = [
"//net:net_public_deps",
]
}
if (enable_net_mojo) {
# A host resolver implementation that forwards resolve requests to a mojo
# service, thus acting as a client library to a servicified host resolver.
# TODO(crbug.com/821021): Decide if this has any place in the generalized
# host resolver servicification.
source_set("mojo_client") {
sources = [
"host_resolver_mojo.cc",
"host_resolver_mojo.h",
]
deps = [
"//base",
"//net",
]
public_deps = [
"//mojo/public/cpp/bindings",
"//net/interfaces",
]
}
# A utility to handle host resolver requests coming into the network service
# via mojo and pass the requests on to the actual host resolver. This utility
# therefore acts as the service side of mojo interactions for host resolver.
# TODO(crbug.com/821021): Decide if this has any place in the generalized
# host resolver servicification.
source_set("mojo_service") {
sources = [
"mojo_host_resolver_impl.cc",
"mojo_host_resolver_impl.h",
]
deps = [
"//base",
"//net",
]
public_deps = [
"//mojo/public/cpp/bindings",
"//net/interfaces",
]
}
}
source_set("tests") {
testonly = true
sources = [
"dns_config_service_unittest.cc",
"dns_config_service_win_unittest.cc",
"dns_hosts_unittest.cc",
"dns_query_unittest.cc",
"dns_response_unittest.cc",
"dns_session_unittest.cc",
"dns_socket_pool_unittest.cc",
"dns_transaction_unittest.cc",
"dns_util_unittest.cc",
"host_cache_unittest.cc",
"host_resolver_impl_unittest.cc",
"mapped_host_resolver_unittest.cc",
"record_parsed_unittest.cc",
"record_rdata_unittest.cc",
"serial_worker_unittest.cc",
]
if (is_posix || is_fuchsia) {
sources += [ "dns_config_service_posix_unittest.cc" ]
}
if (enable_built_in_dns) {
sources += [ "address_sorter_unittest.cc" ]
if (is_posix || is_fuchsia) {
sources += [ "address_sorter_posix_unittest.cc" ]
}
}
if (enable_net_mojo) {
sources += [
"host_resolver_mojo_unittest.cc",
"mojo_host_resolver_impl_unittest.cc",
]
}
if (enable_mdns) {
sources += [
"mdns_cache_unittest.cc",
"mdns_client_unittest.cc",
]
}
deps = [
"//base",
"//net",
"//net:test_support",
"//testing/gmock",
"//testing/gtest",
]
if (enable_net_mojo) {
deps += [
"//net/dns:mojo_client",
"//net/dns:mojo_service",
]
}
}
source_set("test_support") {
testonly = true
sources = [
"dns_test_util.cc",
"mock_host_resolver.cc",
]
public = [
"dns_test_util.h",
"mock_host_resolver.h",
]
if (enable_mdns) {
sources += [
"mock_mdns_client.cc",
"mock_mdns_socket_factory.cc",
]
public += [
"mock_mdns_client.h",
"mock_mdns_socket_factory.h",
]
}
deps = [
"//base",
"//net",
"//testing/gmock",
"//testing/gtest",
]
}
source_set("fuzzer_test_support") {
testonly = true
sources = [
"fuzzed_host_resolver.cc",
"fuzzed_host_resolver.h",
]
deps = [
"//base",
"//base/test:test_support",
"//net",
]
}
fuzzer_test("net_dns_hosts_parse_fuzzer") {
sources = [
"dns_hosts_parse_fuzzer.cc",
]
deps = [
"//base",
"//net",
"//net:net_fuzzer_test_support",
]
dict = "//net/data/fuzzer_dictionaries/net_dns_hosts_parse_fuzzer.dict"
}
fuzzer_test("net_dns_record_fuzzer") {
sources = [
"dns_record_fuzzer.cc",
]
deps = [
"//base",
"//net",
"//net:net_fuzzer_test_support",
]
dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}
fuzzer_test("net_dns_query_parse_fuzzer") {
sources = [
"dns_query_parse_fuzzer.cc",
]
deps = [
"//base",
"//net",
"//net:net_fuzzer_test_support",
]
dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
}
fuzzer_test("net_host_resolver_impl_fuzzer") {
sources = [
"host_resolver_impl_fuzzer.cc",
]
deps = [
"//base",
"//net",
"//net:net_fuzzer_test_support",
"//net:test_support",
]
dict = "//net/data/fuzzer_dictionaries/net_host_resolver_impl_fuzzer.dict"
}