Allow variable length connection IDs in v99
This CL enables the use of QUIC variable length connection IDs (VLCIDs) in v99. It also relaxes some checks when VLCIDs are enabled, and fixes tests that were relying on this. This CL also fixes QuicFramerTest.MissingDiversificationNonce as this work uncovered that the test was failure to parse headers because the headers were wrong, instead of testing for missing diversification nonces.
gfe-relnote: change only impacts v99 and tests, not flag protected
PiperOrigin-RevId: 238522262
Change-Id: I1a33470f1c9f8e5e83da44e82bdb2969fa9ed8ea
diff --git a/quic/core/quic_framer.cc b/quic/core/quic_framer.cc
index 72df572..1af1f68 100644
--- a/quic/core/quic_framer.cc
+++ b/quic/core/quic_framer.cc
@@ -2277,8 +2277,6 @@
if (packet_has_ietf_packet_header) {
return ProcessIetfPacketHeader(reader, header);
}
- DCHECK(!QuicUtils::VariableLengthConnectionIdAllowedForVersion(
- transport_version()));
uint8_t public_flags;
if (!reader->ReadBytes(&public_flags, 1)) {
set_detailed_error("Unable to read public flags.");
@@ -2579,7 +2577,11 @@
}
if ((dcil != destination_connection_id_length ||
scil != source_connection_id_length) &&
- !should_update_expected_connection_id_length_) {
+ !should_update_expected_connection_id_length_ &&
+ !QuicUtils::VariableLengthConnectionIdAllowedForVersion(
+ header->version.transport_version)) {
+ // TODO(dschinazi): use the framer's version once the
+ // OnProtocolVersionMismatch call is moved to before this is run.
QUIC_DVLOG(1) << "dcil: " << static_cast<uint32_t>(dcil)
<< ", scil: " << static_cast<uint32_t>(scil);
set_detailed_error("Invalid ConnectionId length.");
@@ -5607,7 +5609,9 @@
return false;
}
- if (connection_id_length != kQuicDefaultConnectionIdLength) {
+ if (connection_id_length != kQuicDefaultConnectionIdLength &&
+ !QuicUtils::VariableLengthConnectionIdAllowedForVersion(
+ transport_version())) {
set_detailed_error("Invalid new connection ID length.");
return false;
}