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

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

Issue 2438613007: When a QUIC PublicReset packet is received, Log the client IP from both the SHLO and the PublicReset (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromium/quic_connection_logger.h" 5 #include "net/quic/chromium/quic_connection_logger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 216 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
217 base::ListValue* versions = new base::ListValue(); 217 base::ListValue* versions = new base::ListValue();
218 dict->Set("versions", versions); 218 dict->Set("versions", versions);
219 for (QuicVersionVector::const_iterator it = packet->versions.begin(); 219 for (QuicVersionVector::const_iterator it = packet->versions.begin();
220 it != packet->versions.end(); ++it) { 220 it != packet->versions.end(); ++it) {
221 versions->AppendString(QuicVersionToString(*it)); 221 versions->AppendString(QuicVersionToString(*it));
222 } 222 }
223 return std::move(dict); 223 return std::move(dict);
224 } 224 }
225 225
226 std::unique_ptr<base::Value> NetLogQuicPublicResetPacketCallback(
227 const IPEndPoint* server_hello_address,
228 const IPEndPoint* public_reset_address,
229 NetLogCaptureMode /* capture_mode */) {
230 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
231 dict->SetString("server_hello_address", server_hello_address->ToString());
232 dict->SetString("public_reset_address", public_reset_address->ToString());
233 return std::move(dict);
234 }
235
226 std::unique_ptr<base::Value> NetLogQuicCryptoHandshakeMessageCallback( 236 std::unique_ptr<base::Value> NetLogQuicCryptoHandshakeMessageCallback(
227 const CryptoHandshakeMessage* message, 237 const CryptoHandshakeMessage* message,
228 NetLogCaptureMode /* capture_mode */) { 238 NetLogCaptureMode /* capture_mode */) {
229 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 239 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
230 dict->SetString("quic_crypto_handshake_message", message->DebugString()); 240 dict->SetString("quic_crypto_handshake_message", message->DebugString());
231 return std::move(dict); 241 return std::move(dict);
232 } 242 }
233 243
234 std::unique_ptr<base::Value> NetLogQuicOnConnectionClosedCallback( 244 std::unique_ptr<base::Value> NetLogQuicOnConnectionClosedCallback(
235 QuicErrorCode error, 245 QuicErrorCode error,
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); 628 base::Bind(&NetLogQuicGoAwayFrameCallback, &frame));
619 } 629 }
620 630
621 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { 631 void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) {
622 // PingFrame has no contents to log, so just record that it was received. 632 // PingFrame has no contents to log, so just record that it was received.
623 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED); 633 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PING_FRAME_RECEIVED);
624 } 634 }
625 635
626 void QuicConnectionLogger::OnPublicResetPacket( 636 void QuicConnectionLogger::OnPublicResetPacket(
627 const QuicPublicResetPacket& packet) { 637 const QuicPublicResetPacket& packet) {
628 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); 638 net_log_.AddEvent(
639 NetLogEventType::QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED,
640 base::Bind(&NetLogQuicPublicResetPacketCallback,
641 &local_address_from_shlo_, &packet.client_address));
629 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_, 642 UpdatePublicResetAddressMismatchHistogram(local_address_from_shlo_,
630 packet.client_address); 643 packet.client_address);
631 } 644 }
632 645
633 void QuicConnectionLogger::OnVersionNegotiationPacket( 646 void QuicConnectionLogger::OnVersionNegotiationPacket(
634 const QuicVersionNegotiationPacket& packet) { 647 const QuicVersionNegotiationPacket& packet) {
635 net_log_.AddEvent( 648 net_log_.AddEvent(
636 NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED, 649 NetLogEventType::QUIC_SESSION_VERSION_NEGOTIATION_PACKET_RECEIVED,
637 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet)); 650 base::Bind(&NetLogQuicVersionNegotiationPacketCallback, &packet));
638 } 651 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 754
742 string prefix("Net.QuicSession.PacketLossRate_"); 755 string prefix("Net.QuicSession.PacketLossRate_");
743 base::HistogramBase* histogram = base::Histogram::FactoryGet( 756 base::HistogramBase* histogram = base::Histogram::FactoryGet(
744 prefix + connection_description_, 1, 1000, 75, 757 prefix + connection_description_, 1, 1000, 75,
745 base::HistogramBase::kUmaTargetedHistogramFlag); 758 base::HistogramBase::kUmaTargetedHistogramFlag);
746 histogram->Add(static_cast<base::HistogramBase::Sample>( 759 histogram->Add(static_cast<base::HistogramBase::Sample>(
747 ReceivedPacketLossRate() * 1000)); 760 ReceivedPacketLossRate() * 1000));
748 } 761 }
749 762
750 } // namespace net 763 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698