summaryrefslogtreecommitdiffstats
path: root/net/dns
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 19:37:38 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 19:37:38 +0000
commit2b74a2ff3565bd35f6b433efb22785f697fe31be (patch)
tree1e10c43e8957a3d091c667c1e824dda3a6cb5d53 /net/dns
parent6f00e605d586d3d564116d7c2a4a7c7e1ff2eaaf (diff)
downloadchromium_src-2b74a2ff3565bd35f6b433efb22785f697fe31be.zip
chromium_src-2b74a2ff3565bd35f6b433efb22785f697fe31be.tar.gz
chromium_src-2b74a2ff3565bd35f6b433efb22785f697fe31be.tar.bz2
Add local address of UDP sockets used to check IPv6 support to NetLog
Adds UDP_LOCAL_ADDRESS NetLog event, and logs the UDP sockets used to determine IPv6 support. BUG=259792 Review URL: https://chromiumcodereview.appspot.com/19492013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/dns')
-rw-r--r--net/dns/host_resolver_impl.cc17
-rw-r--r--net/dns/host_resolver_impl.h3
2 files changed, 12 insertions, 8 deletions
diff --git a/net/dns/host_resolver_impl.cc b/net/dns/host_resolver_impl.cc
index c86f963..92694af 100644
--- a/net/dns/host_resolver_impl.cc
+++ b/net/dns/host_resolver_impl.cc
@@ -171,13 +171,14 @@ bool ResemblesMulticastDNSName(const std::string& hostname) {
}
// Attempts to connect a UDP socket to |dest|:80.
-bool IsGloballyReachable(const IPAddressNumber& dest) {
+bool IsGloballyReachable(const IPAddressNumber& dest,
+ const BoundNetLog& net_log) {
scoped_ptr<DatagramClientSocket> socket(
ClientSocketFactory::GetDefaultFactory()->CreateDatagramClientSocket(
DatagramSocket::DEFAULT_BIND,
RandIntCallback(),
- NULL,
- NetLog::Source()));
+ net_log.net_log(),
+ net_log.source()));
int rv = socket->Connect(IPEndPoint(dest, 80));
if (rv != OK)
return false;
@@ -1750,7 +1751,7 @@ int HostResolverImpl::Resolve(const RequestInfo& info,
// Build a key that identifies the request in the cache and in the
// outstanding jobs map.
- Key key = GetEffectiveKeyForRequest(info);
+ Key key = GetEffectiveKeyForRequest(info, request_net_log);
int rv = ResolveHelper(key, info, addresses, request_net_log);
if (rv != ERR_DNS_CACHE_MISS) {
@@ -1838,7 +1839,7 @@ int HostResolverImpl::ResolveFromCache(const RequestInfo& info,
// Update the net log and notify registered observers.
LogStartRequest(source_net_log, request_net_log, info);
- Key key = GetEffectiveKeyForRequest(info);
+ Key key = GetEffectiveKeyForRequest(info, request_net_log);
int rv = ResolveHelper(key, info, addresses, request_net_log);
LogFinishRequest(source_net_log, request_net_log, info, rv);
@@ -2014,7 +2015,7 @@ void HostResolverImpl::SetHaveOnlyLoopbackAddresses(bool result) {
}
HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
- const RequestInfo& info) const {
+ const RequestInfo& info, const BoundNetLog& net_log) const {
HostResolverFlags effective_flags =
info.host_resolver_flags() | additional_resolver_flags_;
AddressFamily effective_address_family = info.address_family();
@@ -2028,7 +2029,9 @@ HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest(
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 };
IPAddressNumber address(kIPv6Address,
kIPv6Address + arraysize(kIPv6Address));
- bool rv6 = IsGloballyReachable(address);
+ bool rv6 = IsGloballyReachable(address, net_log);
+ if (rv6)
+ net_log.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_IPV6_SUPPORTED);
UMA_HISTOGRAM_TIMES("Net.IPv6ConnectDuration",
base::TimeTicks::Now() - start_time);
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h
index 468d80e..928d07a 100644
--- a/net/dns/host_resolver_impl.h
+++ b/net/dns/host_resolver_impl.h
@@ -192,7 +192,8 @@ class NET_EXPORT HostResolverImpl
// Returns the (hostname, address_family) key to use for |info|, choosing an
// "effective" address family by inheriting the resolver's default address
// family when the request leaves it unspecified.
- Key GetEffectiveKeyForRequest(const RequestInfo& info) const;
+ Key GetEffectiveKeyForRequest(const RequestInfo& info,
+ const BoundNetLog& net_log) const;
// Records the result in cache if cache is present.
void CacheResult(const Key& key,