1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00
Commit Graph

162 Commits

Author SHA1 Message Date
Konstantin Tsoy
21ea1990ab Add a useSplitConnectionCallbacks to mvfst
Summary:
This change just adds a (currently no-op) flag that will be used in diffs up the stack.

The idea here is that I'll add split QUIC connection callback interfaces that will live side by side with existing single monolithic callback for now. We will experiment with split callbacks on small scale to see that there is no regressions and then will phase out the old callback gradually.

This flag is to control which callback(s) to use.

Reviewed By: mjoras

Differential Revision: D30399667

fbshipit-source-id: 8fc4e4a005e93cf6d48a987f49edee33b90dbbf1
2021-08-31 18:27:40 -07:00
Konstantin Tsoy
ee59ae43c6 resetConnectionCallbacks() util function
Summary: In preparation for split callbacks

Reviewed By: mjoras, lnicco

Differential Revision: D30398849

fbshipit-source-id: 684c289283d0b06b5935fc1b8ab2dcbd126ec0ce
2021-08-25 16:15:42 -07:00
Hani Damlaj
da36437098 Remove packetNum From CipherUnavailable
Summary:
- Removed packetNum field from CipherUnavailable struct.

- Removed all instances referring to the field and fixed tests accordingly.

Reviewed By: mjoras

Differential Revision: D29968168

fbshipit-source-id: 9802b8cd66f43f2a8d54340f2d00639ee4679aaf
2021-08-04 12:13:21 -07:00
Matt Joras
612a00c3f9 Move happy eyeballs state to client state.
Summary: This doesn't belong in the generic state. Untangling it is a little difficult, but I think this solution is cleaner than having it in the generic state.

Reviewed By: JunqiWang

Differential Revision: D29856391

fbshipit-source-id: 1042109ed29cd1d20d139e08548d187b469c8398
2021-07-23 14:21:16 -07:00
Matt Joras
7402dbe6c9 Move zero RTT ciphers to client state.
Summary: As in title, this doesn't need to be in the base state.

Reviewed By: JunqiWang

Differential Revision: D29855140

fbshipit-source-id: 8d3a4b12fd6b93b2277020d56862915e084f1c05
2021-07-23 14:21:16 -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
Matt Joras
003f012cb7 TODO comment cleanup.
Summary:
These are either no longer relevant, are unlikely to be done, or are spculative enough that they don't deserve code space.

Hope here is to make our search for TODOs higher signal.

Reviewed By: lnicco

Differential Revision: D29769792

fbshipit-source-id: 7cfa62cdc15e72d8b7b0cd5dbb5913ea3ca3dc5a
2021-07-20 10:27:32 -07:00
Konstantin Tsoy
30cbd92bfa Remove useless comment
Summary: Remove old comment not needed anymore.

Reviewed By: lnicco

Differential Revision: D29744473

fbshipit-source-id: 83e50cd5bce1761a044fbc30b3d3c6cce05ae72d
2021-07-17 18:26:13 -07:00
Matt Joras
6c6b8f6980 Optionally early retransmit 0RTT stream data.
Summary:
If some 0RTT packets are lost we will not detect the loss until we get a short header ACK from the server or the loss timeout expires. This could potentially take a long time.

This adds an option which will optionally retransmit any 0RTT data as soon as the handshake is complete.

Reviewed By: lnicco

Differential Revision: D29111647

fbshipit-source-id: 3c1924ce178a01eaa20a94561df82a59733b8b71
2021-06-15 18:22:06 -07:00
Matt Joras
9fedc51857 Don't ignore error message queue for happy eyeballs
Summary: Prior to this any socket level error message would kill the connection. This doesn't make sense when happy eyeballs is ongoing.

Reviewed By: jbeshay

Differential Revision: D28979505

fbshipit-source-id: 29d1a3b3f0db56a073433a04b888241fe7b91767
2021-06-08 17:36:24 -07:00
Matt Joras
6a833aeee2 Trigger happy eyeballs timeout instead of canceling when write to first socket errors.
Summary: Without this we won't actually retransmit the 0RTT data on the second socket until they are declared lost after the handshake is done.

Reviewed By: JunqiWang

Differential Revision: D28942340

fbshipit-source-id: 192c9ca0544bfde9610720ca1b02322709f0e61e
2021-06-08 17:36:24 -07:00
Matt Joras
7c250a6781 Close connection on any errmsg callback error.
Summary: As in title. The socket delivering errors this way is probably a bad sign.

Reviewed By: yangchi

Differential Revision: D28432809

fbshipit-source-id: 8c7fcbd4f6a9aa58fb19e73f489bd321dde76761
2021-05-14 13:05:24 -07:00
Luca Niccolini
026568e692 max_datagram_frame_size transport setting
Summary:
conditionally enable datagram support and communicate it to the peer via max_datagram_frame_size transport setting

https://quicwg.org/datagram/draft-ietf-quic-datagram.html#name-transport-parameter

Reviewed By: mjoras

Differential Revision: D27385012

fbshipit-source-id: 8c61765b6e044105409b0c638a8d6d16319ca21b
2021-05-11 08:24:03 -07:00
Yang Chi
38c903ba2f Remove all QUIC_TRACEs
Summary: no longer used

Reviewed By: lnicco

Differential Revision: D28141008

fbshipit-source-id: 870d6574cc1657914a08f1ef5ee581cfef96aad1
2021-05-10 12:46:08 -07:00
Luca Niccolini
ec9c10f635 handle receiving datagram
Summary:
receive datagrams.
And add some tests

Reviewed By: mjoras

Differential Revision: D26244066

fbshipit-source-id: f794dfce9feb08040afbda84b1c2adf3994a0993
2021-05-04 10:53:00 -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
Yang Chi
a16f502393 Adding control of the starting packet number in a server connection
Summary: as title, this is a testing only API

Reviewed By: mjoras

Differential Revision: D27746039

fbshipit-source-id: cf87836810a4579f622152ccb17aca49a0d605e3
2021-04-27 13:57:51 -07:00
Matt Joras
dabb1a1bf1 Always set stateless reset token.
Summary:
This is another bandaid around our incorrect not updating of 0-RTT transport parameters on the client. The long term fix requires us to update all the parameters based on the final ones from the server. This will require a bit of a refactor to this area of the code as well.

Until we do that, manually set the stateless reset token so that 0-RTT clients can actually parse server stateless resets.

Reviewed By: yangchi

Differential Revision: D27875279

fbshipit-source-id: 1d08a53f2a9d876635dcd884b6bba316224543dd
2021-04-20 11:03:56 -07:00
Matt Joras
98298496a2 Add some more info to transport summary qlog
Summary: Same as before!

Reviewed By: lnicco

Differential Revision: D27785992

fbshipit-source-id: 0160fb1572c8afc3dbbcf1dac50fc73ddbfbad83
2021-04-14 20:05:53 -07:00
Chetan Ambekar
cd754c2499 Revert D27768829: Add some more info to transport summary qlog
Differential Revision:
D27768829 (3ed777d04f)

Original commit changeset: 43cbf88f38ce

fbshipit-source-id: 4c678ebccbb7c9c33b1c7ab9ed98f6bdbc9c7e49
2021-04-14 18:45:06 -07:00
Matt Joras
3ed777d04f Add some more info to transport summary qlog
Summary: Specifically interested in seeing whether 0RTT was used, writable bytes, and conn flow control.

Reviewed By: yangchi

Differential Revision: D27768829

fbshipit-source-id: 43cbf88f38ce56065cad785344dedc279a0af7d1
2021-04-14 18:08:13 -07:00
Matt Joras
fc4e7a7405 Remove MVFST_D24 from client.
Summary: Keep on server for now but disallow it in code for the client.

Reviewed By: yangchi

Differential Revision: D27726584

fbshipit-source-id: c567d9db82c36b6e60d438d839709f0330b8db50
2021-04-13 10:11:47 -07:00
Matt Joras
b16c3b306b Clean up initial/handshake ciphers a little more intelligently.
Summary: Right now we are running the handshakeConfirmed code a lot on the client. This is excessive. We only need to run the code if we haven't already dropped the cipher.

Reviewed By: yangchi

Differential Revision: D27725974

fbshipit-source-id: ca325c132debdd280e447ca30876488b879ff13c
2021-04-13 10:11:47 -07:00
Matt Joras
d9d2d29af6 Buffer packets on the client when we don't have ciphers.
Summary:
This can happen when we don't get the server handshake data in time, but it is especially bad with 0RTT when it is potentially a full flight of 1RTT data that is dropped while we wait for the handshake PTO.

Note this leverages the existing CipherUnavailable mechanism, but processes them in a much more simple way than the server side. Additionally, only 1-RTT packets need to be buffered.

Reviewed By: yangchi, lnicco

Differential Revision: D27634184

fbshipit-source-id: db5ba0b9f07176d106f709c7a11d83d0fc8281b7
2021-04-08 16:38:53 -07:00
Joseph Beshay
9300daea87 End the connection on receiving packets without frames and report a protocol violation.
Summary:
On receiving a QUIC packet, if the packet has no frames we should end the connection with PROTOCOL_VIOLATION.

This fixes the error reported by h3spec test `/QUIC servers/MUST send PROTOCOL_VIOLATION on no frames [Transport 12.4]/`

This change adds the check right after a packet is successfully parsed for both the client and server.

Reviewed By: mjoras

Differential Revision: D27483874

fbshipit-source-id: 9b648709e6985f151ba0ffc973aa05c28683fbe9
2021-04-06 18:59:01 -07:00
Matt Joras
55e0fa070e Send probes on all spaces take 2.
Summary:
As before we will now aggressively send probes on all spaces with probes available when the PTO timer fires.

This time with more unit tests and some bug fixes.

Reviewed By: yangchi

Differential Revision: D27338523

fbshipit-source-id: 8a9ccb90ed691e996fab4afa2f132c0f99044fbc
2021-04-02 14:59:57 -07:00
Matt Joras
a92a24bdd5 Back out "Send probes for all spaces."
Summary: As in title. There's a bug here somewhere with empty write loops we need to find.

Reviewed By: yangchi

Differential Revision: D27279100

fbshipit-source-id: e1d26fbf8d6df1590d464a6504a8b940b46794e0
2021-03-23 16:10:12 -07:00
Matt Joras
bceb00346b Send probes for all spaces.
Summary:
Previously we would only send probes for the first space which had one available, i.e. Initial before Handshake before AppData. Since we only have one PTO timer this can lead to situations where we perpetually probe with only Initials, which can significantly delay the handshake if we should have probed with Handshakes.

With this diff we will keep the single PTO timer but aggressively write more probes from all spaces if they are available.

Additionally this refactors some counters into EnumArrays

Reviewed By: yangchi

Differential Revision: D27235199

fbshipit-source-id: ef3614a833bf0f02f5806846a1335fa7ac2a4dc8
2021-03-23 12:51:36 -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
Andy Lien
63c9798ea9 log quic stats in recvMesg
Summary:
From what I can tell this looks like a bug in recvMesg where we weren't calling QUIC_STATS on packet received for recvMesg. Not completely sure what I'm doing here but seems possibly legit.

When I started using a pool in D25017895 that had quic_config "should_recv_batch" on, my canaries showed no data for packets received. This seems to be the cause but I'm not sure if this is intentional or just something missed.

Some more context here: https://fb.workplace.com/groups/1528424050798314/permalink/2439895836317793/

Reviewed By: lnicco

Differential Revision: D26407505

fbshipit-source-id: d80fb6473bd23af0100cb56fb66fe313dcbf60fa
2021-02-12 12:02:09 -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
Sridhar Srinivasan
27fe474171 Migrate the QUIC and TransportMonitor libraries to use the new unified Observer callback class
Summary:
We were using the LifecycleObserver and InstrumentationObserver classes
separately, to generate and receive callbacks.

This change migrates both these to use the unified Observer callback class and
adjusts the unit tests.

Reviewed By: bschlinker

Differential Revision: D25845845

fbshipit-source-id: c489400f5d70bccadbcc1d957136c5ade36b65ff
2021-01-13 15:35:06 -08:00
Yang Chi
72eeeb8a4f QUIC Retry + HappyEyeballs fix on client transport
Summary:
(1) Receiving a valid retry packet is a HappyEyeballs signal. We should
use that to update the happy eyeballs state.

(2) HappyEyeballs state should also be preserved when we undo client connection
state for retry.

Reviewed By: mjoras

Differential Revision: D25728713

fbshipit-source-id: 4ff06879f5a05e6fb4faeb1e9f330e251d3dbcb6
2021-01-04 15:28:19 -08:00
Yang Chi
8bc2d37d9f CHECK against socket presence in QUIC happy eyeballs
Summary:
If we are still doing happyeyeballs, and receives packet, the main
socket has to be present whatever the situation is, and the second socket has
to be present if we claim the second one wins

Reviewed By: lnicco

Differential Revision: D25726770

fbshipit-source-id: 17ba616dde9affed6a2bcba8d64e4e0a4e8ac9b0
2020-12-29 21:34:41 -08:00
Yang Chi
9faa4544f3 A couple easy code hygiene in QUIC
Summary:
(1) Stop moving integral types (2) stop copying
ClientTransportParameters

Reviewed By: lnicco, avasylev

Differential Revision: D25724204

fbshipit-source-id: 624ff097f7ea7595e122904c84f6f12a3324e1e9
2020-12-29 11:00:56 -08:00
Yang Chi
c1223a2f78 Remove trailing _E from QUIC variant type
Summary:
I think this should just work without the trailing `_E`. It was added
when we mixed up our own union based variant and boost::variant. Some compiler
flags didn't like that. Now we no longer have mixed up cases, this should be
fine

Reviewed By: lnicco

Differential Revision: D25589393

fbshipit-source-id: 6430dc20f8e81af0329d89e6990c16826da168b8
2020-12-16 18:03:05 -08:00
Yang Chi
a4ec325df8 Fix QuicClientTransportIntegrationTests.TestStatelessResetToken flakyness
Summary:
The test case relies on the client transport hits max PTO within 10s
to trigger a read error callback. Sometimes, it takes longer than 10s to hit
max PTO under stress runs

Reviewed By: mjoras

Differential Revision: D25065653

fbshipit-source-id: c728084178126452d0c7c885cb7215878cf4e3b7
2020-11-18 19:04:34 -08:00
Aman Sharma
2560e174a9 Make client keep track of originalDestinationConnectionId
Summary:
When I tested against picoquic, I found that an exception was thrown here: https://fburl.com/diffusion/qsnzingx.

The reason is that we modify `conn.initialDestinationConnectionId` in the event of a retry, so it's no longer the original destination connection id. By separately keeping track of the original destination connection id, we can solve this issue.

Reviewed By: mjoras

Differential Revision: D23722127

fbshipit-source-id: 94be08812e675feaf46f5af86e7304af84c1910c
2020-11-06 16:26:02 -08:00
Dan Melnic
1b286ec679 Add support for socket recv timestamps (if enabled)
Summary:
Add support for socket recv timestamps (if enabled)

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D24397469

fbshipit-source-id: 5624682b925ca990e786082f96529ee67ce7bce4
2020-10-28 20:02:20 -07:00
Dan Melnic
ddb282f31e Avoid duplicate code for UDP CMSG processing
Summary:
Avoid duplicate code for UDP CMSG processing

(Note: this ignores all push blocking failures!)

Reviewed By: yfeldblum

Differential Revision: D24394694

fbshipit-source-id: 80664109154e78ec4d6ee8d33cf9a5269f60195e
2020-10-28 13:06:35 -07:00
Xiaoting Tang
6157952380 Correctify d6d transport parameter id and xmit them during handshake
Summary: We need to increase those parameter Ids above 0xFF00, and xmit them.

Reviewed By: mjoras

Differential Revision: D24115117

fbshipit-source-id: cf8b4970ba8640a83bde22c1f9fdfa1d3e53e3f9
2020-10-06 00:28:39 -07:00
Matt Joras
f16d60e922 Use initial CID as DCID in the qlogger.
Summary: Since the DCID is often empty for clients, this is otherwise not a very useful field.

Reviewed By: yangchi

Differential Revision: D23998639

fbshipit-source-id: b8949ca6913ed270e5ebd0a0c5335b224f817774
2020-09-29 16:59:13 -07:00
Xiaoting Tang
61aa04e26d Send knob frames for transport knobs
Summary: Adds routines to send transport knobs.

Reviewed By: mjoras

Differential Revision: D23825714

fbshipit-source-id: a61b5650eacf0767054e18b59c731072e364c9b2
2020-09-28 19:10:22 -07:00
Matt Joras
af3a408cf7 Increment out of order QUIC_STATS
Summary: We have this counter but don't increment it, might as well.

Reviewed By: yangchi

Differential Revision: D23916621

fbshipit-source-id: 0a8cb947f1941e04789a0144a4fec87239caef50
2020-09-25 12:12:02 -07:00
Xiaoting Tang
33c5832ff3 Add probe timeout transport setting
Summary:
Similar to raise timeout, client can choose the probe timeout via transport
parameter. This timeout might not end up being useful because by the time the
recommended timeout (15s) expires, either:
i. the probe gets acked, d6d send a larger probe or sleeps if the upper bound
is found
ii. the probe is lost, then quic will likely determine its loss faster than
15s, upon which a PMTU blackhole is recognized

So adding this is mostly for mvfst to be compliant with the d6d spec, and
potentially useful if we want to control probe sending rate upon ack, e.g. send
the next probe after 1s upon ack instead of immediately.

Reviewed By: yangchi

Differential Revision: D23700182

fbshipit-source-id: 18b740d05343591d6afa086b9fae746e6c71aca5
2020-09-16 13:58:34 -07:00
Matt Joras
43a0b7e02d Always update max packet size after 0-rtt.
Summary: This is a temporary hack until we properly implement 0-rtt transport parameter updating. Now after 0-rtt we will use the packet size from the peer as the max packet size, if the can ignore setting is set.

Reviewed By: xttjsn

Differential Revision: D23690019

fbshipit-source-id: b4dbf5702e81e52ccd437e0fa68f4d156c7123be
2020-09-15 08:36:59 -07:00
Luca Niccolini
ed9d1bc3e1 correctly start/stop qlog collection when setQlogger is called multiple times
Reviewed By: yangchi

Differential Revision: D23579772

fbshipit-source-id: abe8e5dac3ba46fdccba2b39055e5589179cb8a1
2020-09-09 00:20:09 -07:00
Xiaoting Tang
1ee77666b6 Re-introduce d6d configs
Summary:
As a second attempt to add d6d, I tried to be as non-intrusive as possible, by de-coupling all state that d6d needs from the existing transport state.

To reduce complexity, I made the assumption that, as a starter, only server does the probing. To make it easy to control d6d in different connection settings, both the server and the client has a toggle `enabled`. It is only when both the server and client are `enabled`, that server will do probing for a connection.

Among all the changes, this adds:
- Two transport parameters:
  - `d6d_base_pmtu`: this is the base PMTU client advertises to server during handshake. A valid presence of this value indicates that clients d6d module is `enabled`. Although this config value is not used by server, I kept it in `D6DConfig` to avoid complexity and make it possible for future extension where clients might also do probing.
  - `d6d_raise_timeout`: this is the raise timeout client advertises to server during handshake. It is the amount of time d6d "sleeps" after it finds an upper bond. It is optional. We want this because depending on the network conditions we might need to adjust this timeout.

Reviewed By: mjoras

Differential Revision: D23409623

fbshipit-source-id: bad6df443cc13dc4d69532342f182cb919c5a7dd
2020-09-02 15:40:12 -07:00
Luca Niccolini
c47c3cf5c6 Revert PMTU and size-enforced packet builder
Differential Revision: D23283619

fbshipit-source-id: b7fe31871dad5711016234a2d10ae84edc4fd24c
2020-08-22 16:55:54 -07:00
Xiaoting Tang
4762cfb927 Introduce PMTU as a variable
Summary:
First step towards d6d. Semantically we need to separate the old `udpSendPacketLen` into `peerMaxPacketSize` as well as `currPMTU`. The former is directly tied to the peer's max_packet_size transport parameter whereas the second is controlled by d6d. To get the actual udp mss, call `conn_->getUdpSendPacketLen()`, which will use the minimum of the two if d6d is enabled, otherwise it will fallback to use `peerMaxPacketSize` only.

During processClientInitialParams and processServerInitialParams, we no longer need to check whether `canIgnorePathMTU` is set because that logic is moved to `setUdpSendPacketLen`. If d6d is enabled, we set both `peerMaxPacketSize` and `currPMTU` to `packetSize` because receiving an initial packet of size x indicates both that the peer accepts x-sized packet and that the PMTU is at least x.

Many call sites and tests are changed.

Faebook:
For now, d6d is considered enabled if `canIgnorePathMTU==false` and `turnoffPMTUD==true`. Down the road, from semantic & practical POV at least one of them should be renamed to something like `enableD6D`, since enabling d6d implies turning off PMTUD and that we should not ignore PMTU. We can keep one for the sake of testing.

Reviewed By: mjoras

Differential Revision: D22049806

fbshipit-source-id: 7a9b30b7e2519c132101509be56a9e63b803dc93
2020-08-17 16:15:24 -07:00