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

Unified Diff: net/quic/quic_framer.cc

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_framer.cc
diff --git a/net/quic/quic_framer.cc b/net/quic/quic_framer.cc
index 67a376ea6e61dc5879eb49b2e1df0fe3100a2c06..0e56382f942783bbb3f84c522357caafc81bf421 100644
--- a/net/quic/quic_framer.cc
+++ b/net/quic/quic_framer.cc
@@ -102,6 +102,14 @@ size_t QuicFramer::GetMinGoAwayFrameSize() {
kQuicStreamIdSize;
}
+// static
+// TODO(satyamshekhar): 16 - Crypto hash for integrity. Not a static value. Use
+// QuicEncrypter::GetMaxPlaintextSize.
+size_t QuicFramer::GetMaxUnackedPackets(bool include_version) {
+ return (kMaxPacketSize - GetPacketHeaderSize(include_version) -
+ GetMinAckFrameSize() - 16) / kSequenceNumberSize;
+}
+
bool QuicFramer::IsSupportedVersion(QuicTag version) {
return version == kQuicVersion1;
}
@@ -313,6 +321,8 @@ QuicEncryptedPacket* QuicFramer::ConstructVersionNegotiationPacket(
}
bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
+ // TODO(satyamshekhar): Don't RaiseError (and close the connection) for
+ // invalid (unauthenticated) packets.
DCHECK(!reader_.get());
reader_.reset(new QuicDataReader(packet.data(), packet.length()));
@@ -409,15 +419,14 @@ bool QuicFramer::ProcessPublicResetPacket(
const QuicPacketPublicHeader& public_header) {
QuicPublicResetPacket packet(public_header);
if (!reader_->ReadUInt64(&packet.nonce_proof)) {
- // TODO(satyamshekhar): Raise error.
set_detailed_error("Unable to read nonce proof.");
- return false;
+ return RaiseError(QUIC_INVALID_PUBLIC_RST_PACKET);
}
// TODO(satyamshekhar): validate nonce to protect against DoS.
if (!reader_->ReadUInt48(&packet.rejected_sequence_number)) {
set_detailed_error("Unable to read rejected sequence number.");
- return false;
+ return RaiseError(QUIC_INVALID_PUBLIC_RST_PACKET);
}
visitor_->OnPublicResetPacket(packet);
return true;
@@ -431,8 +440,9 @@ bool QuicFramer::ProcessRevivedPacket(QuicPacketHeader* header,
header->entropy_hash = GetPacketEntropyHash(*header);
- // TODO(satyamshekhar): Don't process if the visitor refuses the header.
- visitor_->OnPacketHeader(*header);
+ if (!visitor_->OnPacketHeader(*header)) {
+ return true;
+ }
if (payload.length() > kMaxPacketSize) {
set_detailed_error("Revived packet too large.");
@@ -704,6 +714,13 @@ bool QuicFramer::ProcessFrameData() {
if (!ProcessConnectionCloseFrame(&frame)) {
return RaiseError(QUIC_INVALID_CONNECTION_CLOSE_DATA);
}
+
+ if (!visitor_->OnAckFrame(frame.ack_frame)) {
+ DLOG(INFO) << "Visitor asked to stopped further processing.";
+ // Returning true since there was no parsing error.
+ return true;
+ }
+
if (!visitor_->OnConnectionCloseFrame(frame)) {
DLOG(INFO) << "Visitor asked to stopped further processing.";
// Returning true since there was no parsing error.
@@ -988,12 +1005,6 @@ bool QuicFramer::ProcessConnectionCloseFrame(QuicConnectionCloseFrame* frame) {
return false;
}
- if (!visitor_->OnAckFrame(frame->ack_frame)) {
- DLOG(INFO) << "Visitor asked to stopped further processing.";
- // Returning true since there was no parsing error.
- return true;
- }
-
return true;
}
« no previous file with comments | « net/quic/quic_framer.h ('k') | net/quic/quic_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698