Send correct version negotiation to prober
QuicDispatcher::MaybeDispatchPacket was incorrectly computing the value of use_length_prefix instead of using the one from packet_info. This CL also adds regression tests to prevent this issue from coming back.
gfe-relnote: change length-prefix of version negotiation, protected by gfe2_reloadable_flag_quic_use_length_prefix_from_packet_info
PiperOrigin-RevId: 263219043
Change-Id: I14fc1dbcfffb1dd0cd79c03c90cc982cdab96d9c
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index c944862..4c73dfe 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -431,12 +431,20 @@
// packet and stop processing the current packet.
QuicConnectionId client_connection_id =
packet_info.source_connection_id;
+ bool use_length_prefix = packet_info.use_length_prefix;
+ if (!GetQuicReloadableFlag(quic_use_length_prefix_from_packet_info)) {
+ use_length_prefix = packet_info.form != GOOGLE_QUIC_PACKET &&
+ !QuicVersionLabelUses4BitConnectionIdLength(
+ packet_info.version_label);
+ } else {
+ QUIC_RELOADABLE_FLAG_COUNT(quic_use_length_prefix_from_packet_info);
+ // TODO(dschinazi) remove the client-side workaround in
+ // QuicFramer::ParseServerVersionNegotiationProbeResponse
+ // when quic_use_length_prefix_from_packet_info is deprecated.
+ }
time_wait_list_manager()->SendVersionNegotiationPacket(
server_connection_id, client_connection_id,
- packet_info.form != GOOGLE_QUIC_PACKET,
- packet_info.form != GOOGLE_QUIC_PACKET &&
- !QuicVersionLabelUses4BitConnectionIdLength(
- packet_info.version_label),
+ packet_info.form != GOOGLE_QUIC_PACKET, use_length_prefix,
GetSupportedVersions(), packet_info.self_address,
packet_info.peer_address, GetPerPacketContext());
}