summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/io_thread.cc12
-rw-r--r--chrome/browser/net/connection_tester.cc7
-rw-r--r--chrome/browser/resources/net_internals/browser_bridge.js4
-rw-r--r--chrome/browser/resources/net_internals/dns_view.html6
-rw-r--r--chrome/browser/resources/net_internals/dns_view.js65
-rw-r--r--chrome/browser/ui/webui/net_internals/net_internals_ui.cc16
-rw-r--r--net/base/net_log_event_type_list.h16
-rw-r--r--net/base/net_log_source_type_list.h1
-rw-r--r--net/base/net_util.cc173
-rw-r--r--net/base/net_util.h35
-rw-r--r--net/dns/host_resolver.cc3
-rw-r--r--net/dns/host_resolver.h4
-rw-r--r--net/dns/host_resolver_impl.cc80
-rw-r--r--net/dns/host_resolver_impl.h12
-rw-r--r--net/dns/host_resolver_impl_unittest.cc2
-rw-r--r--net/dns/mapped_host_resolver.cc4
-rw-r--r--net/dns/mapped_host_resolver.h1
17 files changed, 16 insertions, 425 deletions
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 8b382c0..63d5cc9 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -162,12 +162,12 @@ scoped_ptr<net::HostResolver> CreateGlobalHostResolver(net::NetLog* net_log) {
net::HostResolver::CreateSystemResolver(options, net_log));
// Determine if we should disable IPv6 support.
- if (!command_line.HasSwitch(switches::kEnableIPv6)) {
- if (command_line.HasSwitch(switches::kDisableIPv6)) {
- global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
- } else {
- global_host_resolver->ProbeIPv6Support();
- }
+ if (command_line.HasSwitch(switches::kEnableIPv6)) {
+ // Disable IPv6 probing.
+ global_host_resolver->SetDefaultAddressFamily(
+ net::ADDRESS_FAMILY_UNSPECIFIED);
+ } else if (command_line.HasSwitch(switches::kDisableIPv6)) {
+ global_host_resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
}
// If hostname remappings were specified on the command-line, layer these
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 96486f3..347761c 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -159,12 +159,7 @@ class ExperimentURLRequestContext : public net::URLRequestContext {
resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_IPV4);
break;
case ConnectionTester::HOST_RESOLVER_EXPERIMENT_IPV6_PROBE: {
- // Note that we don't use impl->ProbeIPv6Support() since that finishes
- // asynchronously and may not take effect in time for the test.
- // So instead we will probe synchronously (might take 100-200 ms).
- net::AddressFamily family = net::TestIPv6Support().ipv6_supported ?
- net::ADDRESS_FAMILY_UNSPECIFIED : net::ADDRESS_FAMILY_IPV4;
- resolver->SetDefaultAddressFamily(family);
+ // The system HostResolver will probe by default.
break;
}
default:
diff --git a/chrome/browser/resources/net_internals/browser_bridge.js b/chrome/browser/resources/net_internals/browser_bridge.js
index 574d4fc..626b8e8 100644
--- a/chrome/browser/resources/net_internals/browser_bridge.js
+++ b/chrome/browser/resources/net_internals/browser_bridge.js
@@ -162,10 +162,6 @@ var BrowserBridge = (function() {
this.send('getHostResolverInfo');
},
- sendRunIPv6Probe: function() {
- this.send('onRunIPv6Probe');
- },
-
sendClearBadProxies: function() {
this.send('clearBadProxies');
},
diff --git a/chrome/browser/resources/net_internals/dns_view.html b/chrome/browser/resources/net_internals/dns_view.html
index 7010bc4..37c61a79 100644
--- a/chrome/browser/resources/net_internals/dns_view.html
+++ b/chrome/browser/resources/net_internals/dns_view.html
@@ -8,12 +8,6 @@
<input type=button value="Enable IPv6" id=dns-view-enable-ipv6 class="hide-when-not-capturing">
</span>
</li>
- <li>
- <span id=dns-view-ipv6-probe-complete style="display: none;">IPv6 probe complete</span>
- <span id=dns-view-ipv6-probe-running class=warning-text style="display: none;">IPv6 probe running</span>
- <input type=button value="Run IPv6 Probe" id=dns-view-run-ipv6-probe class="hide-when-not-capturing">
- </li>
- <li><a href="#events&q=type:IPV6_PROBE_JOB">View all IPv6 probe events</a></li>
</ul>
<div>
diff --git a/chrome/browser/resources/net_internals/dns_view.js b/chrome/browser/resources/net_internals/dns_view.js
index df96558..806668f 100644
--- a/chrome/browser/resources/net_internals/dns_view.js
+++ b/chrome/browser/resources/net_internals/dns_view.js
@@ -34,16 +34,9 @@ var DnsView = (function() {
$(DnsView.ENABLE_IPV6_BUTTON_ID).onclick =
g_browser.enableIPv6.bind(g_browser);
- $(DnsView.IPV6_PROBE_BUTTON_ID).onclick = this.runIPv6Probe_.bind(this);
$(DnsView.CLEAR_CACHE_BUTTON_ID).onclick =
g_browser.sendClearHostResolverCache.bind(g_browser);
- // Used to track IPv6 probes.
- EventsTracker.getInstance().addLogEntryObserver(this);
- // ID of most recently started IPv6 probe job. Once the job completes,
- // set back to -1.
- this.ipv6ProbeJobSourceId_ = -1;
-
// Register to receive changes to the host resolver info.
g_browser.addHostResolverInfoObserver(this, false);
}
@@ -58,10 +51,6 @@ var DnsView = (function() {
DnsView.IPV6_DISABLED_SPAN_ID = 'dns-view-ipv6-disabled';
DnsView.ENABLE_IPV6_BUTTON_ID = 'dns-view-enable-ipv6';
- DnsView.IPV6_PROBE_RUNNING_SPAN_ID = 'dns-view-ipv6-probe-running';
- DnsView.IPV6_PROBE_COMPLETE_SPAN_ID = 'dns-view-ipv6-probe-complete';
- DnsView.IPV6_PROBE_BUTTON_ID = 'dns-view-run-ipv6-probe';
-
DnsView.INTERNAL_DNS_ENABLED_SPAN_ID = 'dns-view-internal-dns-enabled';
DnsView.INTERNAL_DNS_INVALID_CONFIG_SPAN_ID =
'dns-view-internal-dns-invalid-config';
@@ -80,12 +69,6 @@ var DnsView = (function() {
// Inherit the superclass's methods.
__proto__: superClass.prototype,
- onLoadLogStart: function(polledData, tabData, logDump) {
- // Clear information on whether or not an IPv6 probe is running. Needs
- // to be done before loading the events.
- this.setIPv6ProbeJobLookupRunning_(false, -1);
- },
-
onLoadLogFinish: function(data) {
return this.onHostResolverInfoChanged(data.hostResolverInfo);
},
@@ -165,54 +148,6 @@ var DnsView = (function() {
$(DnsView.EXPIRED_SPAN_ID).innerText = expiredEntries;
return true;
},
-
- /**
- * Must be called whenever an IPv6 probe job starts or stops running.
- * @param {bool} running True if a probe job is running.
- * @param {sourceId} sourceId Source ID of the running probe job, if there
- * is one. -1 if |running| is false or we don't yet have the ID.
- */
- setIPv6ProbeJobLookupRunning_: function(running, sourceId) {
- setNodeDisplay($(DnsView.IPV6_PROBE_RUNNING_SPAN_ID), running);
- setNodeDisplay($(DnsView.IPV6_PROBE_COMPLETE_SPAN_ID), !running);
- this.ipv6ProbeJobSourceId_ = sourceId;
- },
-
- /**
- * Triggers a new IPv6 probe and displays the probe running message.
- */
- runIPv6Probe_: function() {
- // Since there's no source ID yet, have to just use -1. We'll get the
- // ID when we see the start event for the probe.
- this.setIPv6ProbeJobLookupRunning_(true, -1);
- g_browser.sendRunIPv6Probe();
- },
-
- onReceivedLogEntries: function(logEntries) {
- for (var i = 0; i < logEntries.length; ++i) {
- if (logEntries[i].source.type != EventSourceType.IPV6_PROBE_JOB ||
- logEntries[i].type != EventType.IPV6_PROBE_RUNNING) {
- continue;
- }
-
- // For IPV6_PROBE_JOB events, update the display depending on whether or
- // not a probe job is running. Only track the most recently started
- // probe job, as it will cancel any older jobs.
- if (logEntries[i].phase == EventPhase.PHASE_BEGIN) {
- this.setIPv6ProbeJobLookupRunning_(true, logEntries[i].source.id);
- } else if (logEntries[i].source.id == this.ipv6ProbeJobSourceId_) {
- this.setIPv6ProbeJobLookupRunning_(false, -1);
- g_browser.sendGetHostResolverInfo();
- }
- }
- },
-
- /**
- * Since the only thing that matters is the source ID of the active probe
- * job, which clearing events doesn't change, do nothing.
- */
- onAllLogEntriesDeleted: function() {
- },
};
/**
diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
index ce78bb1..1c5a136 100644
--- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
+++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc
@@ -555,7 +555,6 @@ class NetInternalsMessageHandler::IOThreadImpl
void OnGetBadProxies(const ListValue* list);
void OnClearBadProxies(const ListValue* list);
void OnGetHostResolverInfo(const ListValue* list);
- void OnRunIPv6Probe(const ListValue* list);
void OnClearHostResolverCache(const ListValue* list);
void OnEnableIPv6(const ListValue* list);
void OnStartConnectionTests(const ListValue* list);
@@ -720,10 +719,6 @@ void NetInternalsMessageHandler::RegisterMessages() {
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnGetHostResolverInfo, proxy_));
web_ui()->RegisterMessageCallback(
- "onRunIPv6Probe",
- base::Bind(&IOThreadImpl::CallbackHelper,
- &IOThreadImpl::OnRunIPv6Probe, proxy_));
- web_ui()->RegisterMessageCallback(
"clearHostResolverCache",
base::Bind(&IOThreadImpl::CallbackHelper,
&IOThreadImpl::OnClearHostResolverCache, proxy_));
@@ -1206,17 +1201,6 @@ void NetInternalsMessageHandler::IOThreadImpl::OnGetHostResolverInfo(
SendJavascriptCommand("receivedHostResolverInfo", dict);
}
-void NetInternalsMessageHandler::IOThreadImpl::OnRunIPv6Probe(
- const ListValue* list) {
- DCHECK(!list);
- net::HostResolver* resolver = GetMainContext()->host_resolver();
-
- // Have to set the default address family manually before calling
- // ProbeIPv6Support.
- resolver->SetDefaultAddressFamily(net::ADDRESS_FAMILY_UNSPECIFIED);
- resolver->ProbeIPv6Support();
-}
-
void NetInternalsMessageHandler::IOThreadImpl::OnClearHostResolverCache(
const ListValue* list) {
DCHECK(!list);
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index def4e5e..2647e4c 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -1971,22 +1971,6 @@ EVENT_TYPE(FILE_STREAM_OPEN)
// }
EVENT_TYPE(FILE_STREAM_ERROR)
-// ------------------------------------------------------------------------
-// IPv6 Probe events.
-// ------------------------------------------------------------------------
-
-// This event lasts from the point an IPv6ProbeJob is created until completion.
-//
-// The END contains the following parameters:
-// {
-// "ipv6_supported": <Boolean indicating whether or not the probe determined
-// IPv6 may be supported>,
-// "ipv6_support_status": <String indicating the reason for that result>,
-// "os_error": <Platform dependent error code, associated with the result,
-// if any>
-// }
-EVENT_TYPE(IPV6_PROBE_RUNNING)
-
// -----------------------------------------------------------------------------
// FTP events.
// -----------------------------------------------------------------------------
diff --git a/net/base/net_log_source_type_list.h b/net/base/net_log_source_type_list.h
index 9b1dd2b..2219f7e 100644
--- a/net/base/net_log_source_type_list.h
+++ b/net/base/net_log_source_type_list.h
@@ -26,6 +26,5 @@ SOURCE_TYPE(CERT_VERIFIER_JOB)
SOURCE_TYPE(HTTP_PIPELINED_CONNECTION)
SOURCE_TYPE(DOWNLOAD)
SOURCE_TYPE(FILESTREAM)
-SOURCE_TYPE(IPV6_PROBE_JOB)
SOURCE_TYPE(DNS_PROBER)
SOURCE_TYPE(PROXY_CLIENT_SOCKET)
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index fe1d0f0..db9251b 100644
--- a/net/base/net_util.cc
+++ b/net/base/net_util.cc
@@ -1795,179 +1795,6 @@ ScopedPortException::~ScopedPortException() {
NOTREACHED();
}
-namespace {
-
-const char* kFinalStatusNames[] = {
- "Cannot create sockets",
- "Can create sockets",
- "Can't get addresses",
- "Global ipv6 address missing",
- "Global ipv6 address present",
- "Interface array too short",
- "Probing not supported", // IPV6_SUPPORT_MAX
-};
-COMPILE_ASSERT(arraysize(kFinalStatusNames) == IPV6_SUPPORT_MAX + 1,
- IPv6SupportStatus_name_count_mismatch);
-
-// TODO(jar): The following is a simple estimate of IPv6 support. We may need
-// to do a test resolution, and a test connection, to REALLY verify support.
-IPv6SupportResult TestIPv6SupportInternal() {
-#if defined(OS_ANDROID)
- // TODO: We should fully implement IPv6 probe once 'getifaddrs' API available;
- // Another approach is implementing the similar feature by
- // java.net.NetworkInterface through JNI.
- NOTIMPLEMENTED();
- return IPv6SupportResult(true, IPV6_SUPPORT_MAX, 0);
-#elif defined(OS_POSIX)
- int test_socket = socket(AF_INET6, SOCK_STREAM, 0);
- if (test_socket == -1)
- return IPv6SupportResult(false, IPV6_CANNOT_CREATE_SOCKETS, errno);
- close(test_socket);
-
- // Check to see if any interface has a IPv6 address.
- struct ifaddrs* interface_addr = NULL;
- int rv = getifaddrs(&interface_addr);
- if (rv != 0) {
- // Don't yet block IPv6.
- return IPv6SupportResult(true, IPV6_GETIFADDRS_FAILED, errno);
- }
-
- bool found_ipv6 = false;
- for (struct ifaddrs* interface = interface_addr;
- interface != NULL;
- interface = interface->ifa_next) {
- if (!(IFF_UP & interface->ifa_flags))
- continue;
- if (IFF_LOOPBACK & interface->ifa_flags)
- continue;
- struct sockaddr* addr = interface->ifa_addr;
- if (!addr)
- continue;
- if (addr->sa_family != AF_INET6)
- continue;
- // Safe cast since this is AF_INET6.
- struct sockaddr_in6* addr_in6 =
- reinterpret_cast<struct sockaddr_in6*>(addr);
- struct in6_addr* sin6_addr = &addr_in6->sin6_addr;
- if (IN6_IS_ADDR_LOOPBACK(sin6_addr) || IN6_IS_ADDR_LINKLOCAL(sin6_addr))
- continue;
- found_ipv6 = true;
- break;
- }
- freeifaddrs(interface_addr);
- if (!found_ipv6)
- return IPv6SupportResult(false, IPV6_GLOBAL_ADDRESS_MISSING, 0);
-
- return IPv6SupportResult(true, IPV6_GLOBAL_ADDRESS_PRESENT, 0);
-#elif defined(OS_WIN)
- EnsureWinsockInit();
- SOCKET test_socket = socket(AF_INET6, SOCK_STREAM, 0);
- if (test_socket == INVALID_SOCKET) {
- return IPv6SupportResult(false,
- IPV6_CANNOT_CREATE_SOCKETS,
- WSAGetLastError());
- }
- closesocket(test_socket);
-
- // Check to see if any interface has a IPv6 address.
- // The GetAdaptersAddresses MSDN page recommends using a size of 15000 to
- // avoid reallocation.
- ULONG adapters_size = 15000;
- scoped_ptr_malloc<IP_ADAPTER_ADDRESSES> adapters;
- ULONG error;
- int num_tries = 0;
- do {
- adapters.reset(
- reinterpret_cast<PIP_ADAPTER_ADDRESSES>(malloc(adapters_size)));
- // Return only unicast addresses.
- error = GetAdaptersAddresses(AF_UNSPEC,
- GAA_FLAG_SKIP_ANYCAST |
- GAA_FLAG_SKIP_MULTICAST |
- GAA_FLAG_SKIP_DNS_SERVER |
- GAA_FLAG_SKIP_FRIENDLY_NAME,
- NULL, adapters.get(), &adapters_size);
- num_tries++;
- } while (error == ERROR_BUFFER_OVERFLOW && num_tries <= 3);
- if (error == ERROR_NO_DATA)
- return IPv6SupportResult(false, IPV6_GLOBAL_ADDRESS_MISSING, error);
- if (error != ERROR_SUCCESS) {
- // Don't yet block IPv6.
- return IPv6SupportResult(true, IPV6_GETIFADDRS_FAILED, error);
- }
-
- PIP_ADAPTER_ADDRESSES adapter;
- for (adapter = adapters.get(); adapter; adapter = adapter->Next) {
- if (adapter->OperStatus != IfOperStatusUp)
- continue;
- if (adapter->IfType == IF_TYPE_SOFTWARE_LOOPBACK)
- continue;
- PIP_ADAPTER_UNICAST_ADDRESS unicast_address;
- for (unicast_address = adapter->FirstUnicastAddress;
- unicast_address;
- unicast_address = unicast_address->Next) {
- if (unicast_address->Address.lpSockaddr->sa_family != AF_INET6)
- continue;
- // Safe cast since this is AF_INET6.
- struct sockaddr_in6* addr_in6 = reinterpret_cast<struct sockaddr_in6*>(
- unicast_address->Address.lpSockaddr);
- struct in6_addr* sin6_addr = &addr_in6->sin6_addr;
- if (IN6_IS_ADDR_LOOPBACK(sin6_addr) || IN6_IS_ADDR_LINKLOCAL(sin6_addr))
- continue;
- const uint8 kTeredoPrefix[] = { 0x20, 0x01, 0, 0 };
- if (!memcmp(sin6_addr->s6_addr, kTeredoPrefix, arraysize(kTeredoPrefix)))
- continue;
- return IPv6SupportResult(true, IPV6_GLOBAL_ADDRESS_PRESENT, 0);
- }
- }
-
- return IPv6SupportResult(false, IPV6_GLOBAL_ADDRESS_MISSING, 0);
-#else
- NOTIMPLEMENTED();
- return IPv6SupportResult(true, IPV6_SUPPORT_MAX, 0);
-#endif // defined(various platforms)
-}
-
-} // namespace
-
-IPv6SupportResult::IPv6SupportResult(bool ipv6_supported,
- IPv6SupportStatus ipv6_support_status,
- int os_error)
- : ipv6_supported(ipv6_supported),
- ipv6_support_status(ipv6_support_status),
- os_error(os_error) {
-}
-
-base::Value* IPv6SupportResult::ToNetLogValue(
- NetLog::LogLevel /* log_level */) const {
- base::DictionaryValue* dict = new base::DictionaryValue();
- dict->SetBoolean("ipv6_supported", ipv6_supported);
- dict->SetString("ipv6_support_status",
- kFinalStatusNames[ipv6_support_status]);
- if (os_error)
- dict->SetInteger("os_error", os_error);
- return dict;
-}
-
-IPv6SupportResult TestIPv6Support() {
- IPv6SupportResult result = TestIPv6SupportInternal();
-
- // Record UMA.
- if (result.ipv6_support_status != IPV6_SUPPORT_MAX) {
- static bool run_once = false;
- if (!run_once) {
- run_once = true;
- UMA_HISTOGRAM_ENUMERATION("Net.IPv6Status",
- result.ipv6_support_status,
- IPV6_SUPPORT_MAX);
- } else {
- UMA_HISTOGRAM_ENUMERATION("Net.IPv6Status_retest",
- result.ipv6_support_status,
- IPV6_SUPPORT_MAX);
- }
- }
- return result;
-}
-
bool HaveOnlyLoopbackAddresses() {
#if defined(OS_ANDROID)
return android::HaveOnlyLoopbackAddresses();
diff --git a/net/base/net_util.h b/net/base/net_util.h
index c5d49fa..c139760 100644
--- a/net/base/net_util.h
+++ b/net/base/net_util.h
@@ -419,41 +419,6 @@ class NET_EXPORT ScopedPortException {
DISALLOW_COPY_AND_ASSIGN(ScopedPortException);
};
-// These are used for UMA histograms. Any new values must be added to the end.
-enum IPv6SupportStatus {
- IPV6_CANNOT_CREATE_SOCKETS,
- IPV6_CAN_CREATE_SOCKETS, // Obsolete
- IPV6_GETIFADDRS_FAILED,
- IPV6_GLOBAL_ADDRESS_MISSING,
- IPV6_GLOBAL_ADDRESS_PRESENT,
- IPV6_INTERFACE_ARRAY_TOO_SHORT,
- IPV6_SUPPORT_MAX // Bounding value for enumeration. Also used for case
- // where detection is not supported.
-};
-
-// Encapsulates the results of an IPv6 probe.
-struct NET_EXPORT IPv6SupportResult {
- IPv6SupportResult(bool ipv6_supported,
- IPv6SupportStatus ipv6_support_status,
- int os_error);
-
- // Serializes the results to a Value. Caller takes ownership of the returned
- // Value.
- base::Value* ToNetLogValue(NetLog::LogLevel log_level) const;
-
- bool ipv6_supported;
- // Set to IPV6_SUPPORT_MAX if detection isn't supported.
- IPv6SupportStatus ipv6_support_status;
-
- // Error code from the OS, or zero if there was no error.
- int os_error;
-};
-
-// Perform a simplistic test to see if IPv6 is supported by trying to create an
-// IPv6 socket.
-// TODO(jar): Make test more in-depth as needed.
-NET_EXPORT IPv6SupportResult TestIPv6Support();
-
// Returns true if it can determine that only loopback addresses are configured.
// i.e. if only 127.0.0.1 and ::1 are routable.
// Also returns false if it cannot determine this.
diff --git a/net/dns/host_resolver.cc b/net/dns/host_resolver.cc
index 733d3d7..d74be91 100644
--- a/net/dns/host_resolver.cc
+++ b/net/dns/host_resolver.cc
@@ -109,9 +109,6 @@ AddressFamily HostResolver::GetDefaultAddressFamily() const {
return ADDRESS_FAMILY_UNSPECIFIED;
}
-void HostResolver::ProbeIPv6Support() {
-}
-
void HostResolver::SetDnsClientEnabled(bool enabled) {
}
diff --git a/net/dns/host_resolver.h b/net/dns/host_resolver.h
index 1adf8b7..558a1dd 100644
--- a/net/dns/host_resolver.h
+++ b/net/dns/host_resolver.h
@@ -170,10 +170,6 @@ class NET_EXPORT HostResolver {
virtual void SetDefaultAddressFamily(AddressFamily address_family) {}
virtual AddressFamily GetDefaultAddressFamily() const;
- // Continuously observe whether IPv6 is supported, and set the allowable
- // address family to IPv4 iff IPv6 is not supported.
- virtual void ProbeIPv6Support();
-
// Enable or disable the built-in asynchronous DnsClient.
virtual void SetDnsClientEnabled(bool enabled);
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index 87de903..f4dbe6b 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -922,54 +922,6 @@ class HostResolverImpl::ProcTask
//-----------------------------------------------------------------------------
-// Wraps a call to TestIPv6Support to be executed on the WorkerPool as it takes
-// 40-100ms.
-// TODO(szym): Remove altogether, if IPv6ActiveProbe works.
-class HostResolverImpl::IPv6ProbeJob {
- public:
- IPv6ProbeJob(const base::WeakPtr<HostResolverImpl>& resolver, NetLog* net_log)
- : resolver_(resolver),
- net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_IPV6_PROBE_JOB)),
- result_(false, IPV6_SUPPORT_MAX, OK) {
- DCHECK(resolver.get());
- net_log_.BeginEvent(NetLog::TYPE_IPV6_PROBE_RUNNING);
- const bool kIsSlow = true;
- base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
- base::Bind(&IPv6ProbeJob::DoProbe, base::Unretained(this)),
- base::Bind(&IPv6ProbeJob::OnProbeComplete, base::Owned(this)),
- kIsSlow);
- }
-
- virtual ~IPv6ProbeJob() {}
-
- private:
- // Runs on worker thread.
- void DoProbe() {
- result_ = TestIPv6Support();
- }
-
- void OnProbeComplete() {
- net_log_.EndEvent(NetLog::TYPE_IPV6_PROBE_RUNNING,
- base::Bind(&IPv6SupportResult::ToNetLogValue,
- base::Unretained(&result_)));
- if (!resolver_.get())
- return;
- resolver_->IPv6ProbeSetDefaultAddressFamily(
- result_.ipv6_supported ? ADDRESS_FAMILY_UNSPECIFIED
- : ADDRESS_FAMILY_IPV4);
- }
-
- // Used/set only on origin thread.
- base::WeakPtr<HostResolverImpl> resolver_;
-
- BoundNetLog net_log_;
-
- IPv6SupportResult result_;
-
- DISALLOW_COPY_AND_ASSIGN(IPv6ProbeJob);
-};
-
// Wraps a call to HaveOnlyLoopbackAddresses to be executed on the WorkerPool as
// it takes 40-100ms and should not block initialization.
class HostResolverImpl::LoopbackProbeJob {
@@ -1747,7 +1699,7 @@ HostResolverImpl::HostResolverImpl(
probe_weak_ptr_factory_(this),
received_dns_config_(false),
num_dns_failures_(0),
- ipv6_probe_monitoring_(false),
+ probe_ipv6_support_(true),
resolved_known_ipv6_hostname_(false),
additional_resolver_flags_(0),
fallback_to_proctask_(true) {
@@ -1927,21 +1879,13 @@ void HostResolverImpl::CancelRequest(RequestHandle req_handle) {
void HostResolverImpl::SetDefaultAddressFamily(AddressFamily address_family) {
DCHECK(CalledOnValidThread());
default_address_family_ = address_family;
- ipv6_probe_monitoring_ = false;
+ probe_ipv6_support_ = false;
}
AddressFamily HostResolverImpl::GetDefaultAddressFamily() const {
return default_address_family_;
}
-// TODO(szym): Remove this API altogether if IPv6ActiveProbe works.
-void HostResolverImpl::ProbeIPv6Support() {
- DCHECK(CalledOnValidThread());
- DCHECK(!ipv6_probe_monitoring_);
- ipv6_probe_monitoring_ = true;
- OnIPAddressChanged();
-}
-
void HostResolverImpl::SetDnsClientEnabled(bool enabled) {
DCHECK(CalledOnValidThread());
#if defined(ENABLE_BUILT_IN_DNS)
@@ -1986,7 +1930,7 @@ bool HostResolverImpl::ResolveAsIP(const Key& key,
HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6),
0) << " Unhandled flag";
bool ipv6_disabled = (default_address_family_ == ADDRESS_FAMILY_IPV4) &&
- !ipv6_probe_monitoring_;
+ !probe_ipv6_support_;
*net_error = OK;
if ((ip_number.size() == kIPv6AddressSize) && ipv6_disabled) {
*net_error = ERR_NAME_NOT_RESOLVED;
@@ -2083,20 +2027,6 @@ void HostResolverImpl::RemoveJob(Job* job) {
jobs_.erase(it);
}
-void HostResolverImpl::IPv6ProbeSetDefaultAddressFamily(
- AddressFamily address_family) {
- DCHECK(address_family == ADDRESS_FAMILY_UNSPECIFIED ||
- address_family == ADDRESS_FAMILY_IPV4);
- if (!ipv6_probe_monitoring_)
- return;
- if (default_address_family_ != address_family) {
- VLOG(1) << "IPv6Probe forced AddressFamily setting to "
- << ((address_family == ADDRESS_FAMILY_UNSPECIFIED) ?
- "ADDRESS_FAMILY_UNSPECIFIED" : "ADDRESS_FAMILY_IPV4");
- }
- default_address_family_ = address_family;
-}
-
void HostResolverImpl::SetHaveOnlyLoopbackAddresses(bool result) {
if (result) {
additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
@@ -2112,7 +2042,7 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
AddressFamily effective_address_family = info.address_family();
if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) {
- if (ipv6_probe_monitoring_) {
+ if (probe_ipv6_support_) {
base::TimeTicks start_time = base::TimeTicks::Now();
// Google DNS address.
const uint8 kIPv6Address[] =
@@ -2194,8 +2124,6 @@ void HostResolverImpl::OnIPAddressChanged() {
probe_weak_ptr_factory_.InvalidateWeakPtrs();
if (cache_.get())
cache_->clear();
- if (ipv6_probe_monitoring_)
- new IPv6ProbeJob(probe_weak_ptr_factory_.GetWeakPtr(), net_log_);
#if defined(OS_POSIX) && !defined(OS_MACOSX)
new LoopbackProbeJob(probe_weak_ptr_factory_.GetWeakPtr());
#endif
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index 5bce5ed..468d80e 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -141,7 +141,6 @@ class NET_EXPORT HostResolverImpl
virtual void CancelRequest(RequestHandle req) OVERRIDE;
virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE;
virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE;
- virtual void ProbeIPv6Support() OVERRIDE;
virtual void SetDnsClientEnabled(bool enabled) OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
virtual base::Value* GetDnsConfigAsValue() const OVERRIDE;
@@ -150,7 +149,6 @@ class NET_EXPORT HostResolverImpl
friend class HostResolverImplTest;
class Job;
class ProcTask;
- class IPv6ProbeJob;
class LoopbackProbeJob;
class DnsTask;
class Request;
@@ -188,9 +186,6 @@ class NET_EXPORT HostResolverImpl
const RequestInfo& info,
AddressList* addresses);
- // Callback from IPv6 probe activity.
- void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family);
-
// Callback from HaveOnlyLoopbackAddresses probe.
void SetHaveOnlyLoopbackAddresses(bool result);
@@ -267,10 +262,9 @@ class NET_EXPORT HostResolverImpl
// Number of consecutive failures of DnsTask, counted when fallback succeeds.
unsigned num_dns_failures_;
- // Indicate if probing is done after each network change event to set address
- // family. When false, explicit setting of address family is used and results
- // of the IPv6 probe job are ignored.
- bool ipv6_probe_monitoring_;
+ // True if probing is done for each Request to set address family. When false,
+ // explicit setting in |default_address_family_| is used.
+ bool probe_ipv6_support_;
// True iff ProcTask has successfully resolved a hostname known to have IPv6
// addresses using ADDRESS_FAMILY_UNSPECIFIED. Reset on IP address change.
diff --git a/net/dns/host_resolver_impl_unittest.cc b/net/dns/host_resolver_impl_unittest.cc
index 93f6c5a..60c3df2 100644
--- a/net/dns/host_resolver_impl_unittest.cc
+++ b/net/dns/host_resolver_impl_unittest.cc
@@ -1277,6 +1277,8 @@ class HostResolverImplDnsTest : public HostResolverImplTest {
DefaultLimits(),
DefaultParams(proc_.get()),
NULL));
+ // Disable IPv6 support probing.
+ resolver_->SetDefaultAddressFamily(ADDRESS_FAMILY_UNSPECIFIED);
resolver_->SetDnsClient(CreateMockDnsClient(DnsConfig(), dns_rules_));
}
diff --git a/net/dns/mapped_host_resolver.cc b/net/dns/mapped_host_resolver.cc
index 5c0383c0..4db7bc9 100644
--- a/net/dns/mapped_host_resolver.cc
+++ b/net/dns/mapped_host_resolver.cc
@@ -46,10 +46,6 @@ void MappedHostResolver::CancelRequest(RequestHandle req) {
impl_->CancelRequest(req);
}
-void MappedHostResolver::ProbeIPv6Support() {
- impl_->ProbeIPv6Support();
-}
-
HostCache* MappedHostResolver::GetHostCache() {
return impl_->GetHostCache();
}
diff --git a/net/dns/mapped_host_resolver.h b/net/dns/mapped_host_resolver.h
index db64689..50062a9 100644
--- a/net/dns/mapped_host_resolver.h
+++ b/net/dns/mapped_host_resolver.h
@@ -54,7 +54,6 @@ class NET_EXPORT MappedHostResolver : public HostResolver {
AddressList* addresses,
const BoundNetLog& net_log) OVERRIDE;
virtual void CancelRequest(RequestHandle req) OVERRIDE;
- virtual void ProbeIPv6Support() OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
private: