Add quic_enable_chaos_protection flag
This CL adds a new protocol flag that will be used by some Chrome tests that expect specific packet formats and therefore don't like chaos protection. This CL is a no-op outside of those tests.
diff --git a/quic/core/quic_packet_creator.cc b/quic/core/quic_packet_creator.cc
index a9f16e0..19168fb 100644
--- a/quic/core/quic_packet_creator.cc
+++ b/quic/core/quic_packet_creator.cc
@@ -131,8 +131,9 @@
fully_pad_crypto_handshake_packets_(true),
latched_hard_max_packet_length_(0),
max_datagram_frame_size_(0),
- chaos_protection_enabled_(framer->perspective() ==
- Perspective::IS_CLIENT) {
+ chaos_protection_enabled_(
+ GetQuicFlag(FLAGS_quic_enable_chaos_protection) &&
+ framer->perspective() == Perspective::IS_CLIENT) {
SetMaxPacketLength(kDefaultMaxPacketSize);
if (!framer_->version().UsesTls()) {
// QUIC+TLS negotiates the maximum datagram frame size via the
diff --git a/quic/core/quic_protocol_flags_list.h b/quic/core/quic_protocol_flags_list.h
index 02f107b..3e32713 100644
--- a/quic/core/quic_protocol_flags_list.h
+++ b/quic/core/quic_protocol_flags_list.h
@@ -128,6 +128,10 @@
true,
"If true, use random greased settings and frames.")
+QUIC_PROTOCOL_FLAG(
+ bool, quic_enable_chaos_protection, true,
+ "If true, use chaos protection to randomize client initials.")
+
QUIC_PROTOCOL_FLAG(int64_t,
quic_max_tracked_packet_count,
10000,