From 3f4e3dd61184ad195853c982dc32b9f1676dcf61 Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Dec 2023 16:47:32 +0100 Subject: [PATCH 1/5] deps(qlog): update to qlog v0.10.0 This commit upgrades all `neqo-*` crates to use `qlog` `v0.10.0`. See also `qlog` `v0.10.0` release pull request https://github.com/cloudflare/quiche/pull/1647 --- neqo-client/Cargo.toml | 2 +- neqo-common/Cargo.toml | 2 +- neqo-http3/Cargo.toml | 2 +- neqo-qpack/Cargo.toml | 2 +- neqo-server/Cargo.toml | 2 +- neqo-transport/Cargo.toml | 2 +- neqo-transport/src/qlog.rs | 16 ++++++++++------ 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/neqo-client/Cargo.toml b/neqo-client/Cargo.toml index 938d5d60c2..4555c54ce6 100644 --- a/neqo-client/Cargo.toml +++ b/neqo-client/Cargo.toml @@ -16,7 +16,7 @@ neqo-http3 = { path = "./../neqo-http3" } neqo-qpack = { path = "./../neqo-qpack" } structopt = "0.3.7" url = "2.0" -qlog = "0.9.0" +qlog = "0.10.0" [features] deny-warnings = [] diff --git a/neqo-common/Cargo.toml b/neqo-common/Cargo.toml index 512f42f6cd..b278636ac6 100644 --- a/neqo-common/Cargo.toml +++ b/neqo-common/Cargo.toml @@ -11,7 +11,7 @@ build = "build.rs" log = {version = "0.4.0", default-features = false} env_logger = {version = "0.10", default-features = false} lazy_static = "1.3.0" -qlog = "0.9.0" +qlog = "0.10.0" time = {version = "=0.3.23", features = ["formatting"]} [features] diff --git a/neqo-http3/Cargo.toml b/neqo-http3/Cargo.toml index 13879d8547..3e2092b344 100644 --- a/neqo-http3/Cargo.toml +++ b/neqo-http3/Cargo.toml @@ -13,7 +13,7 @@ neqo-transport = { path = "./../neqo-transport" } neqo-qpack = { path = "./../neqo-qpack" } log = {version = "0.4.0", default-features = false} smallvec = "1.0.0" -qlog = "0.9.0" +qlog = "0.10.0" sfv = "0.9.1" url = "2.0" lazy_static = "1.3.0" diff --git a/neqo-qpack/Cargo.toml b/neqo-qpack/Cargo.toml index a595e4cbf7..349dd9ac16 100644 --- a/neqo-qpack/Cargo.toml +++ b/neqo-qpack/Cargo.toml @@ -12,7 +12,7 @@ neqo-transport = { path = "./../neqo-transport" } neqo-crypto = { path = "./../neqo-crypto" } log = {version = "0.4.0", default-features = false} static_assertions = "1.1.0" -qlog = "0.9.0" +qlog = "0.10.0" lazy_static = "1.3.0" [dev-dependencies] diff --git a/neqo-server/Cargo.toml b/neqo-server/Cargo.toml index 6f2f25afdd..580f54c76e 100644 --- a/neqo-server/Cargo.toml +++ b/neqo-server/Cargo.toml @@ -17,7 +17,7 @@ regex = "1" mio = "0.6.17" mio-extras = "2.0.5" log = {version = "0.4.0", default-features = false} -qlog = "0.9.0" +qlog = "0.10.0" [features] deny-warnings = [] diff --git a/neqo-transport/Cargo.toml b/neqo-transport/Cargo.toml index a3c30f4dd1..11fcd783df 100644 --- a/neqo-transport/Cargo.toml +++ b/neqo-transport/Cargo.toml @@ -12,7 +12,7 @@ neqo-common = { path = "../neqo-common" } lazy_static = "1.3.0" log = {version = "0.4.0", default-features = false} smallvec = "1.0.0" -qlog = "0.9.0" +qlog = "0.10.0" indexmap = "1.0" [dev-dependencies] diff --git a/neqo-transport/src/qlog.rs b/neqo-transport/src/qlog.rs index dce27732b0..a3ce45ea57 100644 --- a/neqo-transport/src/qlog.rs +++ b/neqo-transport/src/qlog.rs @@ -136,7 +136,7 @@ pub fn packet_sent( ) { qlog.add_event_with_stream(|stream| { let mut d = Decoder::from(body); - let header = PacketHeader::with_type(to_qlog_pkt_type(pt), pn, None, None, None); + let header = PacketHeader::with_type(to_qlog_pkt_type(pt), Some(pn), None, None, None); let raw = RawInfo { length: None, payload_length: Some(plen as u64), @@ -175,9 +175,13 @@ pub fn packet_sent( pub fn packet_dropped(qlog: &mut NeqoQlog, payload: &PublicPacket) { qlog.add_event_data(|| { - // TODO: packet number is optional in the spec but qlog crate doesn't support that, so use a placeholder value of 0 - let header = - PacketHeader::with_type(to_qlog_pkt_type(payload.packet_type()), 0, None, None, None); + let header = PacketHeader::with_type( + to_qlog_pkt_type(payload.packet_type()), + None, + None, + None, + None, + ); let raw = RawInfo { length: None, payload_length: Some(payload.len() as u64), @@ -200,7 +204,7 @@ pub fn packets_lost(qlog: &mut NeqoQlog, pkts: &[SentPacket]) { qlog.add_event_with_stream(|stream| { for pkt in pkts { let header = - PacketHeader::with_type(to_qlog_pkt_type(pkt.pt), pkt.pn, None, None, None); + PacketHeader::with_type(to_qlog_pkt_type(pkt.pt), Some(pkt.pn), None, None, None); let ev_data = EventData::PacketLost(PacketLost { header: Some(header), @@ -224,7 +228,7 @@ pub fn packet_received( let header = PacketHeader::with_type( to_qlog_pkt_type(public_packet.packet_type()), - payload.pn(), + Some(payload.pn()), None, None, None, From 57b491ee6f17a61677f687aac952e1364ba63f3d Mon Sep 17 00:00:00 2001 From: Max Inden Date: Sun, 10 Dec 2023 16:55:12 +0100 Subject: [PATCH 2/5] feat(qlog): log version_information on client This commit adds support for the qlog [`version_information` QUIC event](https://quicwg.org/qlog/draft-ietf-quic-qlog-quic-events.html#name-version_information) on the client. Depends on https://github.com/mozilla/neqo/pull/1504 Depends on https://github.com/cloudflare/quiche/pull/1684 Meta issue: https://github.com/mozilla/neqo/issues/528 --- Cargo.toml | 3 ++ neqo-transport/src/connection/mod.rs | 7 +++++ neqo-transport/src/qlog.rs | 41 +++++++++++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index b3449d4a5e..5f4adb43e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,6 @@ members = [ "neqo-interop", "test-fixture", ] + +[patch.crates-io] +qlog = { git = "https://github.com/mxinden/quiche", branch = "type-to-importance" } diff --git a/neqo-transport/src/connection/mod.rs b/neqo-transport/src/connection/mod.rs index abb7e590ad..8cece11b7e 100644 --- a/neqo-transport/src/connection/mod.rs +++ b/neqo-transport/src/connection/mod.rs @@ -1163,6 +1163,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); @@ -2282,6 +2288,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 a3ce45ea57..878b3f3fff 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,44 @@ 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(|| { + let ev_data = 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())), + }); + Some(ev_data) + }); +} + +pub fn client_version_information_negotiated( + qlog: &mut NeqoQlog, + client: &[Version], + server: &[WireVersion], + chosen: Version, +) { + qlog.add_event_data(|| { + let ev_data = 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())), + }); + Some(ev_data) + }); +} + pub fn packet_sent( qlog: &mut NeqoQlog, pt: PacketType, From 5884b456e10c5e1f6a52e89af8c0fcacc86f07dd Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 20 Dec 2023 18:02:01 +0100 Subject: [PATCH 3/5] Use replace github.com/cloudflare with github.com/mxinden With https://github.com/cloudflare/quiche/pull/1684 merged, one can use cloudflare's repo. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 5f4adb43e5..b866f91a53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,4 @@ members = [ ] [patch.crates-io] -qlog = { git = "https://github.com/mxinden/quiche", branch = "type-to-importance" } +qlog = { git = "https://github.com/cloudflare/quiche", branch = "master" } From a5f7681671085ab0fa3f65bf8eb94927e6c44f4f Mon Sep 17 00:00:00 2001 From: Max Inden Date: Wed, 20 Dec 2023 18:04:50 +0100 Subject: [PATCH 4/5] Inline ev_data --- neqo-transport/src/qlog.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/neqo-transport/src/qlog.rs b/neqo-transport/src/qlog.rs index 878b3f3fff..fbe49ab03b 100644 --- a/neqo-transport/src/qlog.rs +++ b/neqo-transport/src/qlog.rs @@ -130,7 +130,7 @@ 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(|| { - let ev_data = EventData::VersionInformation(VersionInformation { + Some(EventData::VersionInformation(VersionInformation { client_versions: Some( version_config .all() @@ -140,8 +140,7 @@ pub fn client_version_information_initiated(qlog: &mut NeqoQlog, version_config: ), server_versions: None, chosen_version: Some(format!("{:02x}", version_config.initial().wire_version())), - }); - Some(ev_data) + })) }); } @@ -152,7 +151,7 @@ pub fn client_version_information_negotiated( chosen: Version, ) { qlog.add_event_data(|| { - let ev_data = EventData::VersionInformation(VersionInformation { + Some(EventData::VersionInformation(VersionInformation { client_versions: Some( client .iter() @@ -161,8 +160,7 @@ pub fn client_version_information_negotiated( ), server_versions: Some(server.iter().map(|v| format!("{v:02x}")).collect()), chosen_version: Some(format!("{:02x}", chosen.wire_version())), - }); - Some(ev_data) + })) }); } From 4754645b1c6192fdf6a5d17a927acae2da18c17a Mon Sep 17 00:00:00 2001 From: Max Inden Date: Thu, 11 Jan 2024 18:57:51 +0100 Subject: [PATCH 5/5] Remove crates.io patch Patch no longer needed since upgrade to neqo v0.11.0 https://github.com/mozilla/neqo/pull/1547. --- Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b866f91a53..b3449d4a5e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,3 @@ members = [ "neqo-interop", "test-fixture", ] - -[patch.crates-io] -qlog = { git = "https://github.com/cloudflare/quiche", branch = "master" }