Update QUIC transport parameters for draft-22 gfe-relnote: update QUIC transport parameters, protected by disabled QUIC_TLS flag PiperOrigin-RevId: 258663796 Change-Id: Idabf673943c783b39940cdcc0ddb80db3adeaa3e
diff --git a/quic/core/chlo_extractor.cc b/quic/core/chlo_extractor.cc index 4b38ad2..0e8e6f5 100644 --- a/quic/core/chlo_extractor.cc +++ b/quic/core/chlo_extractor.cc
@@ -315,6 +315,8 @@ const QuicTagVector& create_session_tag_indicators, Delegate* delegate, uint8_t connection_id_length) { + QUIC_DVLOG(1) << "Extracting CHLO using versions " + << ParsedQuicVersionVectorToString(versions); QuicFramer framer(versions, QuicTime::Zero(), Perspective::IS_SERVER, connection_id_length); ChloFramerVisitor visitor(&framer, create_session_tag_indicators, delegate);
diff --git a/quic/core/crypto/transport_parameters.cc b/quic/core/crypto/transport_parameters.cc index e5df9fe..247f407 100644 --- a/quic/core/crypto/transport_parameters.cc +++ b/quic/core/crypto/transport_parameters.cc
@@ -40,6 +40,7 @@ kMaxAckDelay = 0xb, kDisableMigration = 0xc, kPreferredAddress = 0xd, + kActiveConnectionIdLimit = 0xe, kGoogleQuicParam = 18257, // Used for non-standard Google-specific params. kGoogleQuicVersion = @@ -90,6 +91,8 @@ return "disable_migration"; case TransportParameters::kPreferredAddress: return "preferred_address"; + case TransportParameters::kActiveConnectionIdLimit: + return "active_connection_id_limit"; case TransportParameters::kGoogleQuicParam: return "google"; case TransportParameters::kGoogleQuicVersion: @@ -273,6 +276,7 @@ rv += " " + TransportParameterIdToString(kPreferredAddress) + " " + preferred_address->ToString(); } + rv += active_connection_id_limit.ToString(/*for_use_in_list=*/true); if (google_quic_params) { rv += " " + TransportParameterIdToString(kGoogleQuicParam); } @@ -302,7 +306,8 @@ kDefaultMaxAckDelayTransportParam, 0, kMaxMaxAckDelayTransportParam), - disable_migration(false) + disable_migration(false), + active_connection_id_limit(kActiveConnectionIdLimit) // Important note: any new transport parameters must be added // to TransportParameters::AreValid, SerializeTransportParameters and // ParseTransportParameters. @@ -350,7 +355,8 @@ initial_max_stream_data_uni.IsValid() && initial_max_streams_bidi.IsValid() && initial_max_streams_uni.IsValid() && - ack_delay_exponent.IsValid() && max_ack_delay.IsValid(); + ack_delay_exponent.IsValid() && max_ack_delay.IsValid() && + active_connection_id_limit.IsValid(); if (!ok) { QUIC_DLOG(ERROR) << "Invalid transport parameters " << *this; } @@ -431,7 +437,8 @@ !in.initial_max_streams_bidi.WriteToCbb(¶ms) || !in.initial_max_streams_uni.WriteToCbb(¶ms) || !in.ack_delay_exponent.WriteToCbb(¶ms) || - !in.max_ack_delay.WriteToCbb(¶ms)) { + !in.max_ack_delay.WriteToCbb(¶ms) || + !in.active_connection_id_limit.WriteToCbb(¶ms)) { QUIC_BUG << "Failed to write integers for " << in; return false; } @@ -692,6 +699,9 @@ QuicMakeUnique<TransportParameters::PreferredAddress>( preferred_address); } break; + case TransportParameters::kActiveConnectionIdLimit: + parse_success = out->active_connection_id_limit.ReadFromCbs(&value); + break; case TransportParameters::kGoogleQuicParam: { if (out->google_quic_params) { QUIC_DLOG(ERROR) << "Received a second Google parameter";
diff --git a/quic/core/crypto/transport_parameters.h b/quic/core/crypto/transport_parameters.h index 27b5fe7..368a7bf 100644 --- a/quic/core/crypto/transport_parameters.h +++ b/quic/core/crypto/transport_parameters.h
@@ -161,6 +161,10 @@ // Used to effect a change in server address at the end of the handshake. std::unique_ptr<PreferredAddress> preferred_address; + // Maximum number of connection IDs from the peer that an endpoint is willing + // to store. + IntegerParameter active_connection_id_limit; + // Transport parameters used by Google QUIC but not IETF QUIC. This is // serialized into a TransportParameter struct with a TransportParameterId of // kGoogleQuicParamId.
diff --git a/quic/core/crypto/transport_parameters_test.cc b/quic/core/crypto/transport_parameters_test.cc index 7776af1..3f7e339 100644 --- a/quic/core/crypto/transport_parameters_test.cc +++ b/quic/core/crypto/transport_parameters_test.cc
@@ -36,6 +36,7 @@ const uint64_t kFakeAckDelayExponent = 10; const uint64_t kFakeMaxAckDelay = 51; const bool kFakeDisableMigration = true; +const uint64_t kFakeActiveConnectionIdLimit = 52; const QuicConnectionId kFakePreferredConnectionId = TestConnectionId(0xBEEF); const uint8_t kFakePreferredStatelessResetTokenData[16] = { 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, @@ -96,6 +97,8 @@ orig_params.ack_delay_exponent.set_value(kFakeAckDelayExponent); orig_params.max_ack_delay.set_value(kFakeMaxAckDelay); orig_params.disable_migration = kFakeDisableMigration; + orig_params.active_connection_id_limit.set_value( + kFakeActiveConnectionIdLimit); std::vector<uint8_t> serialized; ASSERT_TRUE(SerializeTransportParameters(orig_params, &serialized)); @@ -126,6 +129,8 @@ EXPECT_EQ(kFakeAckDelayExponent, new_params.ack_delay_exponent.value()); EXPECT_EQ(kFakeMaxAckDelay, new_params.max_ack_delay.value()); EXPECT_EQ(kFakeDisableMigration, new_params.disable_migration); + EXPECT_EQ(kFakeActiveConnectionIdLimit, + new_params.active_connection_id_limit.value()); } TEST_F(TransportParametersTest, RoundTripServer) { @@ -151,6 +156,8 @@ orig_params.max_ack_delay.set_value(kFakeMaxAckDelay); orig_params.disable_migration = kFakeDisableMigration; orig_params.preferred_address = CreateFakePreferredAddress(); + orig_params.active_connection_id_limit.set_value( + kFakeActiveConnectionIdLimit); std::vector<uint8_t> serialized; ASSERT_TRUE(SerializeTransportParameters(orig_params, &serialized)); @@ -192,6 +199,8 @@ new_params.preferred_address->connection_id); EXPECT_EQ(kFakePreferredStatelessResetToken, new_params.preferred_address->stateless_reset_token); + EXPECT_EQ(kFakeActiveConnectionIdLimit, + new_params.active_connection_id_limit.value()); } TEST_F(TransportParametersTest, IsValid) { @@ -252,7 +261,7 @@ TEST_F(TransportParametersTest, ParseClientParams) { // clang-format off const uint8_t kClientParams[] = { - 0x00, 0x44, // length of the parameters array that follows + 0x00, 0x49, // length of the parameters array that follows // idle_timeout 0x00, 0x01, // parameter id 0x00, 0x02, // length @@ -296,6 +305,10 @@ // disable_migration 0x00, 0x0c, // parameter id 0x00, 0x00, // length + // active_connection_id_limit + 0x00, 0x0e, // parameter id + 0x00, 0x01, // length + 0x34, // value // Google version extension 0x47, 0x52, // parameter id 0x00, 0x04, // length @@ -330,6 +343,8 @@ EXPECT_EQ(kFakeAckDelayExponent, new_params.ack_delay_exponent.value()); EXPECT_EQ(kFakeMaxAckDelay, new_params.max_ack_delay.value()); EXPECT_EQ(kFakeDisableMigration, new_params.disable_migration); + EXPECT_EQ(kFakeActiveConnectionIdLimit, + new_params.active_connection_id_limit.value()); } TEST_F(TransportParametersTest, ParseClientParamsFailsWithStatelessResetToken) { @@ -418,7 +433,7 @@ TEST_F(TransportParametersTest, ParseServerParams) { // clang-format off const uint8_t kServerParams[] = { - 0x00, 0xa2, // length of parameters array that follows + 0x00, 0xa7, // length of parameters array that follows // original_connection_id 0x00, 0x00, // parameter id 0x00, 0x08, // length @@ -483,6 +498,10 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0xEF, // connection ID 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, // stateless reset token 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, + // active_connection_id_limit + 0x00, 0x0e, // parameter id + 0x00, 0x01, // length + 0x34, // value // Google version extension 0x47, 0x52, // parameter id 0x00, 0x0d, // length @@ -531,6 +550,8 @@ new_params.preferred_address->connection_id); EXPECT_EQ(kFakePreferredStatelessResetToken, new_params.preferred_address->stateless_reset_token); + EXPECT_EQ(kFakeActiveConnectionIdLimit, + new_params.active_connection_id_limit.value()); } TEST_F(TransportParametersTest, ParseServerParametersRepeated) {