Summary: This change is needed so that `conn.transportStats` is defined when a new congestion controller is created (so we can update cc_type counters).
Reviewed By: lnicco
Differential Revision: D27156542
fbshipit-source-id: 8dd7613c4ea1f0e70aefc4a135a8c7f1d102fee2
Summary:
If QUIC rate-limiting is configured, do the following:
1) Check if the packet has a retry token. If it doesn't, send a retry packet back to the client
2) If the packet has a retry token, then validate that the packet is valid by comparing the client IP stored in the retry token with the packet's client IP
Reviewed By: mjoras
Differential Revision: D25095743
fbshipit-source-id: 51b67bf3f942f77b7f73c21d23cdda0014792183
Summary: It's useful to be able to use the v4-mapped addresses sometimes.
Reviewed By: avasylev
Differential Revision: D24371807
fbshipit-source-id: 74fe13fa4bef9c77cc51a18137559facda9bdbeb
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
Summary:
We shouldn't send a VN on receiving a VN, as this can cause VN ping pong.
Also, we need to check earlier whether a packet meets the minimum Initial size.
Reviewed By: yangchi
Differential Revision: D24196884
fbshipit-source-id: 222f38b6f341702e7d2dbaa9030557cef6438ee6
Summary:
Adding setter for QuicServer to pass down connection ID version.
Also updating hostId setter to uint32 from uint16, I've udpated ServerConnectionIdParams to uint32 earlier, but not server setters.
Reviewed By: udippant
Differential Revision: D23917110
fbshipit-source-id: e3bef08c91b52fccc3ef4b2f3cc6aa67e24c089d
Summary:
Adds `quic::AcceptObserver`, an observer that is notified when a connection is accepted.
- Can be used by instrumentation that ties its lifetime to that of the transport; the observer can be used to initialize instrumentation and install additional observers on accept.
- `wangle::Acceptor` has a matching interface being added (D21652470), so instrumentation can follow the same paradigm for both QUIC and TCP.
- In the future, will extend to also be triggered when a transport becomes ready (e.g., TLS handshake complete), similar to what we have for `wangle::Acceptor`.
Reviewed By: mjoras
Differential Revision: D21656740
fbshipit-source-id: 46f30379551087e4f22b06d4493cf0263530639f
Summary: This diff creates a new `ServerCongestionControllerFactory` that will be used to create cc instances on the server only and thus can have different dependencies. At the moment this mirrors `DefaultCongestionControllerFactory`, but later in the stack when CCP is added, only the server cc factory will depend on (and be able to create) CCP instances, but the default one will not. This prevents any client builds from depending on CCP.
Reviewed By: yangchi
Differential Revision: D22139289
fbshipit-source-id: 2987f0234bc54ea6101ca0030b319b460571adeb
Summary: It is useful to know at what frequency we are receiving each version.
Reviewed By: yangchi
Differential Revision: D22071299
fbshipit-source-id: 1e6f909d2b3a65cf54decc35f7e2e321d0ff8f24
Summary:
(1) Only read out the token if the parsing host is a client and the
token matches client's token
(2) More fallbacks to Stateless reset when parsing short header packet. The
only exception would be when we don't have 1-rtt cipher.
Reviewed By: mjoras
Differential Revision: D21868631
fbshipit-source-id: 159edf7ab21061ddd5a5ef17f6b18209c3de24e7
Summary:
This introduces a rate limit to new connections created by a worker.
Right now it will simply send a VN, but eventually this will only issue a RETRY for unverified initials.
Reviewed By: udippant
Differential Revision: D21614905
fbshipit-source-id: 1832fbdad525c53fb1cb810aa9d7bae868c267d6
Summary: safety check, in case someone passes in a bad config
Reviewed By: mjoras
Differential Revision: D21383830
fbshipit-source-id: 60ab9e9e350855d6013c39590fb5c0d4a8e4f1ef
Summary:
Becuase when we clone an existing packet, the logic inside the current
writetStreamFrameHeader is no longer correct.
Reviewed By: mjoras
Differential Revision: D21383828
fbshipit-source-id: 8e6bbb048eefd97ca7cf17b89edc2f395f274a73
Summary:
Currently the packet builder contructor will encode the packet
builder. This is fine when the builder creates its own output buffer. If later
on we decides not to use this builder, or it fails to build packet, the buffer
will be thrown away. But once the builder uses a buffer provided by caller, and
will be reused, we can no longer just throw it away if we decide not to use
this builder. So we have to delay the header encoding until we know we will use
the builder.
This is still not enough to solve the case where we want to use this builder,
it builds, then it fails . For that, we will need to retreat the tail position
of the IOBuf.
Reviewed By: mjoras
Differential Revision: D21000658
fbshipit-source-id: 4d758b3e260463b17c870618ba68bd4b898a7d4c
Summary:
for initial or zero-rtt packets, or in the case of short-header packets, if the
worker-id already matches, we do not need to do any userspace routing of
packets.
Reviewed By: mjoras
Differential Revision: D21219335
fbshipit-source-id: 988614530960a621a02c0375f4a507b333f66e69
Summary: Unqualify nearly all uses of `folly::AsyncUDPSocket::ReadCallback::OnDataAvailableParams` since nearly all uses already have `OnDataAvailableParams` in scope.
Differential Revision: D20450063
fbshipit-source-id: c0fd49a7eace44a6edc8086762c44753224788dd
Summary:
The CID Algo can possibly generate a CID that's already in the map.
This diff adds a mechanism to reject such CID and try another one.
ServerStateMachine will loop encoding CIDs until either QuicServerWorker no
longer rejects, or encode fails
Reviewed By: udippant, vchynarov
Differential Revision: D20251043
fbshipit-source-id: a38e4e8b33007779a9710c32057d47f32f7d1774
Summary:
our convention has always been to put the mock in the test dir under
the real class
Reviewed By: lnicco
Differential Revision: D20104476
fbshipit-source-id: 5215ffc9af7a6d7a5ac41109723a71f68f852af7
Summary: 9 years and counting since c++11 is a thing.
Reviewed By: mjoras
Differential Revision: D20068892
fbshipit-source-id: e9d486d588481232de9dac5eb8e4f0b8dbf38bb6
Summary: When we don't use NiceMock we end up with a ton of spam in failing tests for every callback that we didn't EXPECT. This makes failed test output extremely noisy.
Reviewed By: sharmafb
Differential Revision: D19977113
fbshipit-source-id: 1a083fba13308cd3f2859da364c8106e349775bb
Summary: deref a folly::Expected can throw if it's an error
Reviewed By: mjoras
Differential Revision: D19977541
fbshipit-source-id: d8f841c1c685c91c4ebd7d3a2ceb4aa1110de06b
Summary: no more surprises in upper layer
Reviewed By: mjoras
Differential Revision: D19976510
fbshipit-source-id: 3487e9aa2cb28d7bc748f13bc2bbc393216b4a8a
Summary:
The current shedding APIs in the transport would accept a new
connection and then immediately close it. This will fail the request and waste server resources.
This diff
removes all the Shedding functions from transport and let upper layer handle
it.
Reviewed By: udippant
Differential Revision: D19729902
fbshipit-source-id: 6daab5902235b6daa8d059b51cc1229d1042f892
Summary:
New QUIC draft no longer has this limitation for connection-id, and allows
connid of len 0 -> 20.
This diff removes the constraints. I still kept the requirement for
*server-chosen* conn-id
Reviewed By: mjoras, lnicco
Differential Revision: D19507366
fbshipit-source-id: 4c73f45617f40b29d47d2d86b7598f6c95588d0a
Summary:
rejectNewConnections() runs asynchronously. As such, it is not guaranteed to complete before the next line where client writes packets. As a result,
server sometimes rejects the connection
Reviewed By: lnicco
Differential Revision: D19356730
fbshipit-source-id: 6e2e6571937737f30da1a1ffdcefdb759a0e9a73
Summary:
The async nature of the set up results in flakiness in unit tests.
For example, in QuicServerTest::TakeoverTest, clients send packets to server
right after setup, such as start / stop packetForwarding or pauseReads()
On the other hand, making them synchronous should be fine, since these are
called only during startup
Reviewed By: yangchi
Differential Revision: D19343423
fbshipit-source-id: 43cc169983d7f764b74c87f2188a9f8372007d84
Summary:
Currently, before server generate the destination CID, we route packets with client's address, port and client's source connection ID. But now that client can use 0-len source connection ID, the different connections from the same client address and port will be routed to the same server connections.
This diff changes it to use client's initial destination connection ID as part of the routing key.
Reviewed By: udippant
Differential Revision: D19268354
fbshipit-source-id: 837f5bd2f1e3a74957afacf7aabad922b1719219
Summary:
If we are on the evb, process the packet on the evb immediately.
Previously evb would schedule a runInLoop in another event loop.
This saves 1 event loop to be able to process a packet in the common
case.
Reviewed By: mjoras
Differential Revision: D18897493
fbshipit-source-id: 91c073ae0aef58e999f001e64f13612c3788869f
Summary:
In the current client code we read one packet, go back to epoll, and then read
another packet. This is not very efficient.
This changes it so that we can read multiple packets in one go from an epoll
callback.
This only performs changes on the client
Reviewed By: mjoras
Differential Revision: D18797962
fbshipit-source-id: 81be82111064ade4fe3a07b1d9d3d01e180f29f5
Summary:
This adds checks for forwarded data on all the possible branches that lead to
forwarding of packets to another process
Reviewed By: mjoras
Differential Revision: D18416971
fbshipit-source-id: 22dc3fd63de615904a411f90164a138bf0ef56e0
Summary:
Before any CID is available, the source address routing
table might be the only owner of the transport. Removing the transport from
there deletes the transport. connectionIdData param is a const ref to a member
of the connection state owned by the transport. So deleting transport also
deletes this vector, which makes the const ref invalidated.
Reviewed By: vchynarov
Differential Revision: D18253200
fbshipit-source-id: 728b15d0872164ba6549a32e10a5a3611e808f27
Summary:
Using the helper introduced in the previous diff, we replace generating the
initial server connection id, adding it to the selfConnectionIds, and
generating the initial stateless reset token.
Reviewed By: yangchi
Differential Revision: D18066595
fbshipit-source-id: f37450eecf0926ec145bc7a7194f2a1651cae024
Summary:
This diff is the one that introduces+passes the test of multiple server conn
ids routing to a single transport.
Currently, there is still only one time in non-test code that more than one
server connection id is added. This diff ensures when we call connectionUnbound
we remove all associated connection ids.
Reviewed By: udippant
Differential Revision: D17479563
fbshipit-source-id: 8d0ebbf26251f7bef44cdea53dfd4ff93ab465ae
Summary:
If the server connection is never generated, source address map may
have the only shared_ptr to the transport. Erase from the map then use the
transport is clearly a use-after-free bug.
Reviewed By: udippant, lnicco
Differential Revision: D17733297
fbshipit-source-id: 80d141293458920a0ba6c5eaed14dcbeec17d3ff
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
Summary:
mvfst will need to handle pmtu in an app specific way. So just set DF bits but
not pmtu.
Reviewed By: siyengar
Differential Revision: D17624134
fbshipit-source-id: 14f445bbb6a971efb8a3d550c84c3d4af53f8517