diff --git a/qlog/src/events/quic.rs b/qlog/src/events/quic.rs index e504125a1a..5c7d836870 100644 --- a/qlog/src/events/quic.rs +++ b/qlog/src/events/quic.rs @@ -571,6 +571,15 @@ pub struct TransportParametersSet { pub initial_max_streams_uni: Option, pub preferred_address: Option, + + pub unknown_parameters: Vec, +} + +#[serde_with::skip_serializing_none] +#[derive(Serialize, Deserialize, Clone, PartialEq, Eq, Debug)] +pub struct UnknownTransportParameter { + pub id: u64, + pub value: Vec, } #[serde_with::skip_serializing_none] diff --git a/quiche/src/lib.rs b/quiche/src/lib.rs index bf9c27824e..637b02cd4d 100644 --- a/quiche/src/lib.rs +++ b/quiche/src/lib.rs @@ -7984,6 +7984,29 @@ impl std::fmt::Debug for Stats { } } +/// QUIC Unknown Transport Parameters +/// +/// QUIC transport parameters that are not specifically recognized +/// by this implementation. +#[derive(Clone, Debug, PartialEq)] +pub struct UnknownTransportParameter { + /// ID of an unknown transport parameter + pub id: u64, + /// Original data representing the value of an unknown transport parameter + pub value: Vec, +} + +impl From + for qlog::events::quic::UnknownTransportParameter +{ + fn from(value: UnknownTransportParameter) -> Self { + Self { + id: value.id, + value: value.value, + } + } +} + /// QUIC Transport Parameters #[derive(Clone, Debug, PartialEq)] pub struct TransportParams { @@ -8023,6 +8046,8 @@ pub struct TransportParams { pub retry_source_connection_id: Option>, /// DATAGRAM frame extension parameter, if any. pub max_datagram_frame_size: Option, + /// Unknown peer transport parameters and values, if any. + pub unknown_params: Vec, // pub preferred_address: ..., } @@ -8046,6 +8071,7 @@ impl Default for TransportParams { initial_source_connection_id: None, retry_source_connection_id: None, max_datagram_frame_size: None, + unknown_params: vec![], } } } @@ -8196,8 +8222,13 @@ impl TransportParams { tp.max_datagram_frame_size = Some(val.get_varint()?); }, - // Ignore unknown parameters. - _ => (), + // Track unknown transport parameters specially. + unknown_tp_id => { + tp.unknown_params.push(UnknownTransportParameter { + id: unknown_tp_id, + value: val.to_vec(), + }); + }, } } @@ -8410,6 +8441,12 @@ impl TransportParams { initial_max_streams_uni: Some(self.initial_max_streams_uni), preferred_address: None, + + unknown_parameters: self.unknown_params + .iter() + .cloned() + .map(Into::::into) + .collect(), }, ) } @@ -8952,6 +8989,7 @@ mod tests { initial_source_connection_id: Some(b"woot woot".to_vec().into()), retry_source_connection_id: Some(b"retry".to_vec().into()), max_datagram_frame_size: Some(32), + unknown_params: vec![], }; let mut raw_params = [42; 256]; @@ -8982,6 +9020,7 @@ mod tests { initial_source_connection_id: Some(b"woot woot".to_vec().into()), retry_source_connection_id: None, max_datagram_frame_size: Some(32), + unknown_params: vec![], }; let mut raw_params = [42; 256];