| 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/quic/core/quic_connection.h" | 5 #include "net/quic/core/quic_connection.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) { | 586 bool QuicConnection::OnUnauthenticatedHeader(const QuicPacketHeader& header) { |
| 587 if (debug_visitor_ != nullptr) { | 587 if (debug_visitor_ != nullptr) { |
| 588 debug_visitor_->OnUnauthenticatedHeader(header); | 588 debug_visitor_->OnUnauthenticatedHeader(header); |
| 589 } | 589 } |
| 590 | 590 |
| 591 // Check that any public reset packet with a different connection ID that was | 591 // Check that any public reset packet with a different connection ID that was |
| 592 // routed to this QuicConnection has been redirected before control reaches | 592 // routed to this QuicConnection has been redirected before control reaches |
| 593 // here. | 593 // here. |
| 594 DCHECK_EQ(connection_id_, header.public_header.connection_id); | 594 DCHECK_EQ(connection_id_, header.public_header.connection_id); |
| 595 | 595 |
| 596 if (!FLAGS_quic_postpone_multipath_flag_validation) { | |
| 597 // Multipath is not enabled, but a packet with multipath flag on is | |
| 598 // received. | |
| 599 if (!multipath_enabled_ && header.public_header.multipath_flag) { | |
| 600 const string error_details = | |
| 601 "Received a packet with multipath flag but multipath is not enabled."; | |
| 602 QUIC_BUG << error_details; | |
| 603 CloseConnection(QUIC_BAD_MULTIPATH_FLAG, error_details, | |
| 604 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | |
| 605 return false; | |
| 606 } | |
| 607 } | |
| 608 if (!packet_generator_.IsPendingPacketEmpty()) { | 596 if (!packet_generator_.IsPendingPacketEmpty()) { |
| 609 // Incoming packets may change a queued ACK frame. | 597 // Incoming packets may change a queued ACK frame. |
| 610 const string error_details = | 598 const string error_details = |
| 611 "Pending frames must be serialized before incoming packets are " | 599 "Pending frames must be serialized before incoming packets are " |
| 612 "processed."; | 600 "processed."; |
| 613 QUIC_BUG << error_details; | 601 QUIC_BUG << error_details; |
| 614 CloseConnection(QUIC_INTERNAL_ERROR, error_details, | 602 CloseConnection(QUIC_INTERNAL_ERROR, error_details, |
| 615 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 603 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 616 return false; | 604 return false; |
| 617 } | 605 } |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 } | 1411 } |
| 1424 | 1412 |
| 1425 if (!Near(header.packet_number, last_header_.packet_number)) { | 1413 if (!Near(header.packet_number, last_header_.packet_number)) { |
| 1426 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number | 1414 DVLOG(1) << ENDPOINT << "Packet " << header.packet_number |
| 1427 << " out of bounds. Discarding"; | 1415 << " out of bounds. Discarding"; |
| 1428 CloseConnection(QUIC_INVALID_PACKET_HEADER, "packet number out of bounds.", | 1416 CloseConnection(QUIC_INVALID_PACKET_HEADER, "packet number out of bounds.", |
| 1429 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 1417 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 1430 return false; | 1418 return false; |
| 1431 } | 1419 } |
| 1432 | 1420 |
| 1433 if (FLAGS_quic_postpone_multipath_flag_validation) { | 1421 // Multipath is not enabled, but a packet with multipath flag on is |
| 1434 // Multipath is not enabled, but a packet with multipath flag on is | 1422 // received. |
| 1435 // received. | 1423 if (!multipath_enabled_ && header.public_header.multipath_flag) { |
| 1436 if (!multipath_enabled_ && header.public_header.multipath_flag) { | 1424 const string error_details = |
| 1437 const string error_details = | 1425 "Received a packet with multipath flag but multipath is not enabled."; |
| 1438 "Received a packet with multipath flag but multipath is not enabled."; | 1426 QUIC_BUG << error_details; |
| 1439 QUIC_BUG << error_details; | 1427 CloseConnection(QUIC_BAD_MULTIPATH_FLAG, error_details, |
| 1440 CloseConnection(QUIC_BAD_MULTIPATH_FLAG, error_details, | 1428 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 1441 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 1429 return false; |
| 1442 return false; | |
| 1443 } | |
| 1444 } | 1430 } |
| 1445 | 1431 |
| 1446 if (version_negotiation_state_ != NEGOTIATED_VERSION) { | 1432 if (version_negotiation_state_ != NEGOTIATED_VERSION) { |
| 1447 if (perspective_ == Perspective::IS_SERVER) { | 1433 if (perspective_ == Perspective::IS_SERVER) { |
| 1448 if (!header.public_header.version_flag) { | 1434 if (!header.public_header.version_flag) { |
| 1449 // Packets should have the version flag till version negotiation is | 1435 // Packets should have the version flag till version negotiation is |
| 1450 // done. | 1436 // done. |
| 1451 string error_details = | 1437 string error_details = |
| 1452 StringPrintf("%s Packet %" PRIu64 | 1438 StringPrintf("%s Packet %" PRIu64 |
| 1453 " without version flag before version negotiated.", | 1439 " without version flag before version negotiated.", |
| (...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2553 | 2539 |
| 2554 void QuicConnection::CheckIfApplicationLimited() { | 2540 void QuicConnection::CheckIfApplicationLimited() { |
| 2555 if (queued_packets_.empty() && | 2541 if (queued_packets_.empty() && |
| 2556 !sent_packet_manager_->HasPendingRetransmissions() && | 2542 !sent_packet_manager_->HasPendingRetransmissions() && |
| 2557 !visitor_->WillingAndAbleToWrite()) { | 2543 !visitor_->WillingAndAbleToWrite()) { |
| 2558 sent_packet_manager_->OnApplicationLimited(); | 2544 sent_packet_manager_->OnApplicationLimited(); |
| 2559 } | 2545 } |
| 2560 } | 2546 } |
| 2561 | 2547 |
| 2562 } // namespace net | 2548 } // namespace net |
| OLD | NEW |