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

59 Commits

Author SHA1 Message Date
Viktor Chynarov
5cb4c461e7 Add method to rotate peer cid [1/x]
Summary:
Allows both client/server to update its peer connection id based on available ids.
This method returns false if there are no available ids.

Reviewed By: JunqiWang

Differential Revision: D18575129

fbshipit-source-id: 0e6969354ee9941d44f6533c003546955e11d098
2019-11-26 03:42:18 -08:00
Viktor Chynarov
fa022633a5 Store new connection id frame stateless reset tokens
Summary: ^

Reviewed By: JunqiWang

Differential Revision: D18620398

fbshipit-source-id: 26fee4e6d26df379a1f44b0704bc71311feea2f6
2019-11-21 09:19:37 -08:00
Viktor Chynarov
20807a350d Exchange active_connection_id_limit in transport parameters [2/2]
Summary:
Client will set their active_connection_id_limit to the server as 7 (so it will
have 8 conn ids in total).

Reviewed By: JunqiWang

Differential Revision: D18532441

fbshipit-source-id: b0be65cec9f7c483469b0b4a2810bc370a6945c3
2019-11-20 08:46:56 -08:00
Viktor Chynarov
3a6dfb73c3 Fix naming of self/peer active_connection_id_limit parameters [1/2]
Summary:
It was hard to understand which names refer to which limits.

This diff makes it simple:
* conn.transportSettings.selfActiveConnectionIdLimit
represents how many of its peer's connection ids it will hold. It sends this to
the peer as the active_connection_id_limit
* conn.peerActiveConnectionIdLimit represents the value the peer sends as its
active_connection_id_limit. This should be defaulted to 0 and only changed
when we receive the transport parameters

Reviewed By: udippant

Differential Revision: D18531733

fbshipit-source-id: 53709ccaa58f835fd654ac28cdd740be46e65289
2019-11-20 08:46:56 -08:00
Aman Sharma
69ac8aeb62 De-templatize stream state machine logic
Summary: The state machine logic is quite abstruse, this modifies it to make it more readable.

Reviewed By: siyengar

Differential Revision: D18488301

fbshipit-source-id: c6fd52973880931e34904713e8b147f56d0c4629
2019-11-19 20:18:11 -08:00
Viktor Chynarov
7504453972 Use Path Rate Limiter for conn migration
Summary:
Use the Path rate limiter introduced in the previous diff.

When we initialize path validation of an unvalidated peer address,
enable pathValidationRateLimit.

When we receive a proper PATH_RESPONSE frame, disable this limit.

If this limit is enabled, we will check the pathValidationLimiter for
the amount of bytes we are allowed to write.

Change the migration tests in QuicServerTransportTest to use this new limiter
instead of writableByteLimits.

Update shouldWriteData to directly use the new congestionControlWritableBytes
function.

Reviewed By: yangchi

Differential Revision: D18145774

fbshipit-source-id: 1fe4fd5be7486077c58b0d1285dfb03f6c62831c
2019-11-14 13:48:17 -08:00
Raghu Nallamothu
b62c11b841 T45316552 [quic][state] Initial Rtt measurement on Connection Migration
Summary: On Connection Migation use the time taken from pathchallenge frame to path response frame as initial rtt.

Reviewed By: JunqiWang

Differential Revision: D18388324

fbshipit-source-id: ede10484c240ca44a4eab544504461c052143bad
2019-11-11 12:17:12 -08:00
Junqi Wang
0fced3e95c No migration when 0-RTT packets come from different peer
Summary: 0-RTT packet is also in AppData pn space

Reviewed By: vchynarov

Differential Revision: D18353017

fbshipit-source-id: a39fe5aae823fbe0d7522f895cff05cc9395928b
2019-11-11 10:21:13 -08:00
Junqi Wang
52de3eb832 Reset mrtt on connection migration
Reviewed By: yangchi

Differential Revision: D18397845

fbshipit-source-id: ce1c7bcf4495b1a937892589c4c4131288f7d28f
2019-11-08 09:10:12 -08:00
Junqi Wang
a87bbc6fa8 Clear pending path challenge frame when migrating again
Summary:
When server has a pending path challenge frame to be sent, it's
possible that client can migrate again. This diff handles that case.

Reviewed By: vchynarov

Differential Revision: D18351213

fbshipit-source-id: c6887db0274ccddf267eb227de0a7de7ee103b4c
2019-11-06 10:51:56 -08:00
Viktor Chynarov
f2e09a4ab8 Server to issue up to 7 more conn ids on handshake finish [3/x]
Summary:
Use the helper function from earlier to create new connection id with sequence
number, and stateless reset token.

Add each of those new connection ids to the routing callback. Add a CHECK()
for routingCallback, because it should be set.

Add a new parametrized set of tests, to test the value of the
active_connection_id_limit transport parameter sent from client.

Reviewed By: yangchi

Differential Revision: D15178642

fbshipit-source-id: 37b4879b09a47d371100c7ac0ab4f01130245715
2019-10-28 17:46:59 -07:00
Yang Chi
9247b8f49b Change Quic qlogger vantage point to enum
Summary: To prevent adhoc string passed in

Reviewed By: sharma95

Differential Revision: D18013615

fbshipit-source-id: 6f5512468755c2b1ecbba3ba42188fa22f4e94b9
2019-10-23 10:16:58 -07:00
Raghu Nallamothu
e06c0848e0 T24905463 - [quic][ping] Implement ping in Quic
Summary: Implement ping functionality in ping

Reviewed By: yangchi

Differential Revision: D17885286

fbshipit-source-id: 4c328d14a023057d6889818250c0129c06e60874
2019-10-21 17:07:12 -07:00
Viktor Chynarov
ac053567e3 NewConnectionId frame handling
Summary:
Mainly based on Junqi's changes in D15230415

Added the start of several error checking. Section 19.15
of d-23
(https://tools.ietf.org/html/draft-ietf-quic-transport-23#section-19.15)
specifies 2 cases where PROTOCOL_VIOLATION should be thrown during processing:
* retire_prior_to is larger than sequence number
* new_connection_id is sent by peer using 0-len conn id (will handle later)

I don't think it was specified what happens if we get a NEW_CONN_ID frame
after the the endpoint already has enough of the peer's conn ids - just ignore
the frame.

Reviewed By: sharma95

Differential Revision: D17578167

fbshipit-source-id: 6e410b6110970a6e52970576ac3ff2b1c7d5c06a
2019-10-11 14:56:29 -07:00
Viktor Chynarov
0ba3b6517b Ensure server/client conn ids are synced to self/peer connIdData
Summary:
Everytime a client/server sets a client/server conn id, it adds it to the
respective self/peer connection id data collections.

Reviewed By: sharma95

Differential Revision: D17577333

fbshipit-source-id: de8b887c1f3acb142c070727fb98ca0841337369
2019-10-11 14:56:29 -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
Carmi Grushko
a8e76fc3ea Ping frames are retransmittable
Summary:
This will treat incoming ping frames as retransmittable frames and
update ack state accordingly.

Reviewed By: lhuang04, yangchi

Differential Revision: D17841073

fbshipit-source-id: be19ec9a9dae7f0c2d416fab5deac7487861c4e2
2019-10-09 14:59:13 -07:00
Carmi Grushko
3fc265f115 Sync quic/server
Reviewed By: lhuang04

Differential Revision: D17837374

fbshipit-source-id: 0bf3347a0dfd056b8c36973d900efbfef5e86872
2019-10-09 13:38:25 -07:00
Yang Chi
2d24a250f7 Ping frames are retransmittable
Summary:
This will treat incoming ping frames as retransmittable frames and
update ack state accordingly.

Reviewed By: siyengar

Differential Revision: D17832707

fbshipit-source-id: 69e4a95a62bf86a707bac94399588df61c947bd3
2019-10-09 13:12:12 -07:00
Amaury Séchet
a0ebc3995b Fusion QuicFizzFactory into FizzCryptoFactory (#44)
Summary:
They are strongly coupled, which indicate this is probably better to do it as one class.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/44

Reviewed By: mjoras

Differential Revision: D17590918

Pulled By: yangchi

fbshipit-source-id: 2eaca079fd760107eefd2b74fa612d7a0c8b3001
2019-10-08 22:17:02 -07:00
Subodh Iyengar
cbbc6b0c77 Custom variant for simple frames
Summary: Use a custom variant for simple frames

Reviewed By: mjoras

Differential Revision: D17781068

fbshipit-source-id: e059d33df4651c7e0a1c989cc8651c9cd661b14b
2019-10-07 22:43:32 -07:00
Subodh Iyengar
68c332acb1 Use custom variant type for write frames
Summary:
Use the custom variant type for write frames as well, now that
we use them for read frames.

Reviewed By: mjoras

Differential Revision: D17776862

fbshipit-source-id: 47093146d0f1565c22e5393ed012c70e2e23d279
2019-10-07 22:43:31 -07:00
Yang Chi
6d00ae544d Temp enum fix in variant macro to unshadow QuicSimpleFrame type alias
Summary:
It looks like under some compiler flags, type alias follows a very
different rule of name shadowing. This diff adds a trailing "_E" to generated
enum names to unbreak builds. I will send another diff to make it less ugly
later. And eventually the QuicSimpleFrame won't be a type alias once it's no
longer a boost_variant.

Reviewed By: siyengar

Differential Revision: D17766330

fbshipit-source-id: 7b3c5847fd2c1eae10757bfbf9558a38f3085f10
2019-10-04 12:57:54 -07:00
Subodh Iyengar
95f509ae54 custom variant type for read frames
Summary:
Create a custom type for read frame types. This allows us to reduce size of code.
We use a macro to generate new variant types whenever we need to.

Reviewed By: yangchi

Differential Revision: D17266468

fbshipit-source-id: 59a1183dce728e71f0924f39f95a7b78449642b0
2019-10-03 18:17:39 -07:00
Viktor Chynarov
56c18e96ef Back out "Revert D17636918: [quic] Create findFrameInPacketFunc helper function for unit tests"
Summary: Original commit changeset: dcc2b618c2a7

Reviewed By: lnicco

Differential Revision: D17688819

fbshipit-source-id: 9dd3dbcfd78549f5858a41b67db7fc4bc0647469
2019-10-01 11:11:06 -07:00
Shawn Shihang Wei
3ca024e3b8 Revert D17636918: [quic] Create findFrameInPacketFunc helper function for unit tests
Differential Revision:
D17636918

Original commit changeset: 927b3a880ee0

fbshipit-source-id: dcc2b618c2a7accde254d01b5d549a08041dd589
2019-09-30 18:49:58 -07:00
Viktor Chynarov
5199ae5b8d Create findFrameInPacketFunc helper function for unit tests
Summary: Removes a lot of unnecessary code in UT.

Reviewed By: sharma95

Differential Revision: D17636918

fbshipit-source-id: 927b3a880ee0db23b18c81875254fd8b86317bd3
2019-09-30 17:40:14 -07:00
Subodh Iyengar
322eb2ebc4 remove codecresult variant
Summary: remove the variant for codec result and replace it with a custom variant type

Reviewed By: yangchi

Differential Revision: D17247099

fbshipit-source-id: 19e24c14732eb6e8496aee7064f20c48bdf254e0
2019-09-30 17:02:24 -07:00
Viktor Chynarov
2bd01800f3 Use set of transports instead of connIdMap for server shutdown [2/x]
Summary:
Currently, there is a 1:1 relationship between conn Id and transports. So for
all connections with a bound connection id, we iterate over all
connectionIdMap_ entries and delete the associate transport.

This won't work if connectionIdMap_ will map multiple conn ids to a single
transport.

Reviewed By: JunqiWang

Differential Revision: D17456965

fbshipit-source-id: 8923540abf205cfd10ad09d637e8c05790b4acf9
2019-09-27 07:57:44 -07:00
Subodh Iyengar
6f6ed4d56e remove variant type for QuicPacket
Summary:
Remove the variant type for RegularQuicPacket and VersionNegotiationPacket.

This allows us to move version negotiation parsing to be only used on the client and only done explicitly
before a version is negotiated.

Reviewed By: yangchi

Differential Revision: D17242788

fbshipit-source-id: 502caf6849f0b7e6778f1470dc160d01f17a33af
2019-09-19 17:31:47 -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
049b512646 Write stream frame header and data separately.
Summary:
Prior to this diff we would clone out an entire flow control's worth of data from the writebuffer and then clone out a smaller portion of that to write into the packet builder. This is extremely wasteful when we have a large flow control window.

Additionally we would always write the stream data length field even when we are going to fill the remainder of the packet with the current stream frame. By first calculating the amount of data that needs to can be written and writing the header, we can now omit the data length field when we can fill the whole packet.

Reviewed By: yangchi

Differential Revision: D15769514

fbshipit-source-id: 95ac74eebcde87dd06de54405d7f69c42362e29c
2019-08-22 15:59:41 -07:00
Viktor Chynarov
b9bbc0d858 Remove clientConnId from ServerConnIdParams
Summary:
This parameter duplicates the one in the QuicConnectionStateBase.

It is set everywhere the canonical one is, and it isn't used directly in any
manner that is separate from QuicConnectionStateBase::clientConnId.

This diff changes the following:

 * removed clientConnId from ServerConnIdParams
 * add setter to directly initialize clientConnId on the transport from the
   connection
 * update tests

Reviewed By: udippant

Differential Revision: D16711180

fbshipit-source-id: 63e667aa0df8a79757f18fb3ffc178c7c9613e1a
2019-08-19 15:04:14 -07:00
Amaury Séchet
cbd77a3603 Extend CryptoFactory with makePacketNumberCipher (#40)
Summary:
The CryptoFactory is extended with makePacketNumberCipher . In order to support that feature, FizzCryptoFactory now explicitly takes a QuicFizzFactory as argument instead of a generic fizz::Factory, which is the only type that is used in practice anyways.

The cypher argument was removed because:
1/ Only one cypher is used at all. Fizz also supports ChaCha20, but using it in mvfst will throw an exception.
2/ it seems like the factory should know what cypher it is dealing with.

If a choice of cypher needs to be supported going forward, it can be done by adding state to FizzCryptoFactory.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/40

Reviewed By: mjoras

Differential Revision: D16785274

Pulled By: yangchi

fbshipit-source-id: a1c490e34c5ddd107e8e068d8b127c1ed00a59ec
2019-08-16 08:52:43 -07:00
Amaury Séchet
354506308f Update ServerHandshake to use a quic::Aead instead of fizz:Aead as soon as possible. (#35)
Summary:
Wrap the fizz::Aead as soon as fizz and it over to mvfst and use a quic::Aead everywhere else in ServerHandshake.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/35

Reviewed By: yangchi

Differential Revision: D16710820

Pulled By: mjoras

fbshipit-source-id: d6e3bee9f5baa0ebf6b3ef580de9e4614de8c4e5
2019-08-15 09:41:27 -07:00
Bonnie Xu
db349541f2 Update qlog format to be more complete
Summary: Update qlog format to be more complete. Adding the summary section (with extra fields like title, description, etc). This diff is just to make the format more on par with Robin's schema.

Reviewed By: mjoras

Differential Revision: D16499808

fbshipit-source-id: 56cfbb95404f7e3c6638bffda18b53f7d83048a1
2019-07-30 12:48:57 -07:00
Amaury Séchet
4f6fb57557 Add CryptoFactory to abtract Fizz specific crypto operations (#30)
Summary:
This introduce the CryptoFactory abstraction that compute keys and AEAD to be used by most of mvfst.

The fizz specific parts are abstracted into a subclass, FizzCryptoFactory, and accessed using virtual methods.

Next step is to introduce QuicFizzFactory 's features into this abstraction.
Pull Request resolved: https://github.com/facebookincubator/mvfst/pull/30

Reviewed By: JunqiWang

Differential Revision: D16459633

Pulled By: yangchi

fbshipit-source-id: 7fe2d3037ac604bfd5b002e6d25c1763e91e9472
2019-07-29 15:02:05 -07:00
Bonnie Xu
90b83d7370 Add packetBuffered event
Summary: Add packetBuffered event to qlog.

Reviewed By: yangchi

Differential Revision: D16415646

fbshipit-source-id: dda053e55b5b029278993ccc89330e2bc2d9ebb9
2019-07-25 11:52:21 -07:00
Bonnie Xu
0929100b18 Add transportStateUpdate event
Summary: Add transportStateUpdate event so it can be part of qlog.

Reviewed By: mjoras

Differential Revision: D16342467

fbshipit-source-id: 109189275d44996850b82646bab4a733a3a4c7a1
2019-07-25 11:52:19 -07:00
Junqi Wang
5fc6ddec84 Use new API to read app params for NewSessionTicket
Summary: Use the new static API

Reviewed By: lnicco

Differential Revision: D16226829

fbshipit-source-id: 11f79ea2a2866bfbd85f2f1e344c80ca65120dd8
2019-07-19 08:54:38 -07:00
Matt Joras
ece3cbe387 Draft-22 varint error codes
Summary: These were changed to varints. To support this we need to do some extra horrible version plumbing. I don't want to keep this long term but it works for now.

Reviewed By: yangchi

Differential Revision: D16293568

fbshipit-source-id: a9ea9083be160aa3e6b338a7d70d7f00e44ec5ab
2019-07-18 12:07:57 -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
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
Bonnie Xu
f20f8d15a1 Added fields dcid and scid to QLogger
Summary:
Added fields dcid and scid to QLogger

This will be used in the following diff, which needs the ids to uniquely identify the output file.

Reviewed By: sharma95

Differential Revision: D15909180

fbshipit-source-id: d8db794d74cbbc85ead6afb7d5cd5179c70b646d
2019-06-25 23:37:43 -07:00
Yang Chi
42b2617e44 Handle lossTime before crypto timer in Quic
Summary:
Currently we handle crypto timer before loss timer. And currently loss
time is for AppData only since for the other two Packet Number spaces, crypto
timer will take care of it. This diff extends loss times to 3 loss times, and
handle them before handle crypto timer. The rational here is that loss time is
shorter than crypto timer, so this will make retransmission during crypto
handshake more aggressive. For app data, this diff doesn't change anything.

Reviewed By: sharma95

Differential Revision: D15552405

fbshipit-source-id: bd5c24b0622c72325ffdea36d0802d4939bae854
2019-06-17 18:07:28 -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
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
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