Commit Graph

3853 Commits

Author SHA1 Message Date
kota-yata 41f7d2ea8f docs: separate example code from document
separate certificate's examples out of md file into rs files

format
2025-03-30 11:59:02 +00:00
Filipe Cantarelli f8165c3394 refactor: move max_datagrams limit at poll_transmit from quinn-proto to quinn 2025-03-28 16:49:04 +00:00
Filipe Cantarelli cc7608a6be fix: Respect max_datagrams when tail-loss probes happen and initial mtu is large enough to batch
When a TLP is the first in the batch and initial mtu is large enough to allow for batching it still should
stay under the max_datagrams limit
2025-03-28 16:49:04 +00:00
Dirkjan Ochtman f7e321cba2 Avoid inference hazard for integer comparisons 2025-03-25 23:11:35 +00:00
Lars Eggert 83b48b5b87 feat: Allow changing the UDP send/receive buffer sizes
Also includes getters for the current sizes and a test.
Bump version to 0.5.11.
quinn-udp-0.5.11
2025-03-25 08:20:27 +00:00
Dirkjan Ochtman 1c27b02e3d Use Cargo.lock in CI jobs 2025-03-24 15:57:34 +00:00
Dirkjan Ochtman ecc5e7dc3b Version Cargo lockfile 2025-03-24 15:57:34 +00:00
Floris Bruynooghe 434c35861e fix: Do not produce tail-loss probes larger than segment size
When needing to send tail-loss probes and building a GSO batch the
tail-loss probe should not exceed the GSO segment size.
2025-03-19 04:11:07 +00:00
Floris Bruynooghe 55845bd7ef Prefer sending extra ping again
This reverts the change that tries to avoid sending a PING frame if
there are user datagrams to send.  The problem is that the user
dataram might not fit in the probe that will be sent.

It is possible to do this better, but the quick thing is to accept the
extra ping frame, the space wasted because of this is rather minimal.
And if a user was sending user datagrams at just the right MTU size it
is unlikely they would fit in the next packet anyway since typically
the probe packet will end up with a smaller size-limit compared to the
MTU.
2025-03-18 10:05:07 +00:00
Benjamin Saunders d8302dfaeb Remove obsolete advisory ignore rule quinn-0.11.7 quinn-proto-0.11.10 2025-03-08 08:44:13 +00:00
Benjamin Saunders a3f88b3a12 Ignore advisory for paste being unmaintained 2025-03-08 08:44:13 +00:00
Benjamin Saunders 490094b746 Ignore key discard timer when detecting activity in unit tests
This caused rare flakes in at least
single_ack_eliciting_packet_triggers_ack_after_delay by classifying a
the connection as active for longer than expected.
2025-03-08 08:44:13 +00:00
Benjamin Saunders 8b464de1b9 Account for queued application datagrams when composing TLPs 2025-03-08 08:44:13 +00:00
Benjamin Saunders a62c56c03c Don't queue a PING for a TLP if there's already an IMMEDIATE_ACK 2025-03-08 08:44:13 +00:00
Diva M 8d6e48c20b move sending path_challenge to its own function 2025-02-27 15:27:02 +00:00
Benjamin Saunders a7821ff3da proto: fix compatibility with older quinn 2025-02-23 21:27:04 +00:00
Benjamin Saunders 94309722fd Bump quinn-proto dependency edge
We depend on new APIs, e.g. for token logs.
2025-02-23 21:27:04 +00:00
Olivier Kannengieser 161274f417 Makes poll_read_buf public 2025-02-23 20:26:32 +00:00
Dirkjan Ochtman 56ae89444e Ignore that *ring* is unmaintained, for now 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman 04d8781964 Use ready!() from std 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman a8807131e4 Switch to 2024 style 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman 1ef5e02afd Apply suggestions from clippy 1.85 2025-02-23 11:52:46 +00:00
recatek 2ba600bf54 Eliminating an Instant::now() in BBR bandwidth estimation code
This was the only case where `Instant::now()` is used in quinn-proto or quinn-udp for anything other than tests or rate-limiting logging. Making this change to keep these two crates more IO-agnostic.
2025-02-19 09:12:14 +00:00
Max Leonard Inden f4bd4c21f4 chore(udp): increase crate patch version to v0.5.10 quinn-udp-0.5.10 2025-02-14 11:55:36 +00:00
Max Leonard Inden f582bc8036 fix(udp/fast-apple): ignore empty cmsghdr
On MacOS < 14, with `fast-apple-datapath` feature, calls to
`libc::CMSG_NXTHDR` might continuously return empty (i.e. all zero)
`libc::cmsghdr` instead of a null pointer. This results in a busy loop
in `decode_recv`:

``` rust
let cmsg_iter = unsafe { cmsg::Iter::new(hdr) };
for cmsg in cmsg_iter {
	match (cmsg.cmsg_level, cmsg.cmsg_type) {
```
https://github.com/quinn-rs/quinn/blob/b4378bb39dab4b58a1e6a3fea4fff9f87033dab6/quinn-udp/src/unix.rs#L685C1-L687C50

This commit fixes the above, returning a `null_mut()` pointer on an
empty `libc::cmsgdhr`, thus terminating the `cmsg_iter`.

See also https://github.com/mozilla/neqo/pull/2427 for details.
2025-02-14 11:55:36 +00:00
sakira b4378bb39d add test for retry token expired 2025-02-02 23:20:45 +09:00
Dirkjan Ochtman f4172ea3a2 Upgrade to rand 0.9 2025-01-30 23:29:12 +00:00
Dirkjan Ochtman 6f5023f66a Allow the NCSA license
This is newly required for libfuzzer-sys 0.4.9. It is a permissive
license similar to the MIT or 3-claused BSD licenses.
2025-01-30 20:28:21 +00:00
Philipp Krüger 13decb40b3 fix(quinn): impl tokio::io::AsyncWrite for SendStream 2025-01-28 07:59:12 +00:00
Phoenix Kahlo 69c00ebfdc test(proto): Fix wasm CI 2025-01-28 00:28:48 +00:00
Phoenix Kahlo bb54bc4a51 test(proto): Add tests for NEW_TOKEN frames
Also adds a `FakeTimeSource` utility to the test module.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo d2acbc3e94 test(proto): Create tests::token module
Moves the existing `stateless_retry` test into that module.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo ee29715215 test(proto): Enable NEW_TOKEN usage in tests
Configures the default clients and servers in proto tests to be able to
utilize NEW_TOKEN frames. This involves creating simple implementations
of token-related traits internal to the test module. These
implementations are essentially the most boring possible implementation
that is able to actually utilize tokens. They would not be suitable for
use in real applications because their memory usage is unbounded.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 5a572e067d test(proto): Refactor IncomingConnectionBehavior
When we first added tests::util::IncomingConnectionBehavior, we opted to
use an enum instead of a callback because it seemed cleaner. However,
the number of variants have grown, and adding integration tests for
validation tokens from NEW_TOKEN frames threatens to make this logic
even more complicated. Moreover, there is another advantage to callbacks
we have not been exploiting: a stateful FnMut can assert that incoming
connection handling within a test follows a certain expected sequence
of Incoming properties.

As such, this commit replaces TestEndpoint.incoming_connection_behavior
with a handle_incoming callback, and modifies an existing test to
exploit this functionality to test more things than it was previously.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo af2c1fa75d Allow client to use NEW_TOKEN frames
When a client receives a token from a NEW_TOKEN frame, it submits it to
a TokenStore object for storage. When an endpoint connects to a server,
it queries the TokenStore object for a token applicable to the server
name, and uses it if one is retrieved.

As of this commit, the only provided implementation of TokenStore is
NoneTokenStore, which is equivalent to the lack of a token store, and is
the default.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 195a781dde Allow server to use NEW_TOKEN frames
When a path becomes validated, the server may send the client NEW_TOKEN
frames. These may cause an Incoming to be validated.

- Adds TokenPayload::Validation variant
- Adds relevant configuration to ServerConfig
- Adds `TokenLog` object to server to mitigate token reuse

As of this commit, the only provided implementation of TokenLog is
NoneTokenLog, which is equivalent to the lack of a token log, and is the
default.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 78bfa5b509 proto: Convert TokenPayload into enum
As of this commit, it only has a single variant, which is Retry.
However, the next commit will add an additional variant. In addition
to pure refactors, a discriminant byte is used when encoding.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 9e1f77cf9f Create Incoming.may_retry API
The ability for the server to process tokens from NEW_TOKEN frames will
create the possibility of Incoming which are validated, but may still be
retried. This commit creates an API for that. This means that rather
than Incoming.remote_address_validated being tied to retry_src_cid, it
is tied to a new `validated: bool` of `IncomingToken`.

Currently, this field is initialized to true iff retry_src_cid is some.
However, subsequent commits will introduce the possibility for
divergence.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo b237cd766e proto: Change how tokens are encrypted
Previously, retry tokens were encrypted using the retry src cid as the
key derivation input. This has been described by a reputable individual
as "cheeky" (who, coincidentially, wrote that code in the first place).
More importantly, this presents obstacles to using NEW_TOKEN frames.

With this commit, tokens carry a random 128-bit value, which is used to
derive the key for encrypting the rest of the token.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 22c12708f0 proto: Split out RetryTokenPayload
Moves all the fields of Token to a new RetryTokenPayload struct, and
makes Token have a single `payload: RetryTokenPayload` field. This may
seem strange at first, but it sets up for the next commit, which adds
an additional field to Token.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo df22e2772e proto: Rename RetryToken -> Token 2025-01-26 18:40:40 +00:00
Phoenix Kahlo 273f7c2386 proto: Factor out NewToken frame struct 2025-01-26 18:40:40 +00:00
Dirkjan Ochtman 2125b36a14 Simplify weirdly broken test code 2025-01-22 04:35:09 +00:00
Phoenix Kahlo d5e63d8c28 ci: powerset --clean-per-run 2025-01-22 04:25:48 +00:00
Philipp Krüger c443147a2e Prefer sleep instead of sleep_until with Instant::now 2025-01-22 04:25:48 +00:00
Philipp Krüger d7146d3a86 Remove redundant step names 2025-01-22 04:25:48 +00:00
Philipp Krüger a5e9504952 feat(quinn,quinn-udp): Disable socket2 and std::net::UdpSocket dependencies in wasm/browser targets 2025-01-22 04:25:48 +00:00
Carl Dong cc1cf6ff96 Add comments w/re keeping features in sync 2025-01-18 20:56:41 +00:00
Carl Dong 7d87dc9f6a fix(.github/codecov): Ignore aws-lc-rs-fips for codecov 2025-01-18 20:56:41 +00:00
Dirkjan Ochtman 6bfd24861e tests: avoid ICE in beta 2025-01-10 21:09:02 +00:00