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

Side by Side Diff: net/quic/core/quic_packet_creator.cc

Issue 2403383002: external-release-note: Adding a flag for enforcement of the single-packet-CHLO policy. (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 | « net/quic/core/quic_flags_list.h ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/core/quic_packet_creator.h" 5 #include "net/quic/core/quic_packet_creator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 if (!HasRoomForStreamFrame(id, offset)) { 131 if (!HasRoomForStreamFrame(id, offset)) {
132 return false; 132 return false;
133 } 133 }
134 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame); 134 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame);
135 // Explicitly disallow multi-packet CHLOs. 135 // Explicitly disallow multi-packet CHLOs.
136 if (id == kCryptoStreamId && 136 if (id == kCryptoStreamId &&
137 frame->stream_frame->data_length >= sizeof(kCHLO) && 137 frame->stream_frame->data_length >= sizeof(kCHLO) &&
138 strncmp(frame->stream_frame->data_buffer, 138 strncmp(frame->stream_frame->data_buffer,
139 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) { 139 reinterpret_cast<const char*>(&kCHLO), sizeof(kCHLO)) == 0) {
140 DCHECK_EQ(static_cast<size_t>(0), iov_offset); 140 DCHECK_EQ(static_cast<size_t>(0), iov_offset);
141 if (frame->stream_frame->data_length < iov.iov->iov_len) { 141 if (FLAGS_quic_enforce_single_packet_chlo &&
142 frame->stream_frame->data_length < iov.iov->iov_len) {
142 const string error_details = "Client hello won't fit in a single packet."; 143 const string error_details = "Client hello won't fit in a single packet.";
143 QUIC_BUG << error_details << " Constructed stream frame length: " 144 QUIC_BUG << error_details << " Constructed stream frame length: "
144 << frame->stream_frame->data_length 145 << frame->stream_frame->data_length
145 << " CHLO length: " << iov.iov->iov_len; 146 << " CHLO length: " << iov.iov->iov_len;
146 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details, 147 delegate_->OnUnrecoverableError(QUIC_CRYPTO_CHLO_TOO_LARGE, error_details,
147 ConnectionCloseSource::FROM_SELF); 148 ConnectionCloseSource::FROM_SELF);
148 delete frame->stream_frame; 149 delete frame->stream_frame;
149 return false; 150 return false;
150 } 151 }
151 } 152 }
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 if (bit_mask_ == 0) { 682 if (bit_mask_ == 0) {
682 bit_bucket_ = random_->RandUint64(); 683 bit_bucket_ = random_->RandUint64();
683 bit_mask_ = 1; 684 bit_mask_ = 1;
684 } 685 }
685 bool result = ((bit_bucket_ & bit_mask_) != 0); 686 bool result = ((bit_bucket_ & bit_mask_) != 0);
686 bit_mask_ <<= 1; 687 bit_mask_ <<= 1;
687 return result; 688 return result;
688 } 689 }
689 690
690 } // namespace net 691 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_flags_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698