OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |