Commit Graph

4778 Commits

Author SHA1 Message Date
Ruediger Klaehn dc613f2e79 Remove recv_datagrams from platform layer 2026-01-29 20:29:58 +02:00
Ruediger Klaehn 97530f37ef Don't use BytesMut in the public API of quinn-udp
Also get rid of max_payload_size
2026-01-29 20:23:46 +02:00
Ruediger Klaehn 21d530dbd0 Experiment: simplify the read side interface 2026-01-29 20:01:56 +02:00
Asmir Avdicevic 25f35c2fe3 chore: disable solaris tests in daily CI as they hang (#377) 2026-01-29 11:14:49 +00:00
“ramfox” e41672537d chore: Release iroh-quinn-v0.16.0 2026-01-28 11:10:17 -05:00
“ramfox” 349e82913a chore: Release iroh-quinn-proto-v0.15.0 2026-01-28 11:09:42 -05:00
“ramfox” 086cf769b3 chore: Release 2026-01-28 11:01:36 -05:00
Floris Bruynooghe d7e98af8cf fix: do not send CONNECTION_CLOSE to unvalidated remotes (#361)
* docs: Try and document closing states and behaviour a bit more

Hopefully this is somewhat correct and helps me next time I have to
understand something involving this all.

* Apply suggestion from @divagant-martian

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>

* improve comments

* Improve description and fix anti-amplification bug

* format

* upwrap_or_false

---------

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
2026-01-27 11:44:43 +00:00
Floris Bruynooghe aa6c3735ce fix: Do not send off-path data when closing (#358)
* fix: Do not send off-path data when closing

When we are closing we're only supposed to send packets containing
CONNECTION_CLOSE and (PATH_)ACK frames. There is no need to continue
sending any off-path data.

* maybe fix

* revert that. it was wrong

* Apply suggestion from @matheus23

Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>

---------

Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
2026-01-26 16:09:47 +00:00
Philipp Krüger c38be740eb refactor(proto): Extract address canonicalization and local socket family detection into fns (#346)
* fix(proto): Don't close paths from previous HP round we're still interested in

* Use local/remote instead of src/dst in 4-tuple logs

* Don't clear all path timers in `close_path`.

* Also check for `!self.abandoned_paths.contains(&path_id)`

* refactor(proto): Canonicalize IP addrs early for HP state

* Spellcheck

* Revert canonicalization to the right places again.

We don't want to canonicalize when adding local addresses, since there might be NAT46 between us and the peer.
We also don't want to canonicalize right when we receive ADD_ADDRESS frames, since that has an effect on maximum number of addresses calculations.

* Preserve address mapping invariant in `iroh_hp::NatTraversalRound`

* Update doc comments

* Map ipv6-mapped IPv4 addresses to IPv4 if possible/necessary

* Don't convert `::1` to `127.0.0.1` in `map_to_local_socket_family`

Also: add a test case

* Prefer `Ipv4Addr::to_ipv4_mapped`
2026-01-26 15:40:10 +00:00
Floris Bruynooghe 2cc515adbc refactor: split poll_transmit into per-path and per-space parts (#338)
* split up poll_transmit per path and per space

* refactor: return last_packet_number

* cleanup status enums

* refactor: streamline mtu probe building

* refactor: extract remote cid exhaustion handling into function

* refactor: move remote_cid check per path

* refactor: simplify send space check

* fixup

* docs(proto): describe enums

* wip

* friday was too short. make it work, maybe

* Do coalescing right

* tweak comments, logs

* remove redundant size-setting

* fix path scheduling description, add bug description

* fixup path stats

* wording, wording

* weird off path enum variants are no longer needed!

* fix fmt

* Make TransmitBuf in each loop and collate off-path work

This make the construction of the TransmitBuf a little less weird, but
still a bit weird.

* Consistent naming for now

* missing rename

* fix merge

* Pass around a Vec while no transmit has been started yet

* expand on what is meant here, link to new issue

* pointless return

---------

Co-authored-by: dignifiedquire <me@dignifiedquire.com>
Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
Co-authored-by: Diva Martínez <git@divma.net>
2026-01-26 15:31:59 +00:00
Floris Bruynooghe ab03f16038 fix: Expect missing CIDs when migrating (#362)
With multipath there is no guarantee that CIDs exist. Since this
previous PathData is currently only used to send a single
fire-and-forget PATH_CHALLENGE there is no value to store it as the
previous path, since it would not be able to be sent. And this path
would still have to be path-validated from scratch if it is the valid
one.

Additionally fix a bug that only stored this path if the previous path
was *currently* validating. This was a bug introduced due to
refactors. The intention is to store the path only if it was
path-validated. Not to store it only if it was currently not being
validated.

Fixes #310
2026-01-26 10:46:32 +00:00
Franz Heinzmann cd7a9d8443 fix: emit PathNewConnectionId frame in qlog (#363) 2026-01-26 09:39:25 +00:00
ramfox bf4c64874d chore: add CI to ensure docs-rs publishing will work (#360)
Also, removes "log" from list of features for `iroh-quinn-proto` to run with `docs-rs`, since it is not a feature `iroh-quinn-proto` has

Co-authored-by: “ramfox” <“kasey@n0.computer”>
2026-01-23 09:53:21 +00:00
Floris Bruynooghe e424c7fb78 tests: Skip proptests in the default runs (#356)
We run with --profile ci on CI, so this still runs the proptests on CI
every time. Also includes clear instructions on how to run the
proptests.
2026-01-22 13:16:19 +00:00
Philipp Krüger 1a2bd1186b fix(proto): Stop all path timers when closing it (#350)
* fix(proto): Stop all path timers when closing it

* Mute clippy warning

* Update quinn-proto/src/tests/multipath.rs

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>

* Update quinn-proto/src/tests/multipath.rs

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>

---------

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
2026-01-21 20:47:42 +00:00
Floris Bruynooghe 11b684ded3 refactor: Log which path is lacking CIDs (#355)
Missed review suggestion from #336.
2026-01-21 19:08:35 +00:00
Floris Bruynooghe e6c004e144 refactor: Some much needed renaming of variables mostly (#354)
And collecting some functions together. Split off from #338.

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
2026-01-21 16:24:37 +00:00
Floris Bruynooghe 37524202b6 fix(multipath): handle missing remote CIDs better (#336)
* fix(multipath): handle missing remote CIDs better

QUIC-MULTIPATH § 4.7 says that sending PATH_CIDS_BLOCKED is to be done
when opening the path. For locally opened paths we were already doing
this but for remotely opened paths we did not yet do that.

Instead it was deferred to poll_transmit to send this, but that is
troublesome:

- Primarily it means that when checking paths suddenly more data is
  available to be sent and should have been sent on an earlier
  path. Making the logic of poll_transmit very difficult.

- It meant precaution should be taken against sending this too much,
  which wasn't being done.

So instead we schedule PATH_CIDS_BLOCKED when the paths are actually
being opened. Simplifying things significantly.

* needless map

Though the compiler should have optimised that away

* actually read the review text

* remove path_challenge comment

* explicit false

* Apply suggestions from code review

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>

* Do not log when an abandoned path has retired CIDs

That's the normal situation, it can get fairly verbose, and you should
be able to deduce this from other logs.

* fix broken merge

---------

Co-authored-by: Diva Martínez <26765164+divagant-martian@users.noreply.github.com>
2026-01-21 16:01:15 +00:00
Philipp Krüger 7706e5a4e1 refactor: Rename rem_cid to remote_cid and friends (#351)
* refactor: Rename `rem_cid` to `remote_cid` and friends

* `cargo make format`
2026-01-20 16:37:57 +00:00
Rüdiger Klaehn 9f4c68ed17 tests: Complete encoder proptests (#340)
* Implement encode-decode tests for ack

And some DRY

* Add path_ack as well

* Get rid of TestFrame

* clippy

* fmt

* Remove more explicit strategies

* Use StreamMeta for encoding stream frames instead of duplicating the logic

* Make the arb for RangeSet also create the empty set

Also exchange unwrap to expect in the arbs that use it

* PR feedback

- Derive arbs unless they are really complex
- Test remaining is empty in encode/decode proptest
2026-01-20 13:43:58 +00:00
Diva Martínez 332c8f7d7a return all paths that belong to the round (#345) 2026-01-20 12:48:44 +00:00
Philipp Krüger ce4f347032 fix(proto): Don't close paths from previous HP round we're still interested in (#341)
* fix(proto): Don't close paths from previous HP round we're still interested in

* Use local/remote instead of src/dst in 4-tuple logs

* Don't clear all path timers in `close_path`.

* Also check for `!self.abandoned_paths.contains(&path_id)`
2026-01-20 10:27:11 +00:00
Diva Martínez a772fbe095 fix(quinn-proto): do not reuse buffers across network paths (#339)
* obsolete set_segment_size

* send off path path responses at the same time as validation challenges

* simplify poll transmit code

* clippy
2026-01-19 14:11:20 +00:00
Floris Bruynooghe 7a8aeb9609 fix: Use better terms in logging (#343)
Follow up from #331.
2026-01-19 14:03:54 +00:00
Rüdiger Klaehn 1df76577f7 tests: Add proptest arbitraries for various quinn-proto types and implement encoder roundtrip tests. (#325)
* Add proptests for encode/decode

* Add proptest arbitrary for VarInt and StreamId

Also fix the StreamId arbitrary::Arbitrary generation

* Add proptest arbitraries for various quinn-proto types and make use of them in the random interaction test

* Add more arbitraries.

* Remove unneeded derives

* Use MaybeFrame arb

* fmt

* Use cfg(test) for the arbitraries.

Also move the encode_decode tests into a separate file.

* Add more cases to TestFrame

* Get rid of the last remaining record enum cases.

* More arbitraries. Now almost every frame type is roundrrip tested.

* remove dead code

* clippy

* Add proptest and test-strategy even in wasm

(we don't *run* proptests, but need them to compile)

* Use a feature flag after all...

going in circles...

* Remove claude settings and DRY the proptest attribute.

* Revert "Use a feature flag after all..."

This reverts commit b27add632b.

* Try to get proptest to work in wasm after all

It doesn't need to run tests, just compile.

* Use the right hmac import

* sort dev deps

* Remove some feature flag gated imports

they are not worth it in terms of DRY

* Use test_strategy::Arbitrary by default in frame. It gets used way more often.
2026-01-19 09:35:31 +00:00
Friedel Ziegelmayer 19274cf4d5 fix(proto): properly encode can_coalesce during packet building (#334) 2026-01-16 12:59:34 +00:00
Philipp Krüger be298f39ad feat(proto): Use UdpStats in PathStats and add receive stats (#332) 2026-01-16 10:57:33 +00:00
Friedel Ziegelmayer 22169a5a02 refactor(proto): cleanup Connection::space_can_send (#333)
* refactor(proto): cleanup Connection:::space_can_send

* typing is hard
2026-01-16 10:25:32 +00:00
Floris Bruynooghe 6177c8d05c fix(proto): Some frames were sent on non-validated path (#330)
* refactor: Update to rust edition 2025

* bump to 1.88

That's what I need for let chains.

* i asked for let chain, clippy looooooves the let chains!

* more let chains in the workspace

* fix(proto): Some frames were sent on non-validated path

We were accidentally sending frames on non-validated paths. And also
on PATH_STATUS_BACKUP paths.

With the current way this is controlled when path_exclusive_only is
set we should not be sending frames that can be sent on other
paths. Respecting this for more frame types will make sure they are
not sent on non-validated and backup paths.

Fixes #314.
2026-01-15 16:00:33 +00:00
Floris Bruynooghe 5f19d75275 refactor: Update to rust edition 2024 (#328)
* refactor: Update to rust edition 2025

* bump to 1.88

That's what I need for let chains.

* i asked for let chain, clippy looooooves the let chains!

* more let chains in the workspace
2026-01-15 15:41:35 +00:00
Floris Bruynooghe bd88e2d0dc refactor: some logging consistency (#331)
Random personal stuff I tweak when reading logfiles.
2026-01-15 15:32:06 +00:00
Diva Martínez ddbdf535a8 refactor(quinn-proto): misc code improvements from pr reviews (#327)
* address review

* make docs less weird
2026-01-14 20:51:02 +00:00
Philipp Krüger 4de9876c53 fix(proto): Check abandoned_paths in open_path_ensure (#319)
* fix(proto): Check `abandoned_paths` in `open_path_ensure`.

* code review

* Add tests for `open_path_ensure`

* Apply clippy fixes

---------

Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
2026-01-14 15:50:49 +00:00
Philipp Krüger ee980072e0 fix(proto): Use path PTOs for PATH_ABANDON calculations (#291)
* fix(proto): Use most relevant PTOs for PATH_ABANDON calculations

Instead of always using max PTO.

* refactor: Use a nice enum

* fix merge

* cw: Use proper `TransportError`s, improve comments

* cw: Clear up confusing comment
2026-01-14 15:40:42 +00:00
Asmir Avdicevic afc9ed49d2 chore: revert sccache removal (#326) 2026-01-14 15:01:06 +00:00
Friedel Ziegelmayer b5deb223d6 refactor(proto): store ArrayRangeSet in Acks (#320)
Before they were decoded lazily, but that work as done many times over and over again, when they where ever logged in debug mode. This decodes these immediately and stores them in an `ArrayRangeSet`

Also moves the debug impl to the `ArrayRangeSet` making that print more easily
2026-01-14 14:58:06 +00:00
Diva Martínez 7663451642 refactor(quinn-proto): move frame sending tasks to PacketBuilder (#295)
* fix getting frame types

* make stat recording readable

* create the base to what we want to achieve

* add path_ack to Builder::encode

* add Ack and Close

* fix finish and finish and track

* add path response

* add HandshakeDone and ReahOut

* add ObservedAddr

* add Ping and ImmediateAck

* add more frames

* add moreeee frames

* sip

* wip

* wip

* wip

* wip

* restore qlog to work on a reduced diff

* compiles

* wip

* Fix PacketBuilder::simple_data_buf usage

- do not request 100 bytes padding by default
- do not reseve space for the AEAD tag
- when using this make sure the datagram is started and has the
  correct size

* cleanup

* spelling

* make diff more obvious

* reduce LOC

* apparently these lifetimes can be elided?

* 1 LOC less

* more cleanup

* reverse change

* reduce LOCs

* Encode impl no longer needed

* remove comment

* clippy

* remove unnecesary lifetimes

* remove nice but deprecated code :(

* remove files that shouldn't be there

* leverage enum_assoc

* rename `PacketBuilder`'s `encode` to `write_frame`

* add display impls for frames

* restrict function visibility

* expand restricted vis

* shutup clippy

---------

Co-authored-by: Floris Bruynooghe <flub@n0.computer>
Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
2026-01-14 12:22:59 +00:00
Asmir Avdicevic 39f776db5b chore: unblock CI (#321) 2026-01-14 10:57:50 +00:00
Floris Bruynooghe daaa4e84f8 docs(proto): improve path generations internal docs (#311)
* docs(proto): improve path generations internal docs

* Try and improve wording

* more rewording
2026-01-13 14:06:01 +00:00
Floris Bruynooghe 4b6ac1c7da fix(proto): Store pending PATH_CID_BLOCKED frames in a BTreeSet (#307)
When adding items to this we generally don't want to worry about
checking if the value is already pending. Currently we keep adding to
the Vec with the same value in some situations, resulting in sending
the frame many times for the same path.

This avoids duplicate entries.
2026-01-13 09:23:55 +00:00
Rüdiger Klaehn feeafe40c9 Disable fuzz code unless fuzzing config is set (#309)
With this we no longer get compile errors in vscode because the fuzzing
code uses fns that are themselves gated with cfg(fuzzing).

We have to tell rust about the feature in Cargo.toml to avoid warnings.
2026-01-13 09:20:49 +00:00
Friedel Ziegelmayer 2ae68e6dd1 feat(proto)!: update to final IANA numbers for multipath (#302)
Ref https://github.com/quicwg/multipath/pull/630
2026-01-12 18:49:49 +00:00
Friedel Ziegelmayer 0c3de90490 chore: merge upstream until b53828f0e4 (#303)
Merges commits from upstream quinn up to
`b53828f0e48752f771c2538364c8876a907a0345`

These where cherry-picked manually, and I skipped dependabot commits,
and
https://github.com/quinn-rs/quinn/commit/c6d3b7545e4def35d2295f9f1bc81ebb8fc34983
2026-01-12 18:26:55 +00:00
Benjamin Saunders 4cff3e3dac Remove deprecated functions 2026-01-12 16:46:28 +01:00
Benjamin Saunders a1a927d1f2 Remove deprecated RNG seed argument from Endpoint::new 2026-01-12 16:46:28 +01:00
Benjamin Saunders 9aa5a6e727 Move default client config into shared endpoint state
This was the only mutable handle state, and hence stood out as a
surprising special case.
2026-01-12 16:46:28 +01:00
Sebastian Leisinger b8c2bdad4d Fix dropping oversized unblocks datagram senders
When dropping oversized datagrams after an MTU change, notify
callers of `send_datagram_wait` that are waiting for
space in the send buffer.

Tracking issue: https://github.com/quinn-rs/quinn/issues/2456
2026-01-12 16:46:28 +01:00
Thomas Eizinger d1bbfc044f fix(windows): use effective_segment_size
Similar to older Linux kernels, Windows doesn't appear to like being
told to do GSO if it is not necessary.
2026-01-12 16:46:28 +01:00
Thomas Eizinger 9008656e7f refactor: introduce Transmit::effective_segment_size 2026-01-12 16:46:28 +01:00