123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612 |
- # 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("//net/features.gni")
- import("//testing/libfuzzer/fuzzer_test.gni")
- import("//third_party/protobuf/proto_library.gni")
- enable_built_in_dns = !is_ios
- source_set("dns") {
- # Due to circular dependencies, should only be depended on through //net.
- visibility = [
- "//net",
- "//net/http:transport_security_state_generated_files",
- ]
- # 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 = [
- "address_info.cc",
- "address_info.h",
- "address_sorter.h",
- "context_host_resolver.cc",
- "context_host_resolver.h",
- "dns_alias_utility.cc",
- "dns_alias_utility.h",
- "dns_config.cc",
- "dns_config_service.cc",
- "dns_config_service.h",
- "dns_hosts.cc",
- "dns_hosts.h",
- "dns_query.cc",
- "dns_query.h",
- "dns_reloader.cc",
- "dns_reloader.h",
- "dns_response.cc",
- "dns_response_result_extractor.cc",
- "dns_response_result_extractor.h",
- "dns_server_iterator.cc",
- "dns_server_iterator.h",
- "dns_session.cc",
- "dns_session.h",
- "dns_transaction.cc",
- "dns_udp_tracker.cc",
- "dns_udp_tracker.h",
- "dns_util.cc",
- "dns_util.h",
- "host_cache.cc",
- "host_resolver.cc",
- "host_resolver_manager.cc",
- "host_resolver_mdns_listener_impl.cc",
- "host_resolver_mdns_listener_impl.h",
- "host_resolver_mdns_task.cc",
- "host_resolver_mdns_task.h",
- "host_resolver_proc.cc",
- "host_resolver_proc.h",
- "host_resolver_results.cc",
- "https_record_rdata.cc",
- "httpssvc_metrics.cc",
- "httpssvc_metrics.h",
- "mapped_host_resolver.cc",
- "nsswitch_reader.cc",
- "nsswitch_reader.h",
- "opt_record_rdata.cc",
- "record_parsed.cc",
- "record_rdata.cc",
- "resolve_context.cc",
- "resolve_context.h",
- "serial_worker.cc",
- "serial_worker.h",
- "system_dns_config_change_notifier.cc",
- "system_dns_config_change_notifier.h",
- "test_dns_config_service.cc",
- "test_dns_config_service.h",
- ]
- if (is_win) {
- sources += [
- "address_sorter_win.cc",
- "dns_config_service_win.cc",
- "dns_config_service_win.h",
- ]
- }
- if (is_mac) {
- sources += [
- "dns_config_watcher_mac.cc",
- "dns_config_watcher_mac.h",
- "notify_watcher_mac.cc",
- "notify_watcher_mac.h",
- ]
- }
- if (is_fuchsia) {
- sources += [
- "dns_config_service_fuchsia.cc",
- "dns_config_service_fuchsia.h",
- ]
- }
- if (is_android) {
- sources += [
- "dns_config_service_android.cc",
- "dns_config_service_android.h",
- ]
- } else if (is_linux) {
- sources += [
- "dns_config_service_linux.cc",
- "dns_config_service_linux.h",
- ]
- } else if (is_posix) {
- sources += [
- "dns_config_service_posix.cc",
- "dns_config_service_posix.h",
- ]
- }
- if (enable_built_in_dns) {
- sources += [ "dns_client.cc" ]
- if (is_posix || is_fuchsia) {
- sources += [
- "address_sorter_posix.cc",
- "address_sorter_posix.h",
- ]
- }
- }
- 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_manager",
- ":mdns_client",
- "//net:net_public_deps",
- ]
- allow_circular_includes_from = [
- ":dns_client",
- ":host_resolver",
- ":host_resolver_manager",
- ":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",
- ":dns_client",
- ":host_resolver_manager",
- ":mdns_client",
- "//net",
- ]
- # Restricted access so we can keep track of all usage external to the
- # network stack and network service.
- friend = [
- # chromecast/browser/url_request_context_factory.cc
- # URLRequestContext creation for chromecast.
- "//chromecast/browser",
- # 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/*",
- "//components/grpc_support/test:unit_tests",
- "//content/shell:content_shell_lib",
- "//content/test:*",
- # Stand-alone tools.
- "//google_apis/gcm:mcs_probe",
- # Network stack/service.
- "//components/certificate_transparency/*",
- "//components/cronet/*",
- "//net/*",
- "//services/network/*",
- ]
- sources = [
- "dns_config.h",
- "host_cache.h",
- "host_resolver.h",
- "host_resolver_results.h",
- "mapped_host_resolver.h",
- ]
- public = []
- deps = [
- "//net:net_deps",
- "//net/dns/public",
- ]
- public_deps = [ "//net:net_public_deps" ]
- allow_circular_includes_from = [ "//net/dns/public" ]
- }
- # Shared mostly-global handler of HostResolver requests.
- #
- # Typically should only be directly interacted with by NetworkService (or other
- # mostly-global creators of request contexts), standalone tools, and tests. Host
- # resolution should generally instead go through HostResolvers received from
- # URLRequestContext or network service Mojo IPCs.
- source_set("host_resolver_manager") {
- # 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",
- "//net",
- ]
- # Restricted access so we can keep track of all usage external to the
- # network stack and network service.
- friend = [
- # chromecast/browser/url_request_context_factory.cc
- # URLRequestContext creation for chromecast.
- "//chromecast/browser",
- # Tests and test support.
- "//components/cronet:cronet_common_unittests",
- # Network stack/service.
- "//net/*",
- "//services/network/*",
- ]
- sources = [ "host_resolver_manager.h" ]
- public = []
- deps = [
- ":host_resolver",
- "//net:net_deps",
- "//net/dns/public",
- ]
- public_deps = [ "//net:net_public_deps" ]
- }
- # DnsClient interfaces. Primarily intended as part of the implementation of the
- # standard HostResolver interface, but can be used as an alternative external
- # interface for advanced usage.
- 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",
- ]
- # Restricted access so we can keep track of all usage external to the
- # network stack.
- friend = [
- # chrome/browser/local_discovery/service_discovery_client_impl.cc
- # Result parsing utilities for parsing results read through MdnsClient.
- # TODO(crbug.com/874662): Remove once migrated to network service.
- "//chrome/browser",
- # chrome/browser/ash/smb_client/discovery/mdns_host_locator.cc
- # Result parsing for results read through MdnsClient.
- # TODO(crbug.com/902531): Remove once migrated to network service.
- "//chrome/browser/chromeos",
- # Tests and test support
- "//chrome/browser:test_support",
- "//chrome/test/*",
- # Network stack/service
- "//components/certificate_transparency/*",
- "//net/*",
- "//services/network/*",
- ]
- sources = [
- "dns_client.h",
- "dns_response.h",
- "dns_transaction.h",
- "https_record_rdata.h",
- "opt_record_rdata.h",
- "record_parsed.h",
- "record_rdata.h",
- ]
- public = []
- deps = [
- ":host_resolver",
- "//net:net_deps",
- ]
- public_deps = [
- "//net:net_public_deps",
- "//net/dns/public",
- ]
- }
- # MdnsClient interfaces.
- 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",
- ]
- # Restricted access so we can keep track of all usage external to the
- # network stack.
- friend = [
- # chrome/browser/local_discovery/service_discovery_client_mdns.h
- # chrome/browser/local_discovery/service_discovery_client_impl.h
- # Makes MDNS queries using MDnsClient.
- # TODO(crbug.com/874662): Remove once migrated to network service.
- "//chrome/browser",
- # chrome/tools/service_discovery_sniffer/service_discovery_sniffer.cc
- # Creates MDnsClient instance and passes to ServiceDiscoveryClientImpl.
- # TODO(crbug.com/874662): Remove once discovery client migrated.
- "//chrome/tools/service_discovery_sniffer",
- # chrome/browser/ash/smb_client/discovery/mdns_host_locator.h
- # chrome/browser/ash/smb_client/discovery/mdns_host_locator.cc
- # Makes MDNS queries using MDnsClient.
- # TODO(crbug.com/902531): Remove once migrated to network service.
- "//chrome/browser/chromeos",
- # Tests and test support
- "//chrome/browser:test_support",
- # Network stack/service
- "//net/*",
- "//services/network/*",
- ]
- public = []
- sources = []
- if (enable_mdns) {
- sources += [ "mdns_client.h" ]
- }
- deps = [
- ":dns_client",
- ":host_resolver",
- "//net:net_deps",
- ]
- public_deps = [ "//net:net_public_deps" ]
- }
- source_set("tests") {
- testonly = true
- sources = [
- "address_info_unittest.cc",
- "context_host_resolver_unittest.cc",
- "dns_alias_utility_unittest.cc",
- "dns_config_service_unittest.cc",
- "dns_hosts_unittest.cc",
- "dns_query_unittest.cc",
- "dns_response_result_extractor_unittest.cc",
- "dns_response_unittest.cc",
- "dns_transaction_unittest.cc",
- "dns_udp_tracker_unittest.cc",
- "dns_util_unittest.cc",
- "host_cache_unittest.cc",
- "host_resolver_manager_unittest.cc",
- "https_record_rdata_unittest.cc",
- "httpssvc_metrics_unittest.cc",
- "mapped_host_resolver_unittest.cc",
- "nsswitch_reader_unittest.cc",
- "opt_record_rdata_unittest.cc",
- "record_parsed_unittest.cc",
- "record_rdata_unittest.cc",
- "resolve_context_unittest.cc",
- "serial_worker_unittest.cc",
- "system_dns_config_change_notifier_unittest.cc",
- ]
- if (is_win) {
- sources += [ "dns_config_service_win_unittest.cc" ]
- }
- if (is_android) {
- sources += [ "dns_config_service_android_unittest.cc" ]
- } else if (is_linux) {
- sources += [ "dns_config_service_linux_unittest.cc" ]
- } else if (is_posix) {
- sources += [ "dns_config_service_posix_unittest.cc" ]
- }
- if (enable_built_in_dns) {
- sources += [
- "address_sorter_unittest.cc",
- "dns_client_unittest.cc",
- ]
- if (is_posix || is_fuchsia) {
- sources += [ "address_sorter_posix_unittest.cc" ]
- }
- }
- if (enable_mdns) {
- sources += [
- "mdns_cache_unittest.cc",
- "mdns_client_unittest.cc",
- ]
- }
- deps = [
- "//base",
- "//net",
- "//net:test_support",
- "//testing/gmock",
- "//testing/gtest",
- ]
- }
- source_set("test_support") {
- visibility = [ "//net:test_support" ]
- testonly = true
- sources = [
- "dns_test_util.cc",
- "host_resolver_results_test_util.cc",
- "mock_host_resolver.cc",
- ]
- public = [
- "dns_test_util.h",
- "host_resolver_results_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",
- ]
- }
- if (use_fuzzing_engine) {
- # fuzzer_test targets are no-op when |use_fuzzing_engine| is false. Fuzzer
- # support targets should be disabled too.
- source_set("fuzzer_test_support") {
- testonly = true
- sources = [
- "fuzzed_host_resolver_util.cc",
- "fuzzed_host_resolver_util.h",
- ]
- deps = [
- "//base",
- "//base/test:test_support",
- "//net",
- ]
- }
- }
- proto_library("host_cache_fuzzer_proto") {
- proto_in_dir = "//"
- sources = [ "host_cache_fuzzer.proto" ]
- deps = [ "//testing/libfuzzer/proto:json_proto" ]
- }
- fuzzer_test("net_dns_host_cache_fuzzer") {
- sources = [ "host_cache_fuzzer.cc" ]
- deps = [
- ":host_cache_fuzzer_proto",
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- "//testing/libfuzzer/proto:json_proto",
- "//testing/libfuzzer/proto:json_proto_converter",
- "//third_party/libprotobuf-mutator",
- ]
- dict = "//testing/libfuzzer/fuzzers/dicts/json.dict"
- }
- 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_https_record_rdata_fuzzer") {
- sources = [ "https_record_rdata_fuzzer.cc" ]
- deps = [
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- ]
- dict = "//net/data/fuzzer_dictionaries/net_dns_record_fuzzer.dict"
- }
- fuzzer_test("net_dns_integrity_record_fuzzer") {
- sources = [ "integrity_record_fuzzer.cc" ]
- deps = [
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- ]
- }
- fuzzer_test("net_dns_nsswitch_reader_fuzzer") {
- sources = [ "nsswitch_reader_fuzzer.cc" ]
- deps = [
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- ]
- dict = "//net/data/fuzzer_dictionaries/net_dns_nsswitch_reader_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_dns_response_fuzzer") {
- sources = [ "dns_response_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_manager_fuzzer") {
- sources = [ "host_resolver_manager_fuzzer.cc" ]
- deps = [
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- "//net:test_support",
- ]
- dict = "//net/data/fuzzer_dictionaries/net_host_resolver_manager_fuzzer.dict"
- }
- if (is_win) {
- fuzzer_test("net_dns_parse_domain_ascii_win_fuzzer") {
- sources = [ "dns_parse_domain_ascii_win_fuzzer.cc" ]
- deps = [
- "//base",
- "//net",
- "//net:net_fuzzer_test_support",
- ]
- dict = "//net/data/fuzzer_dictionaries/net_dns_hosts_parse_fuzzer.dict"
- seed_corpus = "//net/data/fuzzer_data/dns_parse_domain_ascii_win_fuzzer"
- }
- }
|