diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/net/dns/public | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/net/dns/public')
-rw-r--r-- | chromium/net/dns/public/BUILD.gn | 6 | ||||
-rw-r--r-- | chromium/net/dns/public/dns_protocol.h | 5 | ||||
-rw-r--r-- | chromium/net/dns/public/dns_query_type.h | 7 | ||||
-rw-r--r-- | chromium/net/dns/public/doh_provider_entry.cc (renamed from chromium/net/dns/public/doh_provider_list.cc) | 219 | ||||
-rw-r--r-- | chromium/net/dns/public/doh_provider_entry.h (renamed from chromium/net/dns/public/doh_provider_list.h) | 63 | ||||
-rw-r--r-- | chromium/net/dns/public/doh_provider_entry_unittest.cc (renamed from chromium/net/dns/public/doh_provider_list_unittest.cc) | 4 |
6 files changed, 176 insertions, 128 deletions
diff --git a/chromium/net/dns/public/BUILD.gn b/chromium/net/dns/public/BUILD.gn index 04f2a9b57b3..832312ddeee 100644 --- a/chromium/net/dns/public/BUILD.gn +++ b/chromium/net/dns/public/BUILD.gn @@ -19,8 +19,8 @@ source_set("public") { "dns_protocol.h", "dns_query_type.cc", "dns_query_type.h", - "doh_provider_list.cc", - "doh_provider_list.h", + "doh_provider_entry.cc", + "doh_provider_entry.h", "resolve_error_info.cc", "resolve_error_info.h", "util.cc", @@ -35,7 +35,7 @@ source_set("public") { source_set("tests") { testonly = true sources = [ - "doh_provider_list_unittest.cc", + "doh_provider_entry_unittest.cc", "util_unittest.cc", ] diff --git a/chromium/net/dns/public/dns_protocol.h b/chromium/net/dns/public/dns_protocol.h index ea9112feb00..c77dbaa7cd4 100644 --- a/chromium/net/dns/public/dns_protocol.h +++ b/chromium/net/dns/public/dns_protocol.h @@ -153,11 +153,6 @@ static const uint16_t kTypeANY = 255; // Experimental DNS record types pending IANA assignment. // -// Record type proposed for TLS Encrypted Server Name Indication -// (ESNI, draft 4) records: -// https://tools.ietf.org/html/draft-ietf-tls-esni-04#section-8.3 -static const uint16_t kExperimentalTypeEsniDraft4 = 65439; - // The INTEGRITY RR type exists purely for measuring how the DNS ecosystem // handles new RR types. // https://docs.google.com/document/d/14eCqVyT_3MSj7ydqNFl1Yl0yg1fs6g24qmYUUdi5V-k/edit?usp=sharing diff --git a/chromium/net/dns/public/dns_query_type.h b/chromium/net/dns/public/dns_query_type.h index 7d407a62d01..ecc61ea597d 100644 --- a/chromium/net/dns/public/dns_query_type.h +++ b/chromium/net/dns/public/dns_query_type.h @@ -20,14 +20,15 @@ enum class DnsQueryType { TXT, PTR, SRV, - ESNI, - MAX = ESNI + INTEGRITY, + MAX = INTEGRITY }; const DnsQueryType kDnsQueryTypes[] = { DnsQueryType::UNSPECIFIED, DnsQueryType::A, DnsQueryType::AAAA, DnsQueryType::TXT, DnsQueryType::PTR, DnsQueryType::SRV, - DnsQueryType::ESNI}; + DnsQueryType::INTEGRITY, +}; static_assert(base::size(kDnsQueryTypes) == static_cast<unsigned>(DnsQueryType::MAX) + 1, diff --git a/chromium/net/dns/public/doh_provider_list.cc b/chromium/net/dns/public/doh_provider_entry.cc index b5b2a50ef89..0422c8c6a7a 100644 --- a/chromium/net/dns/public/doh_provider_list.cc +++ b/chromium/net/dns/public/doh_provider_entry.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/dns/public/doh_provider_list.h" +#include "net/dns/public/doh_provider_entry.h" #include <utility> @@ -12,54 +12,28 @@ namespace net { -DohProviderEntry::DohProviderEntry( - std::string provider, - base::Optional<DohProviderIdForHistogram> provider_id_for_histogram, - std::set<std::string> ip_strs, - std::set<std::string> dns_over_tls_hostnames, - std::string dns_over_https_template, - std::string ui_name, - std::string privacy_policy, - bool display_globally, - std::set<std::string> display_countries) - : provider(std::move(provider)), - provider_id_for_histogram(std::move(provider_id_for_histogram)), - dns_over_tls_hostnames(std::move(dns_over_tls_hostnames)), - dns_over_https_template(std::move(dns_over_https_template)), - ui_name(std::move(ui_name)), - privacy_policy(std::move(privacy_policy)), - display_globally(display_globally), - display_countries(std::move(display_countries)) { - DCHECK(!this->dns_over_https_template.empty()); - DCHECK(dns_util::IsValidDohTemplate(this->dns_over_https_template, - nullptr /* server_method */)); +namespace { - DCHECK(!display_globally || this->display_countries.empty()); - if (display_globally || !this->display_countries.empty()) { - DCHECK(!this->ui_name.empty()); - DCHECK(!this->privacy_policy.empty()); - DCHECK(this->provider_id_for_histogram.has_value()); - } - for (const auto& display_country : this->display_countries) { - DCHECK_EQ(2u, display_country.size()); - } - for (const std::string& ip_str : ip_strs) { +std::set<IPAddress> ParseIPs(const std::set<base::StringPiece>& ip_strs) { + std::set<IPAddress> ip_addresses; + for (base::StringPiece ip_str : ip_strs) { IPAddress ip_address; bool success = ip_address.AssignFromIPLiteral(ip_str); DCHECK(success); - ip_addresses.insert(ip_address); + ip_addresses.insert(std::move(ip_address)); } + return ip_addresses; } -DohProviderEntry::DohProviderEntry(const DohProviderEntry& other) = default; -DohProviderEntry::~DohProviderEntry() = default; +} // namespace -const std::vector<DohProviderEntry>& GetDohProviderList() { +// static +const DohProviderEntry::List& DohProviderEntry::GetList() { // The provider names in these entries should be kept in sync with the // DohProviderId histogram suffix list in // tools/metrics/histograms/histograms.xml. - static const base::NoDestructor<std::vector<DohProviderEntry>> providers{{ - DohProviderEntry( + static const base::NoDestructor<DohProviderEntry::List> providers{{ + new DohProviderEntry( "CleanBrowsingAdult", base::nullopt /* provider_id_for_histogram */, {"185.228.168.10", "185.228.169.11", "2a0d:2a00:1::1", "2a0d:2a00:2::1"}, @@ -67,7 +41,7 @@ const std::vector<DohProviderEntry>& GetDohProviderList() { "https://doh.cleanbrowsing.org/doh/adult-filter{?dns}", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "CleanBrowsingFamily", DohProviderIdForHistogram::kCleanBrowsingFamily, {"185.228.168.168", "185.228.169.168", @@ -77,7 +51,7 @@ const std::vector<DohProviderEntry>& GetDohProviderList() { "CleanBrowsing (Family Filter)" /* ui_name */, "https://cleanbrowsing.org/privacy" /* privacy_policy */, true /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "CleanBrowsingSecure", base::nullopt /* provider_id_for_histogram */, {"185.228.168.9", "185.228.169.9", "2a0d:2a00:1::2", "2a0d:2a00:2::2"}, @@ -85,7 +59,7 @@ const std::vector<DohProviderEntry>& GetDohProviderList() { "https://doh.cleanbrowsing.org/doh/security-filter{?dns}", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "Cloudflare", DohProviderIdForHistogram::kCloudflare, {"1.1.1.1", "1.0.0.1", "2606:4700:4700::1111", "2606:4700:4700::1001"}, @@ -96,63 +70,64 @@ const std::vector<DohProviderEntry>& GetDohProviderList() { "https://developers.cloudflare.com/1.1.1.1/privacy/" "public-dns-resolver/" /* privacy_policy */, true /* display_globally */, {} /* display_countries */), - DohProviderEntry("Comcast", base::nullopt /* provider_id_for_histogram */, - {"75.75.75.75", "75.75.76.76", "2001:558:feed::1", - "2001:558:feed::2"}, - {"dot.xfinity.com"} /* dns_over_tls_hostnames */, - "https://doh.xfinity.com/dns-query{?dns}", - "" /* ui_name */, "" /* privacy_policy */, - false /* display_globally */, - {} /* display_countries */), - DohProviderEntry("Cznic", base::nullopt /* provider_id_for_histogram */, - {"185.43.135.1", "2001:148f:fffe::1"}, - {"odvr.nic.cz"} /* dns_over_tls_hostnames */, - "https://odvr.nic.cz/doh", "" /* ui_name */, - "" /* privacy_policy */, false /* display_globally */, - {} /* display_countries */), + new DohProviderEntry( + "Comcast", base::nullopt /* provider_id_for_histogram */, + {"75.75.75.75", "75.75.76.76", "2001:558:feed::1", + "2001:558:feed::2"}, + {"dot.xfinity.com"} /* dns_over_tls_hostnames */, + "https://doh.xfinity.com/dns-query{?dns}", "" /* ui_name */, + "" /* privacy_policy */, false /* display_globally */, + {} /* display_countries */), + new DohProviderEntry( + "Cznic", base::nullopt /* provider_id_for_histogram */, + {"185.43.135.1", "2001:148f:fffe::1"}, + {"odvr.nic.cz"} /* dns_over_tls_hostnames */, + "https://odvr.nic.cz/doh", "" /* ui_name */, "" /* privacy_policy */, + false /* display_globally */, {} /* display_countries */), // Note: DNS.SB has separate entries for autoupgrade and settings UI to // allow the extra |no_ecs| parameter for autoupgrade. This parameter // disables EDNS Client Subnet (ECS) handling in order to match the // behavior of the upgraded-from classic DNS server. - DohProviderEntry( + new DohProviderEntry( "Dnssb", base::nullopt /* provider_id_for_histogram */, {"185.222.222.222", "185.184.222.222", "2a09::", "2a09::1"}, {"dns.sb"} /* dns_over_tls_hostnames */, "https://doh.dns.sb/dns-query?no_ecs=true{&dns}", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "DnssbUserSelected", DohProviderIdForHistogram::kDnsSb, {} /* ip_strs */, {} /* dns_over_tls_hostnames */, "https://doh.dns.sb/dns-query{?dns}", "DNS.SB" /* ui_name */, "https://dns.sb/privacy/" /* privacy_policy */, false /* display_globally */, {"EE", "DE"} /* display_countries */), - DohProviderEntry("Google", DohProviderIdForHistogram::kGoogle, - {"8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", - "2001:4860:4860::8844"}, - {"dns.google", "dns.google.com", - "8888.google"} /* dns_over_tls_hostnames */, - "https://dns.google/dns-query{?dns}", - "Google (Public DNS)" /* ui_name */, - "https://developers.google.com/speed/public-dns/" - "privacy" /* privacy_policy */, - true /* display_globally */, {} /* display_countries */), - DohProviderEntry("Iij", DohProviderIdForHistogram::kIij, {} /* ip_strs */, - {} /* dns_over_tls_hostnames */, - "https://public.dns.iij.jp/dns-query", - "IIJ (Public DNS)" /* ui_name */, - "https://public.dns.iij.jp/" /* privacy_policy */, - false /* display_globally */, - {"JP"} /* display_countries */), - DohProviderEntry("OpenDNS", base::nullopt /* provider_id_for_histogram */, - {"208.67.222.222", "208.67.220.220", "2620:119:35::35", - "2620:119:53::53"}, - {""} /* dns_over_tls_hostnames */, - "https://doh.opendns.com/dns-query{?dns}", - "" /* ui_name */, "" /* privacy_policy */, - false /* display_globally */, - {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry("Google", DohProviderIdForHistogram::kGoogle, + {"8.8.8.8", "8.8.4.4", "2001:4860:4860::8888", + "2001:4860:4860::8844"}, + {"dns.google", "dns.google.com", + "8888.google"} /* dns_over_tls_hostnames */, + "https://dns.google/dns-query{?dns}", + "Google (Public DNS)" /* ui_name */, + "https://developers.google.com/speed/public-dns/" + "privacy" /* privacy_policy */, + true /* display_globally */, + {} /* display_countries */), + new DohProviderEntry("Iij", DohProviderIdForHistogram::kIij, + {} /* ip_strs */, {} /* dns_over_tls_hostnames */, + "https://public.dns.iij.jp/dns-query", + "IIJ (Public DNS)" /* ui_name */, + "https://public.dns.iij.jp/" /* privacy_policy */, + false /* display_globally */, + {"JP"} /* display_countries */), + new DohProviderEntry( + "OpenDNS", base::nullopt /* provider_id_for_histogram */, + {"208.67.222.222", "208.67.220.220", "2620:119:35::35", + "2620:119:53::53"}, + {""} /* dns_over_tls_hostnames */, + "https://doh.opendns.com/dns-query{?dns}", "" /* ui_name */, + "" /* privacy_policy */, false /* display_globally */, + {} /* display_countries */), + new DohProviderEntry( "OpenDNSFamily", base::nullopt /* provider_id_for_histogram */, {"208.67.222.123", "208.67.220.123", "2620:119:35::123", "2620:119:53::123"}, @@ -160,36 +135,94 @@ const std::vector<DohProviderEntry>& GetDohProviderList() { "https://doh.familyshield.opendns.com/dns-query{?dns}", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "Quad9Cdn", base::nullopt /* provider_id_for_histogram */, {"9.9.9.11", "149.112.112.11", "2620:fe::11", "2620:fe::fe:11"}, {"dns11.quad9.net"} /* dns_over_tls_hostnames */, "https://dns11.quad9.net/dns-query", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "Quad9Insecure", base::nullopt /* provider_id_for_histogram */, {"9.9.9.10", "149.112.112.10", "2620:fe::10", "2620:fe::fe:10"}, {"dns10.quad9.net"} /* dns_over_tls_hostnames */, "https://dns10.quad9.net/dns-query", "" /* ui_name */, "" /* privacy_policy */, false /* display_globally */, {} /* display_countries */), - DohProviderEntry( + new DohProviderEntry( "Quad9Secure", DohProviderIdForHistogram::kQuad9Secure, {"9.9.9.9", "149.112.112.112", "2620:fe::fe", "2620:fe::9"}, {"dns.quad9.net", "dns9.quad9.net"} /* dns_over_tls_hostnames */, "https://dns.quad9.net/dns-query", "Quad9 (9.9.9.9)" /* ui_name */, "https://www.quad9.net/home/privacy/" /* privacy_policy */, true /* display_globally */, {} /* display_countries */), - DohProviderEntry("Switch", base::nullopt /* provider_id_for_histogram */, - {"130.59.31.251", "130.59.31.248", "2001:620:0:ff::2", - "2001:620:0:ff::3"}, - {"dns.switch.ch"} /* dns_over_tls_hostnames */, - "https://dns.switch.ch/dns-query", "" /* ui_name */, - "" /* privacy_policy */, false /* display_globally */, - {} /* display_countries */), + new DohProviderEntry( + "Switch", base::nullopt /* provider_id_for_histogram */, + {"130.59.31.251", "130.59.31.248", "2001:620:0:ff::2", + "2001:620:0:ff::3"}, + {"dns.switch.ch"} /* dns_over_tls_hostnames */, + "https://dns.switch.ch/dns-query", "" /* ui_name */, + "" /* privacy_policy */, false /* display_globally */, + {} /* display_countries */), }}; return *providers; } +// static +DohProviderEntry DohProviderEntry::ConstructForTesting( + std::string provider, + base::Optional<DohProviderIdForHistogram> provider_id_for_histogram, + std::set<base::StringPiece> ip_strs, + std::set<std::string> dns_over_tls_hostnames, + std::string dns_over_https_template, + std::string ui_name, + std::string privacy_policy, + bool display_globally, + std::set<std::string> display_countries) { + return DohProviderEntry(provider, provider_id_for_histogram, ip_strs, + dns_over_tls_hostnames, dns_over_https_template, + ui_name, privacy_policy, display_globally, + display_countries); +} + +DohProviderEntry::DohProviderEntry(DohProviderEntry&& other) = default; +DohProviderEntry& DohProviderEntry::operator=(DohProviderEntry&& other) = + default; + +DohProviderEntry::~DohProviderEntry() = default; + +DohProviderEntry::DohProviderEntry( + std::string provider, + base::Optional<DohProviderIdForHistogram> provider_id_for_histogram, + std::set<base::StringPiece> ip_strs, + std::set<std::string> dns_over_tls_hostnames, + std::string dns_over_https_template, + std::string ui_name, + std::string privacy_policy, + bool display_globally, + std::set<std::string> display_countries) + : provider(std::move(provider)), + provider_id_for_histogram(std::move(provider_id_for_histogram)), + ip_addresses(ParseIPs(ip_strs)), + dns_over_tls_hostnames(std::move(dns_over_tls_hostnames)), + dns_over_https_template(std::move(dns_over_https_template)), + ui_name(std::move(ui_name)), + privacy_policy(std::move(privacy_policy)), + display_globally(display_globally), + display_countries(std::move(display_countries)) { + DCHECK(!this->dns_over_https_template.empty()); + DCHECK(dns_util::IsValidDohTemplate(this->dns_over_https_template, + nullptr /* server_method */)); + + DCHECK(!display_globally || this->display_countries.empty()); + if (display_globally || !this->display_countries.empty()) { + DCHECK(!this->ui_name.empty()); + DCHECK(!this->privacy_policy.empty()); + DCHECK(this->provider_id_for_histogram.has_value()); + } + for (const auto& display_country : this->display_countries) { + DCHECK_EQ(2u, display_country.size()); + } +} + } // namespace net diff --git a/chromium/net/dns/public/doh_provider_list.h b/chromium/net/dns/public/doh_provider_entry.h index 5b3050874a3..150ea48bef5 100644 --- a/chromium/net/dns/public/doh_provider_list.h +++ b/chromium/net/dns/public/doh_provider_entry.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_DNS_PUBLIC_DOH_PROVIDER_LIST_H_ -#define NET_DNS_PUBLIC_DOH_PROVIDER_LIST_H_ +#ifndef NET_DNS_PUBLIC_DOH_PROVIDER_ENTRY_H_ +#define NET_DNS_PUBLIC_DOH_PROVIDER_ENTRY_H_ #include <set> #include <string> @@ -41,37 +41,56 @@ enum class DohProviderIdForHistogram { // codes, if any, where the entry is eligible for being displayed in the // dropdown menu. struct NET_EXPORT DohProviderEntry { - DohProviderEntry( + public: + using List = std::vector<const DohProviderEntry*>; + + std::string provider; + // A provider_id_for_histogram is required for entries that are intended to + // be visible in the UI. + base::Optional<DohProviderIdForHistogram> provider_id_for_histogram; + std::set<IPAddress> ip_addresses; + std::set<std::string> dns_over_tls_hostnames; + std::string dns_over_https_template; + std::string ui_name; + std::string privacy_policy; + bool display_globally; + std::set<std::string> display_countries; + + // Returns the full list of DoH providers. A subset of this list may be used + // to support upgrade in automatic mode or to populate the dropdown menu for + // secure mode. + static const List& GetList(); + + static DohProviderEntry ConstructForTesting( std::string provider, base::Optional<DohProviderIdForHistogram> provider_id_for_histogram, - std::set<std::string> ip_strs, + std::set<base::StringPiece> ip_strs, std::set<std::string> dns_over_tls_hostnames, std::string dns_over_https_template, std::string ui_name, std::string privacy_policy, bool display_globally, std::set<std::string> display_countries); - DohProviderEntry(const DohProviderEntry& other); + + // Entries are move-only. This allows tests to construct a List but ensures + // that |const DohProviderEntry*| is a safe type for application code. + DohProviderEntry(DohProviderEntry&& other); + DohProviderEntry& operator=(DohProviderEntry&& other); ~DohProviderEntry(); - const std::string provider; - // A provider_id_for_histogram is required for entries that are intended to - // be visible in the UI. - const base::Optional<DohProviderIdForHistogram> provider_id_for_histogram; - std::set<IPAddress> ip_addresses; - const std::set<std::string> dns_over_tls_hostnames; - const std::string dns_over_https_template; - const std::string ui_name; - const std::string privacy_policy; - bool display_globally; - std::set<std::string> display_countries; + private: + DohProviderEntry( + std::string provider, + base::Optional<DohProviderIdForHistogram> provider_id_for_histogram, + std::set<base::StringPiece> ip_strs, + std::set<std::string> dns_over_tls_hostnames, + std::string dns_over_https_template, + std::string ui_name, + std::string privacy_policy, + bool display_globally, + std::set<std::string> display_countries); }; -// Returns the full list of DoH providers. A subset of this list may be used -// to support upgrade in automatic mode or to populate the dropdown menu for -// secure mode. -NET_EXPORT const std::vector<DohProviderEntry>& GetDohProviderList(); - } // namespace net -#endif // NET_DNS_PUBLIC_DOH_PROVIDER_LIST_H_ +#endif // NET_DNS_PUBLIC_DOH_PROVIDER_ENTRY_H_ diff --git a/chromium/net/dns/public/doh_provider_list_unittest.cc b/chromium/net/dns/public/doh_provider_entry_unittest.cc index 60750e6d86a..e5cf5b79cf5 100644 --- a/chromium/net/dns/public/doh_provider_list_unittest.cc +++ b/chromium/net/dns/public/doh_provider_entry_unittest.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/dns/public/doh_provider_list.h" +#include "net/dns/public/doh_provider_entry.h" #include "testing/gtest/include/gtest/gtest.h" @@ -10,7 +10,7 @@ namespace net { namespace { TEST(DohProviderListTest, GetDohProviderList) { - const std::vector<DohProviderEntry>& list = GetDohProviderList(); + const DohProviderEntry::List& list = DohProviderEntry::GetList(); EXPECT_FALSE(list.empty()); } |