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

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

Issue 2128623002: Buffer undecryptable QUIC packets in the Dispatcher when doing cheap stateless rejects. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@125958082
Patch Set: Created 4 years, 5 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/tools/quic/quic_dispatcher.cc ('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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 10
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 653
654 ProcessPacket(client_address, connection_id, true, false, 654 ProcessPacket(client_address, connection_id, true, false,
655 client_hello.GetSerialized().AsStringPiece().as_string()); 655 client_hello.GetSerialized().AsStringPiece().as_string());
656 656
657 if (GetParam().enable_stateless_rejects_via_flag) { 657 if (GetParam().enable_stateless_rejects_via_flag) {
658 EXPECT_EQ(true, 658 EXPECT_EQ(true,
659 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id)); 659 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
660 } 660 }
661 } 661 }
662 662
663 TEST_P(QuicDispatcherStatelessRejectTest, BufferNonChlo) {
664 FLAGS_quic_use_cheap_stateless_rejects = true;
665 CreateTimeWaitListManager();
666
667 const IPEndPoint client_address(net::test::Loopback4(), 1);
668 const QuicConnectionId connection_id = 1;
669
670 if (!GetParam().enable_stateless_rejects_via_flag) {
671 // If stateless rejects are not being used, then a connection will be
672 // created immediately.
673 EXPECT_CALL(dispatcher_, CreateQuicSession(connection_id, client_address))
674 .WillOnce(testing::Return(
675 CreateSessionBasedOnTestParams(connection_id, client_address)));
676 }
677 ProcessPacket(client_address, connection_id, true, false,
678 "NOT DATA FOR A CHLO");
679
680 // Process the first packet for the connection.
681 // clang-format off
682 CryptoHandshakeMessage client_hello = CryptoTestUtils::Message(
683 "CHLO",
684 "AEAD", "AESG",
685 "KEXS", "C255",
686 "NONC", "1234567890123456789012",
687 "VER\0", "Q025",
688 "$padding", static_cast<int>(kClientHelloMinimumSize),
689 nullptr);
690 // clang-format on
691
692 if (GetParam().enable_stateless_rejects_via_flag) {
693 // If stateless rejects are enabled then a connection will be created now
694 // and the buffered packet will be processed
695 EXPECT_CALL(dispatcher_, CreateQuicSession(connection_id, client_address))
696 .WillOnce(testing::Return(
697 CreateSessionBasedOnTestParams(connection_id, client_address)));
698 }
699 EXPECT_CALL(*reinterpret_cast<MockQuicConnection*>(session1_->connection()),
700 ProcessUdpPacket(_, client_address, _))
701 .RetiresOnSaturation();
702 ProcessPacket(client_address, connection_id, true, false,
703 client_hello.GetSerialized().AsStringPiece().as_string());
704 EXPECT_FALSE(
705 time_wait_list_manager_->IsConnectionIdInTimeWait(connection_id));
706 }
707
663 // Verify the stopgap test: Packets with truncated connection IDs should be 708 // Verify the stopgap test: Packets with truncated connection IDs should be
664 // dropped. 709 // dropped.
665 class QuicDispatcherTestStrayPacketConnectionId : public QuicDispatcherTest {}; 710 class QuicDispatcherTestStrayPacketConnectionId : public QuicDispatcherTest {};
666 711
667 // Packets with truncated connection IDs should be dropped. 712 // Packets with truncated connection IDs should be dropped.
668 TEST_F(QuicDispatcherTestStrayPacketConnectionId, 713 TEST_F(QuicDispatcherTestStrayPacketConnectionId,
669 StrayPacketTruncatedConnectionId) { 714 StrayPacketTruncatedConnectionId) {
670 CreateTimeWaitListManager(); 715 CreateTimeWaitListManager();
671 716
672 IPEndPoint client_address(net::test::Loopback4(), 1); 717 IPEndPoint client_address(net::test::Loopback4(), 1);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 921
877 // And we'll resume where we left off when we get another call. 922 // And we'll resume where we left off when we get another call.
878 EXPECT_CALL(*connection2(), OnCanWrite()); 923 EXPECT_CALL(*connection2(), OnCanWrite());
879 dispatcher_.OnCanWrite(); 924 dispatcher_.OnCanWrite();
880 EXPECT_FALSE(dispatcher_.HasPendingWrites()); 925 EXPECT_FALSE(dispatcher_.HasPendingWrites());
881 } 926 }
882 927
883 } // namespace 928 } // namespace
884 } // namespace test 929 } // namespace test
885 } // namespace net 930 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698