gfe-relnote: Drop QUIC INITIAL packets which are less than 1200 bytes. Protected by --gfe2_reloadable_flag_quic_drop_small_initial_packets PiperOrigin-RevId: 286621288 Change-Id: I46543378213f091886662d4963b84a5b74ac3e9f
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc index 9c71d41..c628993 100644 --- a/quic/core/quic_dispatcher.cc +++ b/quic/core/quic_dispatcher.cc
@@ -149,6 +149,9 @@ const QuicSocketAddress& peer_address, QuicErrorCode error_code, const std::string& error_details) { + // TODO(rch): Remove this method when quic_drop_small_initial_packets is + // deprecated. + DCHECK(!GetQuicReloadableFlag(quic_drop_small_initial_packets)); SerializeConnectionClosePacket(error_code, error_details); for (const auto& packet : *collector_.packets()) { @@ -457,6 +460,13 @@ packet_info.form == IETF_QUIC_LONG_HEADER_PACKET && packet_info.long_packet_type == INITIAL && packet_info.packet.length() < kMinClientInitialPacketLength) { + if (GetQuicReloadableFlag(quic_drop_small_initial_packets)) { + QUIC_DVLOG(1) << "Dropping initial packet which is too short, length: " + << packet_info.packet.length(); + QUIC_CODE_COUNT(quic_drop_small_initial_packets); + QUIC_RELOADABLE_FLAG_COUNT(quic_drop_small_initial_packets); + return true; + } StatelessConnectionTerminator terminator( packet_info.destination_connection_id, packet_info.version, helper_.get(), time_wait_list_manager_.get());
diff --git a/quic/core/quic_dispatcher_test.cc b/quic/core/quic_dispatcher_test.cc index 4f797c2..6d83adf 100644 --- a/quic/core/quic_dispatcher_test.cc +++ b/quic/core/quic_dispatcher_test.cc
@@ -1270,7 +1270,14 @@ QuicSocketAddress client_address(QuicIpAddress::Loopback4(), 1); EXPECT_CALL(*dispatcher_, CreateQuicSession(_, _, _, _)).Times(0); - EXPECT_CALL(*time_wait_list_manager_, SendPacket(_, _, _)).Times(1); + if (GetQuicReloadableFlag(quic_drop_small_initial_packets)) { + EXPECT_CALL(*time_wait_list_manager_, SendPacket(_, _, _)).Times(0); + } else { + EXPECT_CALL(*time_wait_list_manager_, SendPacket(_, _, _)).Times(1); + } + EXPECT_CALL(*time_wait_list_manager_, + AddConnectionIdToTimeWait(_, _, _, _, _)) + .Times(0); ProcessPacket(client_address, TestConnectionId(1), true, CurrentSupportedVersions()[0], SerializeCHLO(), false, CONNECTION_ID_PRESENT, PACKET_4BYTE_PACKET_NUMBER, 1);