From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 18 Nov 2018 13:06:49 +0100 Subject: Add flag to disable IPv6 probes --- chrome/browser/about_flags.cc | 5 +++++ chrome/browser/flag_descriptions.cc | 4 ++++ chrome/browser/flag_descriptions.h | 3 +++ components/subresource_filter/tools/BUILD.gn | 6 ++++++ .../url_formatter/spoof_checks/top_domains/BUILD.gn | 3 ++- net/dns/host_resolver_manager.cc | 9 ++++++++- services/network/public/cpp/features.cc | 4 ++++ services/network/public/cpp/features.h | 2 ++ 8 files changed, 34 insertions(+), 2 deletions(-) diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -4385,6 +4385,11 @@ const FeatureEntry kFeatureEntries[] = { #endif // defined(OS_WIN) || defined(OS_MAC) || defined(OS_LINUX) || // defined(OS_CHROMEOS) + {"ipv6-probing", + flag_descriptions::kIPv6ProbingName, + flag_descriptions::kIPv6ProbingDescription, kOsAll, + FEATURE_VALUE_TYPE(network::features::kIPv6Probing)}, + #if !defined(OS_ANDROID) {"ntp-iframe-one-google-bar", flag_descriptions::kNtpIframeOneGoogleBarName, flag_descriptions::kNtpIframeOneGoogleBarDescription, kOsDesktop, diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc --- a/chrome/browser/flag_descriptions.cc +++ b/chrome/browser/flag_descriptions.cc @@ -2723,6 +2723,10 @@ const char kContextualSearchRankerQueryDescription[] = const char kContextualSearchSecondTapName[] = "Contextual Search second tap triggering"; +const char kIPv6ProbingName[] = "Enable IPv6 probing."; +const char kIPv6ProbingDescription[] = + "Send IPv6 probes to a RIPE DNS address to verify IPv6 connectivity."; + const char kContextualSearchSecondTapDescription[] = "Enables triggering on a second tap gesture even when Ranker would " "normally suppress that tap."; diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h --- a/chrome/browser/flag_descriptions.h +++ b/chrome/browser/flag_descriptions.h @@ -616,6 +616,9 @@ extern const char kEnableWasmThreadsName[]; extern const char kEnableWasmThreadsDescription[]; extern const char kEnableWasmTieringName[]; +extern const char kIPv6ProbingName[]; +extern const char kIPv6ProbingDescription[]; + extern const char kEnableWasmTieringDescription[]; extern const char kEvDetailsInPageInfoName[]; diff --git a/components/subresource_filter/tools/BUILD.gn b/components/subresource_filter/tools/BUILD.gn --- a/components/subresource_filter/tools/BUILD.gn +++ b/components/subresource_filter/tools/BUILD.gn @@ -50,6 +50,8 @@ if (!is_ios) { deps = [ ":tools_lib", "//base", + "//components/network_session_configurator/common", + "//services/network/public/cpp" ] } @@ -61,6 +63,8 @@ if (!is_ios) { ":tools_lib", "../core/common", "//base", + "//components/network_session_configurator/common", + "//services/network/public/cpp", ] } @@ -70,6 +74,8 @@ if (!is_ios) { "ruleset_converter:support", "//base", "//third_party/protobuf:protobuf_lite", + "//components/network_session_configurator/common", + "//services/network/public/cpp" ] } diff --git a/components/url_formatter/spoof_checks/top_domains/BUILD.gn b/components/url_formatter/spoof_checks/top_domains/BUILD.gn --- a/components/url_formatter/spoof_checks/top_domains/BUILD.gn +++ b/components/url_formatter/spoof_checks/top_domains/BUILD.gn @@ -73,7 +73,8 @@ executable("make_top_domain_list_variables") { "//base:i18n", "//components/url_formatter/spoof_checks/common_words:common", "//third_party/icu", - "//components/network_session_configurator/common" + "//components/network_session_configurator/common", + "//services/network/public/cpp", ] if (is_ios) { frameworks = [ "UIKit.framework" ] diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc --- a/net/dns/host_resolver_manager.cc +++ b/net/dns/host_resolver_manager.cc @@ -93,6 +93,7 @@ #include "net/log/net_log_event_type.h" #include "net/log/net_log_source.h" #include "net/log/net_log_source_type.h" +#include "services/network/public/cpp/features.h" #include "net/log/net_log_with_source.h" #include "net/socket/client_socket_factory.h" #include "net/socket/datagram_client_socket.h" @@ -3707,8 +3708,14 @@ bool HostResolverManager::IsIPv6Reachable(const NetLogWithSource& net_log) { if (last_ipv6_probe_time_.is_null() || (tick_clock_->NowTicks() - last_ipv6_probe_time_).InMilliseconds() > kIPv6ProbePeriodMs) { - SetLastIPv6ProbeResult( + + if (!base::FeatureList::IsEnabled(network::features::kIPv6Probing)) { + // pretend IPv6 connectivy probe is successful when probing is disabled + SetLastIPv6ProbeResult(true); + } else { + SetLastIPv6ProbeResult( IsGloballyReachable(IPAddress(kIPv6ProbeAddress), net_log)); + } cached = false; } net_log.AddEvent( diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc --- a/services/network/public/cpp/features.cc +++ b/services/network/public/cpp/features.cc @@ -40,6 +40,10 @@ const base::Feature kReporting{"Reporting", base::FEATURE_ENABLED_BY_DEFAULT}; const base::Feature kThrottleDelayable{"ThrottleDelayable", base::FEATURE_ENABLED_BY_DEFAULT}; +// Enable IPv6 ping probes to RIPE DNS. +const base::Feature kIPv6Probing{"IPv6Probing", + base::FEATURE_ENABLED_BY_DEFAULT}; + // When kPriorityRequestsDelayableOnSlowConnections is enabled, HTTP // requests fetched from a SPDY/QUIC/H2 proxies can be delayed by the // ResourceScheduler just as HTTP/1.1 resources are. However, requests from such diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h --- a/services/network/public/cpp/features.h +++ b/services/network/public/cpp/features.h @@ -19,6 +19,8 @@ extern const base::Feature kNetworkErrorLogging; COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kNetworkService; COMPONENT_EXPORT(NETWORK_CPP) +extern const base::Feature kIPv6Probing; +COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kReporting; COMPONENT_EXPORT(NETWORK_CPP) extern const base::Feature kThrottleDelayable; -- 2.17.1