Deprecate client in-connection version negotiation code. gfe-relnote: Deprecate gfe2_reloadable_flag_quic_no_client_conn_ver_negotiation. PiperOrigin-RevId: 254234627 Change-Id: I0d53ea29e57ea58c8b4b5d6f7a91631a63bcc6b3
diff --git a/quic/core/http/end_to_end_test.cc b/quic/core/http/end_to_end_test.cc index 18e0f2b..2ac1043 100644 --- a/quic/core/http/end_to_end_test.cc +++ b/quic/core/http/end_to_end_test.cc
@@ -216,7 +216,6 @@ expected_server_connection_id_length_(kQuicDefaultConnectionIdLength) { SetQuicFlag(FLAGS_quic_supports_tls_handshake, true); SetQuicRestartFlag(quic_no_server_conn_ver_negotiation2, true); - SetQuicReloadableFlag(quic_no_client_conn_ver_negotiation, true); client_supported_versions_ = GetParam().client_supported_versions; server_supported_versions_ = GetParam().server_supported_versions; negotiated_version_ = GetParam().negotiated_version; @@ -484,8 +483,7 @@ // Returns true when client starts with an unsupported version, and client // closes connection when version negotiation is received. bool ServerSendsVersionNegotiation() { - return GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation) && - client_supported_versions_[0] != GetParam().negotiated_version; + return client_supported_versions_[0] != GetParam().negotiated_version; } bool SupportsIetfQuicWithTls(ParsedQuicVersion version) {
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc index 6bfefd5..001b496 100644 --- a/quic/core/quic_connection.cc +++ b/quic/core/quic_connection.cc
@@ -665,52 +665,15 @@ } server_supported_versions_ = packet.versions; - - if (GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation)) { - QUIC_RELOADABLE_FLAG_COUNT(quic_no_client_conn_ver_negotiation); - CloseConnection( - QUIC_INVALID_VERSION, - QuicStrCat( - "Client may support one of the versions in the server's list, but " - "it's going to close the connection anyway. Supported versions: {", - ParsedQuicVersionVectorToString(framer_.supported_versions()), - "}, peer supported versions: {", - ParsedQuicVersionVectorToString(packet.versions), "}"), - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return; - } - - ParsedQuicVersion original_version = version(); - if (!SelectMutualVersion(packet.versions)) { - CloseConnection( - QUIC_INVALID_VERSION, - QuicStrCat( - "No common version found. Supported versions: {", - ParsedQuicVersionVectorToString(framer_.supported_versions()), - "}, peer supported versions: {", - ParsedQuicVersionVectorToString(packet.versions), "}"), - ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); - return; - } - - if (original_version.handshake_protocol != version().handshake_protocol) { - const std::string error_details = - "In-connection version negotiation between mismatched handshake " - " protocols " + - ParsedQuicVersionToString(original_version) + " and " + - ParsedQuicVersionToString(version()) + " is currently unsupported."; - QUIC_DLOG(WARNING) << error_details; - CloseConnection(QUIC_INVALID_VERSION, error_details, - ConnectionCloseBehavior::SILENT_CLOSE); - return; - } - - QUIC_DLOG(INFO) << ENDPOINT << "Negotiated version: " - << ParsedQuicVersionToString(version()); - no_stop_waiting_frames_ = VersionHasIetfInvariantHeader(transport_version()); - version_negotiation_state_ = NEGOTIATION_IN_PROGRESS; - - RetransmitUnackedPackets(ALL_UNACKED_RETRANSMISSION); + CloseConnection( + QUIC_INVALID_VERSION, + QuicStrCat( + "Client may support one of the versions in the server's list, but " + "it's going to close the connection anyway. Supported versions: {", + ParsedQuicVersionVectorToString(framer_.supported_versions()), + "}, peer supported versions: {", + ParsedQuicVersionVectorToString(packet.versions), "}"), + ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); } // Handles retry for client connection.
diff --git a/quic/core/quic_connection_test.cc b/quic/core/quic_connection_test.cc index 58d84a1..9298909 100644 --- a/quic/core/quic_connection_test.cc +++ b/quic/core/quic_connection_test.cc
@@ -6699,10 +6699,6 @@ } TEST_P(QuicConnectionTest, ClientHandlesVersionNegotiation) { - const bool expect_failure = - GetQuicReloadableFlag(quic_no_client_conn_ver_negotiation) || - connection_.version().handshake_protocol != - QuicVersionReservedForNegotiation().handshake_protocol; // Start out with an unsupported version. QuicConnectionPeer::GetFramer(&connection_) ->set_version_for_tests(QuicVersionReservedForNegotiation()); @@ -6715,47 +6711,10 @@ AllSupportedVersions())); std::unique_ptr<QuicReceivedPacket> received( ConstructReceivedPacket(*encrypted, QuicTime::Zero())); - if (expect_failure) { - EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_VERSION, _, - ConnectionCloseSource::FROM_SELF)); - } + EXPECT_CALL(visitor_, OnConnectionClosed(QUIC_INVALID_VERSION, _, + ConnectionCloseSource::FROM_SELF)); connection_.ProcessUdpPacket(kSelfAddress, kPeerAddress, *received); - if (expect_failure) { - EXPECT_FALSE(connection_.connected()); - return; - } - - // Now force another packet. The connection should transition into - // NEGOTIATED_VERSION state and tell the packet creator to StopSendingVersion. - QuicPacketHeader header; - header.destination_connection_id_included = CONNECTION_ID_ABSENT; - if (!GetQuicRestartFlag(quic_do_not_override_connection_id)) { - header.destination_connection_id = connection_id_; - } else { - header.source_connection_id = connection_id_; - } - header.packet_number = QuicPacketNumber(12); - header.version_flag = false; - QuicFrames frames; - frames.push_back(QuicFrame(frame1_)); - std::unique_ptr<QuicPacket> packet(ConstructPacket(header, frames)); - char buffer[kMaxOutgoingPacketSize]; - size_t encrypted_length = - peer_framer_.EncryptPayload(ENCRYPTION_INITIAL, QuicPacketNumber(12), - *packet, buffer, kMaxOutgoingPacketSize); - ASSERT_NE(0u, encrypted_length); - EXPECT_CALL(visitor_, OnStreamFrame(_)).Times(1); - EXPECT_CALL(visitor_, OnSuccessfulVersionNegotiation(_)); - connection_.ProcessUdpPacket( - kSelfAddress, kPeerAddress, - QuicReceivedPacket(buffer, encrypted_length, QuicTime::Zero(), false)); - if (VersionHasIetfInvariantHeader(GetParam().version.transport_version)) { - // IETF QUIC stops sending version when switch to FORWARD_SECURE. - EXPECT_NE(ENCRYPTION_FORWARD_SECURE, connection_.encryption_level()); - ASSERT_TRUE(QuicPacketCreatorPeer::SendVersionInPacket(creator_)); - } else { - ASSERT_FALSE(QuicPacketCreatorPeer::SendVersionInPacket(creator_)); - } + EXPECT_FALSE(connection_.connected()); } TEST_P(QuicConnectionTest, BadVersionNegotiation) {
diff --git a/quic/core/quic_types.h b/quic/core/quic_types.h index 7a83495..97707b5 100644 --- a/quic/core/quic_types.h +++ b/quic/core/quic_types.h
@@ -146,7 +146,8 @@ enum TransmissionType : int8_t { NOT_RETRANSMISSION, FIRST_TRANSMISSION_TYPE = NOT_RETRANSMISSION, - HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. + HANDSHAKE_RETRANSMISSION, // Retransmits due to handshake timeouts. + // TODO(fayang): remove ALL_UNACKED_RETRANSMISSION. ALL_UNACKED_RETRANSMISSION, // Retransmits all unacked packets. ALL_INITIAL_RETRANSMISSION, // Retransmits all initially encrypted packets. LOSS_RETRANSMISSION, // Retransmits due to loss detection.
diff --git a/quic/core/quic_versions.cc b/quic/core/quic_versions.cc index fe90dac..a0edb03 100644 --- a/quic/core/quic_versions.cc +++ b/quic/core/quic_versions.cc
@@ -432,7 +432,6 @@ SetQuicFlag(FLAGS_quic_headers_stream_id_in_v99, 60); SetQuicReloadableFlag(quic_use_uber_loss_algorithm, true); SetQuicReloadableFlag(quic_use_uber_received_packet_manager, true); - SetQuicReloadableFlag(quic_no_client_conn_ver_negotiation, true); SetQuicReloadableFlag(quic_eliminate_static_stream_map_3, true); SetQuicReloadableFlag(quic_tolerate_reneging, true); SetQuicReloadableFlag(quic_simplify_stop_waiting, true);
diff --git a/quic/quartc/quartc_endpoint_test.cc b/quic/quartc/quartc_endpoint_test.cc index 6b56b1a..eedbf6a 100644 --- a/quic/quartc/quartc_endpoint_test.cc +++ b/quic/quartc/quartc_endpoint_test.cc
@@ -200,10 +200,6 @@ // version negotiation. TEST_F(QuartcEndpointTest, QUIC_TEST_DISABLED_IN_CHROME(CreatesNewSessionWhenRequired)) { - // Setting this flag to true requires the client to create a new session when - // version negotiation fails. - SetQuicReloadableFlag(quic_no_client_conn_ver_negotiation, true); - // Reset the client endpoint to prefer version 46 but also be capable of // speaking version 43. ParsedQuicVersionVector client_versions;