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

Side by Side Diff: net/tools/quic/quic_dispatcher.cc

Issue 885713009: Improving junk packet handling for QUIC by ignoring packets with client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@removing_deprecated_flag_84999682
Patch Set: Created 5 years, 10 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/quic_dispatcher.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | 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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 // in OnAuthenticatedHeader. 202 // in OnAuthenticatedHeader.
203 framer_.ProcessPacket(packet); 203 framer_.ProcessPacket(packet);
204 // TODO(rjshade): Return a status describing if/why a packet was dropped, 204 // TODO(rjshade): Return a status describing if/why a packet was dropped,
205 // and log somehow. Maybe expose as a varz. 205 // and log somehow. Maybe expose as a varz.
206 } 206 }
207 207
208 bool QuicDispatcher::OnUnauthenticatedPublicHeader( 208 bool QuicDispatcher::OnUnauthenticatedPublicHeader(
209 const QuicPacketPublicHeader& header) { 209 const QuicPacketPublicHeader& header) {
210 QuicSession* session = nullptr; 210 QuicSession* session = nullptr;
211 211
212 // Port zero is only allowed for unidirectional UDP, so is disallowed by QUIC.
213 // Given that we can't even send a reply rejecting the packet, just black hole
214 // it.
215 if (current_client_address_.port() == 0) {
216 return false;
217 }
218
212 QuicConnectionId connection_id = header.connection_id; 219 QuicConnectionId connection_id = header.connection_id;
213 SessionMap::iterator it = session_map_.find(connection_id); 220 SessionMap::iterator it = session_map_.find(connection_id);
214 if (it == session_map_.end()) { 221 if (it == session_map_.end()) {
215 if (header.reset_flag) { 222 if (header.reset_flag) {
216 return false; 223 return false;
217 } 224 }
218 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) { 225 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) {
219 return HandlePacketForTimeWait(header); 226 return HandlePacketForTimeWait(header);
220 } 227 }
221 228
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( 412 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId(
406 header.connection_id)); 413 header.connection_id));
407 414
408 // Continue parsing the packet to extract the sequence number. Then 415 // Continue parsing the packet to extract the sequence number. Then
409 // send it to the time wait manager in OnUnathenticatedHeader. 416 // send it to the time wait manager in OnUnathenticatedHeader.
410 return true; 417 return true;
411 } 418 }
412 419
413 } // namespace tools 420 } // namespace tools
414 } // namespace net 421 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_dispatcher.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698