Plumb active_connection_id_limit to QuicConfig
We currently do not use active_connection_id_limit anywhere because we do not yet support IETF QUIC connection migration. This CL plumbs that value to QuicConfig to allow us to remember it for 0-RTT and validate that values are not lowered by the server.
This CL also changes the default and minimum values for active_connection_id_limit from 0 to 2, due to recent changes to the spec. This does not change our behavior because we currently never send this transport parameter, nor act in any way on the value received. (This is because we do not send a transport parameter when it is configured to a value that is equal to the default.)
Plumb unused active_connection_id_limit, no behavior change
PiperOrigin-RevId: 310382355
Change-Id: Ifdda3ec3473f1472256788c87ca172fe037a12cb
diff --git a/quic/core/quic_config.cc b/quic/core/quic_config.cc
index 0eaf9d6..d0f42b7 100644
--- a/quic/core/quic_config.cc
+++ b/quic/core/quic_config.cc
@@ -453,7 +453,8 @@
max_ack_delay_ms_(kMAD, PRESENCE_OPTIONAL),
ack_delay_exponent_(kADE, PRESENCE_OPTIONAL),
max_packet_size_(0, PRESENCE_OPTIONAL),
- max_datagram_frame_size_(0, PRESENCE_OPTIONAL) {
+ max_datagram_frame_size_(0, PRESENCE_OPTIONAL),
+ active_connection_id_limit_(0, PRESENCE_OPTIONAL) {
SetDefaults();
}
@@ -652,6 +653,23 @@
return max_datagram_frame_size_.GetReceivedValue();
}
+void QuicConfig::SetActiveConnectionIdLimitToSend(
+ uint64_t active_connection_id_limit) {
+ active_connection_id_limit_.SetSendValue(active_connection_id_limit);
+}
+
+uint64_t QuicConfig::GetActiveConnectionIdLimitToSend() const {
+ return active_connection_id_limit_.GetSendValue();
+}
+
+bool QuicConfig::HasReceivedActiveConnectionIdLimit() const {
+ return active_connection_id_limit_.HasReceivedValue();
+}
+
+uint64_t QuicConfig::ReceivedActiveConnectionIdLimit() const {
+ return active_connection_id_limit_.GetReceivedValue();
+}
+
bool QuicConfig::HasSetBytesForConnectionIdToSend() const {
return bytes_for_connection_id_.HasSendValue();
}
@@ -1115,6 +1133,11 @@
preferred_address);
}
+ if (active_connection_id_limit_.HasSendValue()) {
+ params->active_connection_id_limit.set_value(
+ active_connection_id_limit_.GetSendValue());
+ }
+
if (!params->google_quic_params) {
params->google_quic_params = std::make_unique<CryptoHandshakeMessage>();
}
@@ -1217,6 +1240,9 @@
connection_migration_disabled_.SetReceivedValue(1u);
}
+ active_connection_id_limit_.SetReceivedValue(
+ params.active_connection_id_limit.value());
+
const CryptoHandshakeMessage* peer_params = params.google_quic_params.get();
if (peer_params != nullptr) {
QuicErrorCode error = initial_round_trip_time_us_.ProcessPeerHello(