1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-22 16:02:34 +03:00

ACK_EXTENDED frame support

Summary:
This introduces a new frame type for acks (ACK_EXTENDED) that can carry optional fields depending on the features supported by the peer. The currently supported features set will include ECN count fields, and Receive Timstamp fields. This enables a quic connection to report both ECN counts and receive timestamps, which is not possible otherwise because they use different frame types.

Support for the extended ack as well as the set of features that can be included in it is negotiated through a new transport parameter (extended_ack_supported = 0xff0a004). Its value indicates which features are supported by the local transport. The value is an integer which is evaluated against the following bitmasks:
```
  ECN_COUNTS = 0x01,
  RECEIVE_TIMESTAMPS = 0x02,
```

This diff introduces the transport parameter and negotiates the supported features between the peers of the connection. The parameter is cached in the psk cache so the client can remember the server config. It is also encoded inside the 0-rtt ticket so the server can reject it if its local config has changed.

The following diffs add reading and writing the frame itself.

The ACK_EXTENDED frame itself will have the following format
```
ACK_EXTENDED Frame {
  Type (i) = 0xB1
  // Fields of the existing ACK (type=0x02) frame:
  Largest Acknowledged (i),
  ACK Delay (i),
  ACK Range Count (i),
  First ACK Range (i),
  ACK Range (..) ...,
  Extended Ack Features (i),
  // Optional ECN counts (if bit 0 is set in Features)
  [ECN Counts (..)],
  // Optional Receive Timestamps (if bit 1 is set in Features)
  [Receive Timestamps (..)]
}

// Fields from the existing ACK_ECN frame
ECN Counts {
  ECT0 Count (i),
  ECT1 Count (i),
  ECN-CE Count (i),
}

// Fields from the existing ACK_RECEIVE_TIMESTAMPS frame
Receive Timestamps {
  Timestamp Range Count (i),
  Timestamp Ranges (..) ...,
}

Timestamp Range {
  Gap (i),
  Timestamp Delta Count (i),
  Timestamp Delta (i) ...,
}
```

Reviewed By: sharmafb

Differential Revision: D68931151

fbshipit-source-id: 44c8c83d2f434abca97c4e85f0fa7502736cddc1
This commit is contained in:
Joseph Beshay
2025-02-24 12:32:50 -08:00
committed by Facebook GitHub Bot
parent 466d304058
commit b45c82b884
24 changed files with 277 additions and 57 deletions

View File

@@ -250,6 +250,11 @@ void processClientInitialParams(
TransportParameterId::knob_frames_supported),
clientParams.parameters);
auto extendedAckFeatures = getIntegerParameter(
static_cast<TransportParameterId>(
TransportParameterId::extended_ack_features),
clientParams.parameters);
auto reliableResetTpIter = findParameter(
clientParams.parameters,
static_cast<TransportParameterId>(
@@ -381,6 +386,7 @@ void processClientInitialParams(
}
conn.peerAdvertisedKnobFrameSupport = knobFrameSupported.value_or(0) > 0;
conn.peerAdvertisedExtendedAckFeatures = extendedAckFeatures.value_or(0);
}
void updateHandshakeState(QuicServerConnectionState& conn) {
@@ -1113,6 +1119,21 @@ void onServerReadDataFromOpen(
<< conn;
isNonProbingPacket = true;
ReadAckFrame& ackFrame = *quicFrame.asReadAckFrame();
if (ackFrame.frameType == FrameType::ACK_EXTENDED &&
!conn.transportSettings.advertisedExtendedAckFeatures) {
throw QuicTransportException(
"Received unexpected ACK_EXTENDED frame",
TransportErrorCode::PROTOCOL_VIOLATION);
} else if (
ackFrame.frameType == FrameType::ACK_RECEIVE_TIMESTAMPS &&
!conn.transportSettings
.maybeAckReceiveTimestampsConfigSentToPeer) {
throw QuicTransportException(
"Received unexpected ACK_RECEIVE_TIMESTAMPS frame",
TransportErrorCode::PROTOCOL_VIOLATION);
}
conn.lastProcessedAckEvents.emplace_back(processAckFrame(
conn,
packetNumberSpace,