Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate 0-RTT frames based on packet type, not handshake progress #1722

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2190,9 +2190,7 @@ impl Connection {
let state = match self.state {
State::Established => {
match packet.header.space() {
SpaceId::Data => {
self.process_payload(now, remote, number.unwrap(), packet.payload.freeze())?
}
SpaceId::Data => self.process_payload(now, remote, number.unwrap(), packet)?,
_ => self.process_early_payload(now, packet)?,
}
return Ok(());
Expand Down Expand Up @@ -2412,7 +2410,7 @@ impl Connection {
ty: LongType::ZeroRtt,
..
} => {
self.process_payload(now, remote, number.unwrap(), packet.payload.freeze())?;
self.process_payload(now, remote, number.unwrap(), packet)?;
Ok(())
}
Header::VersionNegotiate { .. } => {
Expand Down Expand Up @@ -2498,9 +2496,9 @@ impl Connection {
now: Instant,
remote: SocketAddr,
number: u64,
payload: Bytes,
packet: Packet,
) -> Result<(), TransportError> {
let is_0rtt = self.spaces[SpaceId::Data].crypto.is_none();
let payload = packet.payload.freeze();
let mut is_probing_packet = true;
let mut close = None;
let payload_len = payload.len();
Expand Down Expand Up @@ -2531,7 +2529,7 @@ impl Connection {
}

let _guard = span.as_ref().map(|x| x.enter());
if is_0rtt {
if packet.header.is_0rtt() {
match frame {
Frame::Crypto(_) | Frame::Close(Close::Application(_)) => {
return Err(TransportError::PROTOCOL_VIOLATION(
Expand Down