Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Side by Side Diff: net/quic/quic_connection_logger.cc

Issue 294823002: Treat IPv4-mapped IPv6 addresses as IPv4 addresses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/quic_connection_logger.h" 5 #include "net/quic/quic_connection_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 244
245 void UpdatePublicResetAddressMismatchHistogram( 245 void UpdatePublicResetAddressMismatchHistogram(
246 const IPEndPoint& server_hello_address, 246 const IPEndPoint& server_hello_address,
247 const IPEndPoint& public_reset_address) { 247 const IPEndPoint& public_reset_address) {
248 int sample = GetAddressMismatch(server_hello_address, public_reset_address); 248 int sample = GetAddressMismatch(server_hello_address, public_reset_address);
249 // We are seemingly talking to an older server that does not support the 249 // We are seemingly talking to an older server that does not support the
250 // feature, so we can't report the results in the histogram. 250 // feature, so we can't report the results in the histogram.
251 if (sample < 0) { 251 if (sample < 0) {
252 return; 252 return;
253 } 253 }
254 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch", 254 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.PublicResetAddressMismatch2",
255 sample, QUIC_ADDRESS_MISMATCH_MAX); 255 sample, QUIC_ADDRESS_MISMATCH_MAX);
256 } 256 }
257 257
258 const char* GetConnectionDescriptionString() { 258 const char* GetConnectionDescriptionString() {
259 NetworkChangeNotifier::ConnectionType type = 259 NetworkChangeNotifier::ConnectionType type =
260 NetworkChangeNotifier::GetConnectionType(); 260 NetworkChangeNotifier::GetConnectionType();
261 const char* description = NetworkChangeNotifier::ConnectionTypeToString(type); 261 const char* description = NetworkChangeNotifier::ConnectionTypeToString(type);
262 // Most platforms don't distingish Wifi vs Etherenet, and call everything 262 // Most platforms don't distingish Wifi vs Etherenet, and call everything
263 // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi, 263 // CONNECTION_UNKNOWN :-(. We'll tease out some details when we are on WiFi,
264 // and hopefully leave only ethernet (with no WiFi available) in the 264 // and hopefully leave only ethernet (with no WiFi available) in the
(...skipping 28 matching lines...) Expand all
293 description = "CONNECTION_WIFI_802.11n"; 293 description = "CONNECTION_WIFI_802.11n";
294 break; 294 break;
295 case WIFI_PHY_LAYER_PROTOCOL_UNKNOWN: 295 case WIFI_PHY_LAYER_PROTOCOL_UNKNOWN:
296 // Unclassified mode or failure to identify. 296 // Unclassified mode or failure to identify.
297 break; 297 break;
298 } 298 }
299 } 299 }
300 return description; 300 return description;
301 } 301 }
302 302
303 // If |address| is an IPv4-mapped IPv6 address, returns ADDRESS_FAMILY_IPV4
304 // instead of ADDRESS_FAMILY_IPV6. Othewise, behaves like GetAddressFamily().
305 AddressFamily GetRealAddressFamily(const IPAddressNumber& address) {
306 return IsIPv4Mapped(address) ? ADDRESS_FAMILY_IPV4 :
307 GetAddressFamily(address);
308 }
303 309
304 } // namespace 310 } // namespace
305 311
306 QuicConnectionLogger::QuicConnectionLogger(const BoundNetLog& net_log) 312 QuicConnectionLogger::QuicConnectionLogger(const BoundNetLog& net_log)
307 : net_log_(net_log), 313 : net_log_(net_log),
308 last_received_packet_sequence_number_(0), 314 last_received_packet_sequence_number_(0),
309 last_received_packet_size_(0), 315 last_received_packet_size_(0),
310 largest_received_packet_sequence_number_(0), 316 largest_received_packet_sequence_number_(0),
311 largest_received_missing_packet_sequence_number_(0), 317 largest_received_missing_packet_sequence_number_(0),
312 num_out_of_order_received_packets_(0), 318 num_out_of_order_received_packets_(0),
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED, 429 NetLog::TYPE_QUIC_SESSION_PACKET_RETRANSMITTED,
424 base::Bind(&NetLogQuicPacketRetransmittedCallback, 430 base::Bind(&NetLogQuicPacketRetransmittedCallback,
425 old_sequence_number, new_sequence_number)); 431 old_sequence_number, new_sequence_number));
426 } 432 }
427 433
428 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address, 434 void QuicConnectionLogger::OnPacketReceived(const IPEndPoint& self_address,
429 const IPEndPoint& peer_address, 435 const IPEndPoint& peer_address,
430 const QuicEncryptedPacket& packet) { 436 const QuicEncryptedPacket& packet) {
431 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) { 437 if (local_address_from_self_.GetFamily() == ADDRESS_FAMILY_UNSPECIFIED) {
432 local_address_from_self_ = self_address; 438 local_address_from_self_ = self_address;
433 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf", 439 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromSelf",
wtc 2014/05/19 23:24:12 Ryan: on your suggestion, I didn't rename your two
434 self_address.GetFamily(), 440 GetRealAddressFamily(self_address.address()),
Ryan Hamilton 2014/05/20 00:26:35 I believe we don't need to do the canonicalizing h
435 ADDRESS_FAMILY_LAST); 441 ADDRESS_FAMILY_LAST);
436 } 442 }
437 443
438 last_received_packet_size_ = packet.length(); 444 last_received_packet_size_ = packet.length();
439 net_log_.AddEvent( 445 net_log_.AddEvent(
440 NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED, 446 NetLog::TYPE_QUIC_SESSION_PACKET_RECEIVED,
441 base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address, 447 base::Bind(&NetLogQuicPacketCallback, &self_address, &peer_address,
442 packet.length())); 448 packet.length()));
443 } 449 }
444 450
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED, 593 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_RECEIVED,
588 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); 594 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message));
589 595
590 if (message.tag() == kSHLO) { 596 if (message.tag() == kSHLO) {
591 StringPiece address; 597 StringPiece address;
592 QuicSocketAddressCoder decoder; 598 QuicSocketAddressCoder decoder;
593 if (message.GetStringPiece(kCADR, &address) && 599 if (message.GetStringPiece(kCADR, &address) &&
594 decoder.Decode(address.data(), address.size())) { 600 decoder.Decode(address.data(), address.size())) {
595 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port()); 601 local_address_from_shlo_ = IPEndPoint(decoder.ip(), decoder.port());
596 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromPeer", 602 UMA_HISTOGRAM_ENUMERATION("Net.QuicSession.ConnectionTypeFromPeer",
597 local_address_from_shlo_.GetFamily(), 603 GetRealAddressFamily(
604 local_address_from_shlo_.address()),
598 ADDRESS_FAMILY_LAST); 605 ADDRESS_FAMILY_LAST);
599 } 606 }
600 } 607 }
601 } 608 }
602 609
603 void QuicConnectionLogger::OnCryptoHandshakeMessageSent( 610 void QuicConnectionLogger::OnCryptoHandshakeMessageSent(
604 const CryptoHandshakeMessage& message) { 611 const CryptoHandshakeMessage& message) {
605 net_log_.AddEvent( 612 net_log_.AddEvent(
606 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT, 613 NetLog::TYPE_QUIC_SESSION_CRYPTO_HANDSHAKE_MESSAGE_SENT,
607 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message)); 614 base::Bind(&NetLogQuicCryptoHandshakeMessageCallback, &message));
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 continue; 790 continue;
784 } 791 }
785 // Record some overlapping patterns, to get a better picture, since this is 792 // Record some overlapping patterns, to get a better picture, since this is
786 // not very expensive. 793 // not very expensive.
787 if (i % 3 == 0) 794 if (i % 3 == 0)
788 six_packet_histogram->Add(recent_6_mask); 795 six_packet_histogram->Add(recent_6_mask);
789 } 796 }
790 } 797 }
791 798
792 } // namespace net 799 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698