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

81 Commits

Author SHA1 Message Date
Junqi Wang
0cbdbe5180 Use new API to validate app params from cache
Summary: When client reads app params from psk cache, invoke to application to get the decision from application whether to attempt early data

Reviewed By: mjoras

Differential Revision: D16267032

fbshipit-source-id: 84aa4eb4c67a0e468fedcd0a0c384dbc56157e44
2019-07-19 08:54:38 -07:00
Bonnie Xu
e04bff7b85 Add datagramReceived event
Summary: Add datagramReceived event for qlog.

Reviewed By: sharma95

Differential Revision: D16271876

fbshipit-source-id: fa38bc0c54f402be45dfc0ff8e85c54268118ea1
2019-07-17 23:55:41 -07:00
Bonnie Xu
9cbe902f81 Add packetDrop to Quic
Summary: [quic] Add packetDrop to Quic, so it can be logged in qlog.

Reviewed By: yangchi

Differential Revision: D16257829

fbshipit-source-id: ca87116f2c708538d05f28098620a5dfc2456f3e
2019-07-17 17:11:25 -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
Bonnie Xu
e63322df0a Add TransportSummary event to Quic
Summary: Add TransportSummary event to Quic, so it can be logged as part of qlog.

Reviewed By: mjoras

Differential Revision: D16116127

fbshipit-source-id: ddfecac5b5452fe9b2e3df87b152561eab903188
2019-07-12 09:43:46 -07:00
Bonnie Xu
ff1c36c25a Added ConnectionClose event to Quic
Summary: Added ConnectionClose event to Quic.

Reviewed By: sharma95

Differential Revision: D16097522

fbshipit-source-id: c46d63ac75246ad93a3c617383f1b9a26d0e0b4f
2019-07-12 07:05:40 -07:00
Konstantin Tsoy
41d4c6afbe Add run-time partial reliability setting override
Summary: Enable/disable partial reliability in transport settings of a QUIC server run-time.

Reviewed By: yangchi

Differential Revision: D16135672

fbshipit-source-id: 93c1175263ec03dc707764520ee73c1c2fd449c9
2019-07-08 22:12:33 -07:00
Amaury Séchet
f4e90017a3 Add mvfst specific encryption level (#26)
Summary:
This ensure a lot of code do not depend on fizz anymore.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/26

Reviewed By: mjoras, JunqiWang

Differential Revision: D16030663

Pulled By: yangchi

fbshipit-source-id: a3cc34905a6afb657da194e2166434425e7e163c
2019-06-27 14:09:04 -07:00
Amaury Séchet
d83cfb6c30 Decouple fizz::Aead and quic::Aead . This makes a large chunk of the codebase fizz agnostic. (#16)
Summary:
This is based on top of https://github.com/facebookincubator/mvfst/issues/15 .

Now that the codebase have been refactored to use Aead/fizz:Aead and MockAead/fizz::test::MockAead in proper places, it is time to ensures the aren't aliases of each others anymore.

This introduces FizzAead as a wrapper for fizz::Aead that implements quic::Aead and forward all calls. Most of the codebase now uses quic::Aead, which a significant step toward being able to swap it for another implementation.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/16

Reviewed By: yangchi

Differential Revision: D15474068

Pulled By: mjoras

fbshipit-source-id: 7cccc9909a45ea538409645644641e39a58bf81d
2019-06-18 16:29:29 -07:00
Bonnie Xu
2762cc1597 Setup stateless reset token
Summary: Replace hard coded stateless reset token with a token from the stateless reset token generator.

Reviewed By: yangchi

Differential Revision: D15481858

fbshipit-source-id: 30c96843c38c616600466b2fabb6defd5fcc5799
2019-06-13 08:44:53 -07:00
Alex Guzman
63d8271b4d Expire cached PSKs when initial handshake is stale
Summary: After a given amount of time, discards PSKs whose handshakes are too old.

Reviewed By: knekritz

Differential Revision: D14174662

fbshipit-source-id: ef505af91732c1030c6ce27835db49cf07d9c506
2019-06-10 13:56:00 -07:00
Yang Chi
75ab1ce6d5 Reset is a unidirectional event
Summary:
Sending a reset shouldn't affect read states. Receiving a reset
shouldn't affect send states.

Reviewed By: afrind

Differential Revision: D15578287

fbshipit-source-id: 65c5e30666fd9e4c295317ba4c3e0653edbb78ff
2019-05-31 13:27:46 -07:00
Amaury Séchet
d6c88ab4b0 Decouple fizz:test::MockAead from MockAead. Use the former for code that actually needs fizz. (#15)
Summary:
This is based on top of #12 .

It logically split MockAead and fizz::MockAead in preparation for separation of the two.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/15

Reviewed By: yangchi

Differential Revision: D15474045

Pulled By: mjoras

fbshipit-source-id: b61a5cb08ddae0add66a6c37e156eddaef118e0c
2019-05-30 09:16:07 -07:00
Bonnie Xu
2040a13e40 Handling TLS Alert and convert it to a Quic connection error.
Summary:
Handles TLS Alert and converts it to a Quic connection error.
See https://quicwg.org/base-drafts/draft-ietf-quic-tls.html#tls-errors for details.

Note that TLS_HANDSHAKE_FAILED is no longer part of the Initial QUIC Transport Error Codes Entries.
See https://quicwg.org/base-drafts/draft-ietf-quic-transport.html, Initial QUIC Transport Error Codes Entries.

Reviewed By: mjoras

Differential Revision: D15456385

fbshipit-source-id: cec3208f4a01bbd00af0bdd94b0e59dc3e400f28
2019-05-29 14:26:05 -07:00
Amaury Séchet
f26cd1f62d Add a bridge to fizz::Aead (#12)
Summary:
This introduce quic::Aead as a simple typedef to fizz::Aead and update the codebase to use quic::Aead . This should not impact the functionality of the code in any way.

This is a first step toward introducing an interface that is specific for mvfst so that mvfst can swap fizz for something else.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/12

Reviewed By: JunqiWang

Differential Revision: D15335324

Pulled By: mjoras

fbshipit-source-id: fef166a9a5c2cbae08ad9511d0abd749f330c221
2019-05-29 11:54:08 -07:00
Matt Joras
5941130809 Send new transport param format from client.
Summary: This is the followup to the previous change to update to the post-d19 transport param format.

Reviewed By: sharma95, lnicco

Differential Revision: D15398080

fbshipit-source-id: a6f1a9d399745058b081ffc4d1fc2be2571a8a69
2019-05-21 09:49:55 -07:00
Junqi Wang
140c672cf8 Add unit tests for 0-rtt maxStreams params
Summary: unit test for previous diff

Reviewed By: mjoras

Differential Revision: D15421519

fbshipit-source-id: d4e251784bd60f9392d6654abb2559e1c89fba1b
2019-05-21 02:24:41 -07:00
Bonnie Xu
f4ae0a1efd Updated files to change syntax.
Summary: Changed existing chrono syntax to chrono_literals syntax.

Reviewed By: mjoras, sharma95

Differential Revision: D15374649

fbshipit-source-id: 40033e90cca226266ef85e4fec629f290bc5dae6
2019-05-20 12:10:46 -07:00
Junqi Wang
d20ea53ec1 Update quic psk cache to d-20
Summary:
Fixed QuicClientTransportIntegrationTest:
SetUp() shouldn't set maxStreams manually. Instead, client should read serverTransportParams after 1 rtt.
The tests used to call createBidiStream right after client->start(), changed that to only sending data after onTransportReady.

Reviewed By: mjoras

Differential Revision: D15293209

fbshipit-source-id: 88e739d72f1fad76666af003d446d068e6d5fac7
2019-05-10 16:19:43 -07:00
Matt Joras
b2e1eedfd3 Mostly remove version negotiation
Summary:
Draft-19 onwards effectively punted version negotiation to QUICv2. Now receiving version negotiation on clients is treated as an immediate termination of the connection.

The transport parameter format has also changed to no longer include any reference to the QUIC version. To avoid us (Facebook) having to turn off QUIC traffic in production, our server needs to be able to parse these transport parameters from our older clients. To achieve this when parsing the transport parameters we will, as a temporary measure, check for the Facebook QUIC version to determine which transport parameter format we are parsing. Luckily for us the version we chose maps nicely to an implausible length for the transport parameters (0xface).

Note that this diff still has the client send the old transport parameter format, so that the rollout can be staged.

Reviewed By: yangchi

Differential Revision: D15203481

fbshipit-source-id: dfaaddc3acc76434461b04430b82a0902138c060
2019-05-10 12:55:28 -07:00
Junqi Wang
7aac9a78b4 Do not close socket immediately after write fails
Summary:
Becuase closeImpl will write again. Ideally in this case we should just
abandon the connection, but putting this bandage to prevent crash for now

Reviewed By: siyengar

Differential Revision: D15295421

fbshipit-source-id: d098e790c0c2609d817f5d1d3689858aa80a8b73
2019-05-10 10:37:44 -07:00
Junqi Wang
f458b4f69c Close socket after fatal error
Summary:
Close the socket when fatal error occurred. This prevents quic transport from receiving readCallback from a bad socket.
Also, close the happy eyeball socket when transport is shutdown.

Reviewed By: siyengar

Differential Revision: D15264105

fbshipit-source-id: e6c33f626cdef6a4ebc6820e39ac78da525133d0
2019-05-09 21:20:31 -07:00
Junqi Wang
f250d5e7ac Fatal error on one socket does not tear down connection
Summary:
Previously we decided to be conservative and error out the connetion
when either of the 2 sockets fails to write. This makes the happy eyeballs
component meaningless for e.g. IPv4 only network cases. This time we try to do it right.

The connection will keep track `shouldWrite` bool for both sockets. `shouldWriteToFirstSocket` is initialized to true and `shouldWriteToSecond` is initialized to false. Whenever **fatal** error occurs on a socket, the corresponding `shouldWrite` bool is changed to false. We are not finishing happy eyeballs state immediately but delaying this action to when we receive data back.

Reviewed By: siyengar

Differential Revision: D15261148

fbshipit-source-id: 3ee7de81a1d579e418be36bc2800d93d414abe3d
2019-05-09 21:20:30 -07:00
Yang Chi
325e702306 0xFF00 is legit private transport param ID
Summary: The check should be < not <=.

Reviewed By: mjoras, kvtsoy

Differential Revision: D15279146

fbshipit-source-id: adb4c315aab269d595caa186591eeb5e82e3223c
2019-05-09 10:01:30 -07:00
Alan Frindell
6603c4f452 Stop sending rst on rst
Summary: This is no longer part of the spec.  It's up to the application how to handle reset

Reviewed By: lnicco

Differential Revision: D15107164

fbshipit-source-id: 2a1fe0c552bd7f054e84ef86a01a78c379b0a483
2019-05-06 14:05:31 -07:00
Matt Joras
41fbfa84c5 Change idle_timeout transport parameter to milliseconds
Summary: This changed in to be in milliseconds d19 forward.

Reviewed By: yangchi

Differential Revision: D15183837

fbshipit-source-id: 561218321dcb51ec41093cafbdb967db2d4b3660
2019-05-02 15:50:27 -07:00
Aman Sharma
c04e0e08a2 Implementing stateless retry on the client
Summary:
This diff implements the handling of retry packets. As per the spec:
1. A client MUST accept and process at most one Retry packet for each connection attempt.  After the client has received and processed an Initial or Retry packet from the server, it MUST discard any subsequent Retry packets that it receives.
2. Clients MUST discard Retry packets that contain an Original Destination Connection ID field that does not match the Destination Connection ID from its Initial packet. This prevents an off-path attacker from injecting a Retry packet.
3. The client responds to a Retry packet with an Initial packet that includes the provided Retry Token to continue connection establishment.
4. A client sets the Destination Connection ID field of this Initial packet to the value from the Source Connection ID in the Retry packet.  Changing Destination Connection ID also results in a change to the keys used to protect the Initial packet.  It also sets the Token field to the token provided in the Retry.

Reviewed By: mjoras

Differential Revision: D14464508

fbshipit-source-id: 212539a588378fb0d795caaec150959680172781
2019-05-01 16:49:05 -07:00
Junqi Wang
2c701de030 Continue on network unreachable with timeout
Summary:
Previously we tried continue on network down and it showed good
improvement. But there was a problem: it hurts UX for airplane mode users, it
didn't return error back to user immediately but after 30/60 seconds timeout.
This adds a timer for this feature and it only allows the transport to ignore
network unreachable error for 200ms. After 200ms, it throws and reports to user
if the error persists.

Reviewed By: siyengar

Differential Revision: D15089442

fbshipit-source-id: dd87f4f579187c4b45244a7ee0477d2a0cf1b5d7
2019-04-26 10:08:35 -07:00
udippant
79032c7b9b fbshipit-source-id: f498ac5e677b2931d937ba78edd4373ba04dca2a 2019-04-25 21:33:43 -07:00
udippant
163ce02a6f Sync changes to rename onNewStream and CongestionController factory 2019-04-24 17:44:31 -07:00
udippant
50d4939e9e Initial commit of mvfst 2019-04-22 23:42:46 -07:00