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

Side by Side Diff: net/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 | « no previous file | net/tools/quic/quic_dispatcher.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_dispatcher.h" 5 #include "net/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 // in OnAuthenticatedHeader. 197 // in OnAuthenticatedHeader.
198 framer_.ProcessPacket(packet); 198 framer_.ProcessPacket(packet);
199 // TODO(rjshade): Return a status describing if/why a packet was dropped, 199 // TODO(rjshade): Return a status describing if/why a packet was dropped,
200 // and log somehow. Maybe expose as a varz. 200 // and log somehow. Maybe expose as a varz.
201 } 201 }
202 202
203 bool QuicDispatcher::OnUnauthenticatedPublicHeader( 203 bool QuicDispatcher::OnUnauthenticatedPublicHeader(
204 const QuicPacketPublicHeader& header) { 204 const QuicPacketPublicHeader& header) {
205 QuicSession* session = nullptr; 205 QuicSession* session = nullptr;
206 206
207 // Port zero is only allowed for unidirectional UDP, so is disallowed by QUIC.
208 // Given that we can't even send a reply rejecting the packet, just black hole
209 // it.
210 if (current_client_address_.port() == 0) {
211 return false;
212 }
213
207 QuicConnectionId connection_id = header.connection_id; 214 QuicConnectionId connection_id = header.connection_id;
208 SessionMap::iterator it = session_map_.find(connection_id); 215 SessionMap::iterator it = session_map_.find(connection_id);
209 if (it == session_map_.end()) { 216 if (it == session_map_.end()) {
210 if (header.reset_flag) { 217 if (header.reset_flag) {
211 return false; 218 return false;
212 } 219 }
213 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) { 220 if (time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)) {
214 return HandlePacketForTimeWait(header); 221 return HandlePacketForTimeWait(header);
215 } 222 }
216 223
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 // be parsed correctly. 399 // be parsed correctly.
393 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( 400 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId(
394 header.connection_id)); 401 header.connection_id));
395 402
396 // Continue parsing the packet to extract the sequence number. Then 403 // Continue parsing the packet to extract the sequence number. Then
397 // send it to the time wait manager in OnUnathenticatedHeader. 404 // send it to the time wait manager in OnUnathenticatedHeader.
398 return true; 405 return true;
399 } 406 }
400 407
401 } // namespace net 408 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698