1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-24 04:01:07 +03:00
Commit Graph

55 Commits

Author SHA1 Message Date
Joseph Beshay
b45c82b884 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
2025-02-24 12:32:50 -08:00
Aman Sharma
efba61871f Create a RST_STREAM_AT frame type and decoding functionality
Summary:
You can find the format of the RST_STREAM_AT frame in the [RFC](https://datatracker.ietf.org/doc/html/draft-ietf-quic-reliable-stream-reset-06#name-reset_stream_at-frame). In this change, I'm adding RST_STREAM_AT to the FrameType enum and am also adding the functionality to decode such frames.

Note that we ignore the case when we receive RST_STREAM_AT frames (because we haven't implemented their handler yet).

Reviewed By: hanidamlaj

Differential Revision: D64836490

fbshipit-source-id: 5bd742b14c343ce2f26dd29d3a285a6fed60676a
2024-11-15 12:33:48 -08:00
Jolene Tan
1fa1a2adee Add new QUIC version MVFST_EXPERIMENTAL4 with new salt
Reviewed By: mjoras

Differential Revision: D63144092

fbshipit-source-id: ed6c2df8e6b3f87a3e8ee64859b765b6580d7207
2024-09-23 14:19:42 -07:00
Matt Joras
f8d37db8e8 Move token to a pointer.
Summary: This really shouldn't be a string either, but this is a better first step to get the overhead out of every outstanding packet while not changing callers. If an empty string is passed in, don't allocate anything. This saves another 16 bytes per OP.

Reviewed By: sharmafb

Differential Revision: D57195096

fbshipit-source-id: a8fdb21e960a61985e439dc23857d3aa34cbf021
2024-06-11 11:02:02 -07:00
Matt Joras
5c32ba983d Move LongHeaderInvariant to a pointer.
Summary: Storing the relatively large CIDs inline is not needed, especially since it inflates the size of _every_ kind of outstanding packet for no particular reason. We don't need those in OP for long headers either, but this is an easy way to save 40 bytes per OP.

Reviewed By: hanidamlaj

Differential Revision: D57194725

fbshipit-source-id: 0f3fc05ffd32b55c69384387bc0673091cac2751
2024-06-11 11:02:02 -07:00
Hani Damlaj
98fde365c7 elide unnecessary string constructors/copies
Summary: std::string -> std::string_view return type change for some to_string functions

Reviewed By: sharmafb

Differential Revision: D57633228

fbshipit-source-id: 931fa1869f8f39b146af4994e58a7e8d918569c2
2024-05-26 11:58:55 -07:00
Konstantin Tsoy
9d16a6ebea Add another QUIC version alias
Summary: Add another QUIC version alias

Reviewed By: sharmafb

Differential Revision: D57233430

fbshipit-source-id: 7536e5bb13b84ca3e2de818fdc05adf894831ccb
2024-05-15 14:06:27 -07:00
Hani Damlaj
4eefa3bebd remove QuicVersion::QUIC_DRAFT
Summary: - as title, deprecate QuicVersion::QUIC_DRAFT

Reviewed By: jbeshay

Differential Revision: D50466992

fbshipit-source-id: 2b2776d142142bc07fd27053a68dd635959a7f31
2023-11-09 19:30:07 -08:00
Sharad Jaiswal (Eng)
96abc8160d Codec changes to support ACK_RECEIVE_TIMESTAMPS
Summary: Create a new ACK_RECEIVE_TIMESTAMPS frame, as outlined in https://www.ietf.org/archive/id/draft-smith-quic-receive-ts-00.html#name-ack_receive_timestamps-fram

Reviewed By: mjoras

Differential Revision: D37799050

fbshipit-source-id: 0157c7fa7c4e489bb310f7c9cd6c0c1877e4967f
2022-11-16 13:02:27 -08:00
Joseph Beshay
abee1d8387 Add IMMEDIATE_ACK frame
Summary: Add the new IMMEDIATE_ACK frame from the ack frequency draft.

Reviewed By: mjoras

Differential Revision: D38523438

fbshipit-source-id: 79f4a26160ccf4333fb79897ab4ace2ed262fa01
2022-08-24 11:11:33 -07:00
Junqi Wang
1a82cd8325 Add experimental QUIC V1 alias version
Reviewed By: kvtsoy

Differential Revision: D34421598

fbshipit-source-id: b0cc2e77e3186be1e9390cd6e8bd30b9f32dc797
2022-08-03 17:26:56 -07:00
Konstantin Tsoy
4faaa83642 Codec writing/reading of stream group ids
Summary: Add writing and reading of stream group ids

Reviewed By: mjoras

Differential Revision: D36415929

fbshipit-source-id: 650bb8d6f81b2014741a517b165b4d27b7b6c0fe
2022-06-03 15:47:17 -07:00
Konstantin Tsoy
62f351bf9e Remove MVFST_ALIAS2 version
Summary: Remove MVFST_ALIAS2 version

Reviewed By: hanidamlaj, mjoras

Differential Revision: D35583189

fbshipit-source-id: de54e972ff214c05d3df5d0fb731de908cb284c2
2022-05-06 13:41:15 -07:00
Hani Damlaj
c8bf098e5d Change Implementation of WritableBytesLimit
Summary: - updating usage of WritableBytesLimit

Reviewed By: mjoras

Differential Revision: D33079816

fbshipit-source-id: 1854f40a7b00526afb2167764aeddf55edb1771f
2022-04-04 16:18:52 -07:00
Konstantin Tsoy
afc333bc01 Another alias version
Summary: Another alias version

Reviewed By: mjoras

Differential Revision: D35334978

fbshipit-source-id: 07778e063852c698ac3c48ce6e65efa23135d6cc
2022-04-02 12:20:08 -07:00
Konstantin Tsoy
42d13f54ae Do not emit empty PTO packets
Summary: Do not emit empty PTO packets

Reviewed By: mjoras

Differential Revision: D34944343

fbshipit-source-id: a49d82cc3d137ed7f113a8e5adab54c84e0e72d0
2022-03-17 08:48:28 -07:00
Joseph Beshay
5667fde549 Remove all references to QUIC draft-27 and h3-27
Summary: QUIC Draft-27 and h3-27 are not being used anymore. This removed the remaining references from the code.

Reviewed By: mjoras

Differential Revision: D33647403

fbshipit-source-id: b7cc5f05adffcd2244b7843094d3b0ca73a3ca6b
2022-01-20 15:53:28 -08:00
Hani Damlaj
00e67c1bf9 mvfst License Header Update
Reviewed By: lnicco

Differential Revision: D33587012

fbshipit-source-id: 972eb440f0156c9c04aa6e8787561b18295c1a97
2022-01-18 13:56:12 -08:00
Hani Damlaj
2660a288b3 Update Company Name
Summary: - as title

Reviewed By: lnicco

Differential Revision: D33513410

fbshipit-source-id: 282b6f512cf83b9abb7990402661135b658f7bd1
2022-01-13 12:07:48 -08:00
Hani Damlaj
7233c55d29 Issue NewTokenFrame To Clients
Summary:
- Issuing NewTokenFrames to clients, allowing them to verify their address in subsequent connections by including the token.
- add NewTokenFrame struct in the union type QuicSimpleFrame.
- Issued only once when the crypto handshake is complete.
- Testing includes validating token serialization & deserialization and asserting that the NewTokenFrame is only issued once on handshake completeness.

Reviewed By: mjoras

Differential Revision: D31673160

fbshipit-source-id: 9401ab1a4b878d8b4380d55afa531ec768f5f4cd
2021-12-10 20:35:49 -08:00
Joseph Beshay
719af99fc5 Upgrade QUIC to V1 and HTTP/3 to h3
Summary:
Update QUIC to V1 and HTTP/3 to h3. In order to support interop, hq-interop ALPN has been added too.

This change maintains support for draft-27 and draft-29 implementations.

Reviewed By: mjoras

Differential Revision: D29714556

fbshipit-source-id: 0685928ef4bede0b5511e59572e9c86ccc867320
2021-08-25 10:22:46 -07:00
Konstantin Tsoy
ceef3d0268 Add a new experimental version to turn on qlog
Summary: Add MVFST version alias.

Reviewed By: mjoras

Differential Revision: D30028325

fbshipit-source-id: 091882fc777ab0fcee484d6c235d59b4a9faf029
2021-08-04 09:59:37 -07:00
Joseph Beshay
5e2f5719b7 Remove all remaining references to QuicVersion::MVFST_D24
Summary:
- Remove QuicVersion::MVFST_D24 (3625d9e7af) constant
- Remove all references in QUIC code
- Remove external references
- Change Liger defaults that referred to the removed constant value

Reviewed By: mjoras

Differential Revision: D29767833

fbshipit-source-id: 980b3c4a7f190442577c3dede14127e77ce472fa
2021-07-20 13:31:10 -07:00
Joseph Beshay
ffab50b5b7 Use fresh ACK state when rebuilding ACK frames
Summary:
When rebuilding outstanding packets, if the packet contains an ACK, use a fresh ACK state instead of the potentially stale one from the outstanding packet.

Collateral changes:
- The AckVisitor logic in processAckFrame now visits AckFrames all the time. This is to guarantee that they are visited even if they belong to cloned packets. The behavior for all other frame types remains unchanged.
- If rebuilding the AckFrame is not successful, it is ignored. The rest of the clone packet is still sent.

I have tried to address all the concerns that were previously raised on D27377752

Reviewed By: yangchi

Differential Revision: D28659967

fbshipit-source-id: fc3c76b234a6e7140dbf038b2a8a44da8fd55bcd
2021-05-26 13:41:43 -07:00
Luca Niccolini
e39bf5f447 parse and write DATAGRAM Frames
Summary: This diff is the encode and decode support of Datagram frame.

Reviewed By: mjoras, yangchi

Differential Revision: D20983883

fbshipit-source-id: 1a72a87e6ce3601b71fececca872a9d20bf7820e
2021-05-04 10:53:00 -07:00
Matt Joras
382c1cdcc6 Remove partial reliability from mvfst.
Summary: As in title.

Reviewed By: yangchi

Differential Revision: D26701886

fbshipit-source-id: c7b36c616200b17fbf697eff4ba0d18695effb45
2021-03-03 15:30:21 -08:00
Matt Joras
21f190220e Implement basic ACK_FREQUENCY support.
Summary: As in title. This doesn't actually send any frames, but implements basic support for the transport parameter and responding to the frames.

Reviewed By: yangchi

Differential Revision: D26134787

fbshipit-source-id: 2c48e01084034317c8f36f89c69d172e3cb42278
2021-02-02 19:02:40 -08:00
Andres Suarez
05d07cbfd0 Apply clang-format update fixes
Reviewed By: igorsugak

Differential Revision: D25849213

fbshipit-source-id: a2a538230e769b2c328ae3dd0a19dfbfd693fe3b
2021-01-09 15:39:52 -08:00
generatedunixname89002005325676
bf806a2e73 Daily arc lint --take CLANGFORMAT
Reviewed By: zertosh

Differential Revision: D24328938

fbshipit-source-id: 2b6828ca922a82d5f1c21f4c7de9716598e19550
2020-10-15 08:29:54 -07:00
Aman Sharma
3dcb3b5f73 Make QuicPacketBuilder changes for Retry Packets
Summary:
Summary of changes:

- In an earlier version of the draft, retry packets would contain the client's original destination connection id in the header. This is no longer the case. Therefore, we can remove it.
- Made modifications to the calculation of the header size in `encodeLongHeaderHelper` so that it's correct.

Reviewed By: mjoras

Differential Revision: D21465107

fbshipit-source-id: 662d2df42924d77c917f35566d0b1167fda53917
2020-10-14 15:28:20 -07:00
Alex Liu
7b607fd815 Add timestamp to retry token
Reviewed By: sharmafb

Differential Revision: D23588354

fbshipit-source-id: de5b8ef33f192e4cfcf9b129c4569142553d0576
2020-10-02 12:51:38 -07:00
Matt Joras
80c0b3185a Introducing the KnobFrame
Summary:
This introduces a new extension frame, the KnobFrame, and an implementation.

The idea with Knobs is that they are arbitrary key-values within a namespace that can be transmitted to the peer at any time. They provide an alternative to transport settings, by eschewing the standard transport setting space entirely.

The idea is simple, each knob has a "knobspace", "id", and value. The knobspace is a namespace in which the knob has semantic meaning (e.g. 0xfaceb00). The id and value are just that, arbitrary identifiers and values.

On receiving a knob it is the application's reponsibility to deal with it.

Reviewed By: mjoras

Differential Revision: D23601468

fbshipit-source-id: 63e5e4a7bdb76e11e8c952f1234f512a629ef348
2020-09-11 14:29:29 -07:00
Matt Joras
6f594b098c Add MVFST_EXPERIMENTAL
Summary: This is useful for testing a subset of server-side transport changes especially.

Reviewed By: yangchi

Differential Revision: D23600055

fbshipit-source-id: 82eeba8eead5770c377350c42b466471b98cb02e
2020-09-09 13:39:52 -07:00
Matt Joras
42bba01005 Draft-29 support.
Summary:
This implements the connection ID validation via transport parameters. Note we don't do anything with the retry transport parameter yet.

This will probably require further surgery to tests when we want the MVFST version to do this, but for now I'm punting on that test plumbing.

This retains support for h3-27.

Reviewed By: yangchi

Differential Revision: D22045631

fbshipit-source-id: e93841e734c0683655c751d808fd90b3b391eb3e
2020-06-16 17:05:41 -07:00
Aman Sharma
04f70750eb Add a "RetryToken" type
Summary:
The purpose of this diff is to define what goes into a retry token. It will, in its un-encrypted form contain:
- the original destination connection id
- the client ip
- the client port

Reviewed By: mjoras

Differential Revision: D21073336

fbshipit-source-id: e55468c1201a0ecc6b2f4a4f46471b4e15af9daf
2020-04-21 15:19:56 -07:00
Matt Joras
d1a3652a4c Iterate QuicVersion::MVFST
Summary:
This iterates the mvfst version to be semantically equivalent to draft-27, and leaves support for the old mvfst version.

The client will not yet be moved to draft-27 by default.

Reviewed By: lnicco

Differential Revision: D20182452

fbshipit-source-id: 1e11ad7296a6cd8d15ca5ed359d9ed82af79bb17
2020-03-04 22:08:34 -08:00
Matt Joras
3b2ba3fe8b Implement handshake done
Summary: This is without cipher dropping, but the frame is parseable and the server will send it at the correct time.

Reviewed By: yangchi, lnicco

Differential Revision: D20235013

fbshipit-source-id: 696c11ec573a530b3ed9f4185a2f6847ee08819f
2020-03-04 22:08:33 -08:00
Matt Joras
61cd1a7289 Back out "Implement handshake done and cipher dropping."
Summary: This caused an increase in client errors.

Reviewed By: yangchi, lnicco

Differential Revision: D20186386

fbshipit-source-id: 737122a94c97498efba61292a6c292cfe482925c
2020-03-01 18:31:40 -08:00
Matt Joras
2b3b76cc4d Remove support for MVFST_OLD.
Summary:
This eliminatees some tech debt by completely removing the notion of version from the core transport parameters structure and the app token for zero rtt.

Note that for the draft-27 changes we will need to temporarily re-introduce it, but to a different layer (the extension encoding itself).

Reviewed By: JunqiWang

Differential Revision: D20073578

fbshipit-source-id: 2b55af621566bf1c20e21dd17251116de1788fa0
2020-02-28 09:52:34 -08:00
Matt Joras
472e40a902 Implement handshake done and cipher dropping.
Summary: This implements the handshake done signal and also cipher dropping.

Reviewed By: yangchi

Differential Revision: D19584922

fbshipit-source-id: a98bec8f1076393b051ff65a2d8aae7d572b42f5
2020-02-27 12:25:52 -08:00
Matt Joras
a2b6dc5453 Inline getPacketSequenceNum and getPacketNumSpace
Summary: As it turns out these end up being hot functions. Most of the hotness is it taking the cache miss, but we're able to reduce it from .9% exclusive each to .1-.3% exclusive each by inlining it (which eliminates a `callq` instruction for each).

Reviewed By: yangchi

Differential Revision: D19069685

fbshipit-source-id: c971a4d1c26a7e48008c36a129e0a842a27ca87f
2019-12-14 20:17:32 -08:00
Raghu Nallamothu
e06de27550 Merge Application Close Frame and Connection Close Frame
Summary: As a part of Draft 17, application close frame has been removed, we use connection close frame to represent both application close and connection close.

Reviewed By: mjoras

Differential Revision: D18580856

fbshipit-source-id: d274fa2d3dbc59b926bca5a2b8a20328ae582703
2019-12-03 15:02:06 -08:00
Matt Joras
6c45bb479a Draft 24.
Summary: There's no wire breaking changes, so we can up the version for interop.

Reviewed By: siyengar

Differential Revision: D18486643

fbshipit-source-id: 78d7ff9a0802f17927bcc19cecb375e9295d6708
2019-11-15 10:25:46 -08:00
Jiahao Wu
06335bac7c Fix MSVC warnings in quic (default branch)
Summary: - add default branch to switch statement

Reviewed By: yangchi

Differential Revision: D18193056

fbshipit-source-id: e381080f4ba248d5aa35e692ba6dbc5a586e02dd
2019-10-29 18:02:18 -07:00
Subodh Iyengar
8ad7d05693 use custom variant type for errors
Summary: Use the custom variant type for errors.

Reviewed By: yangchi

Differential Revision: D17826935

fbshipit-source-id: 2bf0c3e1cc8ca84b504d201fd6c2a4266878b715
2019-10-09 22:37:40 -07:00
Subodh Iyengar
04baa15a04 Custom variant type for packetheader
Summary:
Make a custom variant type for PacketHeader. By not relying on boost::variant
this reduces the code size of the implementation.

This uses a combination of a union type as well as a enum type to emulate a variant

Reviewed By: yangchi

Differential Revision: D17187589

fbshipit-source-id: 00c2b9b8dd3f3e73af766d84888b13b9d867165a
2019-09-19 17:31:47 -07:00
Matt Joras
bcd9578fb3 Draft-23 salts and version.
Summary: This is changing with every draft now. There aren't any "hard" changes to the transport to function, just behavioral changes here and there we need to address.

Reviewed By: siyengar

Differential Revision: D17457230

fbshipit-source-id: 0883dc0385b01481e07e9fee0b5818fc4a25db72
2019-09-18 17:15:57 -07:00
Andrew Krieger
ea1a33b903 Misc fixes for building on Windows
Summary:
Mostly need a bunch of folly::assume_unreachable() (sometimes
replacing __builtin_unreachable()). One place using designated initializers
that had to get commented out. Some headers replaced with folly portability ones.

Reviewed By: mzlee, phoad

Differential Revision: D16970520

fbshipit-source-id: 1b8a36ecb1975e2dc0869b66c4ea5439baf7575d
2019-08-26 22:56:55 -07:00
Matt Joras
15fbe5106c Explicit stream frame types
Summary:
Prior to this we had an incorrect check for something being a stream frame. It technically should have worked for minimally encoded frame types, but would not work for a spec-incompliant frame type.

Instead of using a mask this makes it so each stream frame type is explicitly enumerated. This isn't as clean looking but is easier to validate as correct.

This also revealed some places where we were not correctly plumbing through the version for unit tests, so fixing those as a driveby.

Reviewed By: yangchi

Differential Revision: D16676631

fbshipit-source-id: 835dcc6e1f431bbe3fa4a5c6b8e616863c126155
2019-08-08 09:02:03 -07:00
Matt Joras
2f528e68c0 Draft-22 invariants change
Summary:
Draft-22 onwards uses two one byte length fields to encode connection ID length instead of one one byte length field.

To support this without disrupting existing clients we need to make our parsing version dependent. This diff accomplishes it by special casing the existing Facebook client QUIC version (0xfaceb000), and changing the default Facebook client version going forward to 0xfaceb001.

Note that this diff also changes the behavior of the ticket transport parameters. When we changed from draft-18 to draft-19 transport parameters I apparently forgot to update the ticket transport parameters to the new format.

Reviewed By: yangchi

Differential Revision: D16205090

fbshipit-source-id: e74a92fa959d308f4bb43bad76e58d4b58d07322
2019-07-16 17:59:58 -07:00