diff --git a/neqo-transport/src/connection/mod.rs b/neqo-transport/src/connection/mod.rs index 3fbcb7f9a8..5ba1620427 100644 --- a/neqo-transport/src/connection/mod.rs +++ b/neqo-transport/src/connection/mod.rs @@ -1183,6 +1183,12 @@ impl Connection { .get_versions_mut() .set_initial(self.conn_params.get_versions().initial()); mem::swap(self, &mut c); + qlog::client_version_information_negotiated( + &mut self.qlog, + self.conn_params.get_versions().all(), + supported, + version, + ); Ok(()) } else { qinfo!([self], "Version negotiation: failed with {:?}", supported); @@ -2296,6 +2302,7 @@ impl Connection { qinfo!([self], "client_start"); debug_assert_eq!(self.role, Role::Client); qlog::client_connection_started(&mut self.qlog, &self.paths.primary()); + qlog::client_version_information_initiated(&mut self.qlog, self.conn_params.get_versions()); self.handshake(now, self.version, PacketNumberSpace::Initial, None)?; self.set_state(State::WaitInitial); diff --git a/neqo-transport/src/qlog.rs b/neqo-transport/src/qlog.rs index 42c01cab28..42a0e6d586 100644 --- a/neqo-transport/src/qlog.rs +++ b/neqo-transport/src/qlog.rs @@ -17,7 +17,7 @@ use qlog::events::{ connectivity::{ConnectionStarted, ConnectionState, ConnectionStateUpdated}, quic::{ AckedRanges, ErrorSpace, MetricsUpdated, PacketDropped, PacketHeader, PacketLost, - PacketReceived, PacketSent, QuicFrame, StreamType, + PacketReceived, PacketSent, QuicFrame, StreamType, VersionInformation, }, Event, EventData, RawInfo, }; @@ -33,6 +33,7 @@ use crate::{ stream_id::StreamType as NeqoStreamType, tparams::{self, TransportParametersHandler}, tracking::SentPacket, + version::{Version, VersionConfig, WireVersion}, }; pub fn connection_tparams_set(qlog: &mut NeqoQlog, tph: &TransportParametersHandler) { @@ -127,6 +128,42 @@ pub fn connection_state_updated(qlog: &mut NeqoQlog, new: &State) { }); } +pub fn client_version_information_initiated(qlog: &mut NeqoQlog, version_config: &VersionConfig) { + qlog.add_event_data(|| { + Some(EventData::VersionInformation(VersionInformation { + client_versions: Some( + version_config + .all() + .iter() + .map(|v| format!("{:02x}", v.wire_version())) + .collect(), + ), + server_versions: None, + chosen_version: Some(format!("{:02x}", version_config.initial().wire_version())), + })) + }); +} + +pub fn client_version_information_negotiated( + qlog: &mut NeqoQlog, + client: &[Version], + server: &[WireVersion], + chosen: Version, +) { + qlog.add_event_data(|| { + Some(EventData::VersionInformation(VersionInformation { + client_versions: Some( + client + .iter() + .map(|v| format!("{:02x}", v.wire_version())) + .collect(), + ), + server_versions: Some(server.iter().map(|v| format!("{v:02x}")).collect()), + chosen_version: Some(format!("{:02x}", chosen.wire_version())), + })) + }); +} + pub fn packet_sent( qlog: &mut NeqoQlog, pt: PacketType,