Commit Graph

4525 Commits

Author SHA1 Message Date
Ruediger Klaehn b842953116 Merge branch 'main-iroh' into fix-send-buffer 2025-12-12 13:26:50 +02:00
Ruediger Klaehn c5e9f39ae0 info logging in test 2025-12-12 13:25:08 +02:00
Ruediger Klaehn 550e6104cd fmt 2025-12-12 12:43:54 +02:00
Rüdiger Klaehn 38a7d1558f Use array range set everywhere (#212)
* Use ArrayRangeSet in SendBuffer

* Implement replace for ArrayRangeSet

* Remove RangeSet

* WIP

* Remove complex op from ArrayRangeSet that is used nowhere

also remove some stray println! from some tests

* Shut up clippy

* fmt

* Replace replace with an iterator and insert.

iter_range does a linear scan, but so do all other ArrayRangeSet ops.

binary search only becomes worth it when it becomes very large. For typical
sizes linear scan is perfectly fine!

* fmt

* Put back the former println! statements as info!

* Remove common_set_tests macro

we only have one range set now!
2025-12-12 10:38:18 +00:00
Ruediger Klaehn 5c80627372 Introduce get_into and make get test only 2025-12-12 12:24:40 +02:00
Ruediger Klaehn 4b66fc38c3 Move the offset tracking into SendBufferData 2025-12-12 11:36:17 +02:00
Ruediger Klaehn f8a17726a5 Introduce SendBufferData to abstract the actual data storage
In preparation to adding a BytesMut at the end
2025-12-12 11:21:00 +02:00
Rüdiger Klaehn 5a231e3d91 test(quinn-proto): Add proptests for assembler (#243)
* Add proptests for assembler

Also fix a bug in the assembler when going to unordered state after reading
data, and add a regression test for that case.

* Increase ops before we switch to unordered

Otherwise this test mostly tests unordered mode!

* Update quinn-proto/src/connection/assembler.rs

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

* Add defragment to the prop test ops

only to be used when in ordered mode for some reason 🤷

* fmt

---------

Co-authored-by: Philipp Krüger <philipp.krueger1@gmail.com>
2025-12-12 09:08:11 +00:00
Ruediger Klaehn 7c2a6e3a53 Rename and document the SendBuffer fields 2025-12-12 10:44:16 +02:00
Ruediger Klaehn f726e9c8b1 WIP add test that shows pathological behaviour of SendBuffer with small msgs 2025-12-12 10:26:34 +02:00
Diva Martínez a6fdaa34b6 handle responses to off-path PathChallenges (#238)
* store remote to which path challenges are sent

* differentiate response for on-path PathChallenges and off-path ones

* reduce diff
2025-12-11 11:20:08 -05:00
ramfox dd9430a61b refactor: update to draft-ietf-quic-multipath-18 (#241)
* refactor: `PATH_BACKUP` => `PATH_STATUS_BACKUP`

* refactor: `PATH_AVAILABLE` => `PATH_STATUS_AVAILABLE`

---------

Co-authored-by: “ramfox” <“kasey@n0.computer”>
2025-12-11 10:34:41 +00:00
Asmir Avdicevic 2cf15d246c fix: path cid panic (#242) 2025-12-11 08:37:49 +00:00
Diva Martínez a688a24072 refactor: create PathChallenge and PathResponse types (#240)
* create PathChallenge and PathResponse

* Small fixes
2025-12-10 21:32:56 +00:00
Floris Bruynooghe df0828a7b0 fix: Improve condition of when a PATH_RESPONSE RTT can be used (#237)
This improves the condition of when the RTT learned from a
PATH_RESPONSE can be used. The easiest way to achieve this correctly
is by embedding the logic in the RttEstimator itself.
2025-12-10 16:42:42 +00:00
Floris Bruynooghe 2cce29ce14 fix: Only use PATH_CHALLENGE/RESPONSE RTT for initial RTT (#235)
According to https://www.rfc-editor.org/rfc/rfc9002#section-6.2.2-2:

   A connection MAY use the delay between sending a PATH_CHALLENGE and
   receiving a PATH_RESPONSE to set the initial RTT (see kInitialRtt
   in Appendix A.2) for a new path, but the delay SHOULD NOT be
   considered an RTT sample.

Before we used this as a normal sample, this fixes this to only use it
as the initial RTT.
2025-12-10 15:45:44 +00:00
Philipp Krüger 2e1b164fde fix(proto): Emit updated qlog tuple when a path's remote changes (#236) 2025-12-10 14:15:25 +00:00
Floris Bruynooghe 46a3fe9976 fix: Check higher spaces if blocked for any reason (#232)
This is a bug that did sneak in with the introduction of the
PathBlocked enum. If a PacketNumberSpace is blocked for any
reason (anti-amplification, congestion or pacing), we still need to be
able to send tail-loss probes on higher PacketNumberSpaces. Otherwise
those spaces could end up in a deadlock too.
2025-12-10 14:08:08 +00:00
Friedel Ziegelmayer 67df91c667 fix(proto): ensure ImmediateAcks are sent in Data space (#226)
* fix(proto): ensure ImmediateAcks are sent in Data space

Closes https://github.com/n0-computer/quinn/issues/225

* fix: ensure spaceid writing

* add another debug assertion

* fixup
2025-12-09 15:36:01 +00:00
Friedel Ziegelmayer 704a3f613e fix(proto): handle new CIDs for closed paths (#224)
* fix(proto): handle new CIDs for closed paths

* fixup: move new_cids cleanup earlier

* check abandoned_paths

* fix: cleanup remaining state

* apply CR

* one more CR
2025-12-09 14:27:38 +00:00
Philipp Krüger d4d11a1538 fix(proto): Don't try to clean up ACKs on packet number spaces of forgotten paths (#230)
* fix: Don't allow sending path status frames on non-multipath connections

* fix: Ignore PATH_ACKs on abandoned paths

* test: Implement a quinn-proto multipath proptest & add regression tests

* Restructure proptests, fix "invalid key" access in test endpoints

* Turn of MTUD

* Add another regression test

* fix: Correctly check `space.rx_packet` in key updates

Also refactor `PacketNumberSpace::rx_packet` to be an `Option<u64>` instead of `u64`.

* Smaller test case

* fix accepting packets from other remotes.

* Increase the iterations in `drive_bounded`

* Remove proptests itself

* Cargo.lock update fix after merge

* fix imports

* fix merge

* self-review

* cfg-gate proptests

* Implement `RoutingTable` instead of `multipath_addrs`

* Keep connection handles around, but don't use them when drained

* Fix all tests

* Reintroduce proptests

* Move random interaction running tests into submodule

* Implement more complex route table generation

* Prefer `Self::`

* refactor: Prefer not duplicating quinn-proto types

* Don't track `path_ids` in `State`, but fetch them from `Connection`

* Extract out `TestOp::run`

* Reorder things

* Add close operation

* Properly use short-circuiting

* Add holepunching APIs to proptests

* Revert accidental changes

* Return the `ConnectionError` from `Connection::handle_event`

* Revert "Return the `ConnectionError` from `Connection::handle_event`"

This reverts commit 713e17465f.

* Check `Connection::state` in proptests instead of adding a panic_on_transport_error config

* Properly check for transport errors

* `cargo fmt`

* Cfg out `random_interaction` module in Wasm

* format

* Cleanup, fix all clippy issues

* Enable qlog for proptests

* Panic with debug assertions when we end up accessing old PNSes

* Add generated regression test `regression_packet_number_space_missing`

* Fix accessing packet number space of paths that have been forgotten

* Always panic in `for_path`, even if we're not in debug_assertions
2025-12-09 13:17:34 +00:00
Philipp Krüger 5e51c98783 test: Add code to programmatically generate interaction patterns with quinn-proto (#193)
* fix: Don't allow sending path status frames on non-multipath connections

* fix: Ignore PATH_ACKs on abandoned paths

* test: Implement a quinn-proto multipath proptest & add regression tests

* Restructure proptests, fix "invalid key" access in test endpoints

* Turn of MTUD

* Add another regression test

* fix: Correctly check `space.rx_packet` in key updates

Also refactor `PacketNumberSpace::rx_packet` to be an `Option<u64>` instead of `u64`.

* Smaller test case

* fix accepting packets from other remotes.

* Increase the iterations in `drive_bounded`

* Remove proptests itself

* Cargo.lock update fix after merge

* fix imports

* fix merge

* self-review

* cfg-gate proptests

* Implement `RoutingTable` instead of `multipath_addrs`

* Keep connection handles around, but don't use them when drained

* Fix all tests

* Reintroduce proptests

* Move random interaction running tests into submodule

* Implement more complex route table generation

* Prefer `Self::`

* refactor: Prefer not duplicating quinn-proto types

* Don't track `path_ids` in `State`, but fetch them from `Connection`

* Extract out `TestOp::run`

* Reorder things

* Add close operation

* Properly use short-circuiting

* Add holepunching APIs to proptests

* Revert accidental changes

* Return the `ConnectionError` from `Connection::handle_event`

* Revert "Return the `ConnectionError` from `Connection::handle_event`"

This reverts commit 713e17465f.

* Check `Connection::state` in proptests instead of adding a panic_on_transport_error config

* Properly check for transport errors

* `cargo fmt`

* Cfg out `random_interaction` module in Wasm

* format

* Cleanup, fix all clippy issues

* Code review
2025-12-09 12:45:37 +00:00
Rüdiger Klaehn bad9ca2abd refactor: Use array based data structure for sent_packets instead of BTreeMap (#202)
* WIP add new packet buffer

* Use git dep

* Use PacketBuf for lost_packets as well

* Use published sorted_index_buffer

* fmt

* Get rid of MSRV warning

* fix dependency sort order
2025-12-09 11:21:56 +00:00
Asmir Avdicevic 11a024ba73 fix(ci): daily mac os job (#229) 2025-12-09 09:56:35 +00:00
Friedel Ziegelmayer f437716e1b Update quinn upstream (#227)
* Take semver-compatible dependency updates

* proto: use new constructor where possible

* proto: drop unused From impl

* quinn: import more types

* quinn: remove indirection in connection initialization

---------

Co-authored-by: Dirkjan Ochtman <dirkjan@ochtman.nl>
2025-12-09 09:22:22 +00:00
Franz Heinzmann b29730b70f fix: add missing frames to qlog (#228) 2025-12-08 13:35:32 +00:00
Franz Heinzmann abbe27bf07 feat!: update qlog to latest drafts, add more events and QUIC extensions, emit traces per connection (#208)
* refactor: upgrade to latest n0-qlog

* feat: record path id

* feat: add qlog support for multipath frames

* support more frames and error codes

* feat: add support for quic-address-discovery and quic-ack-frequency extensions

* feat: support iroh's NAT traversal extension

* feat: emit TupleAssigned for new paths

* fixup

* chore: update to latest n0-qlog

* feat: emit TransportParameters

* chore: clippy

* deps: update to n0-qlog 0.1.0

* refactor: add qlog factory, move group_id to common_fields

* docs: improve

* chore: clippy

* fixup

* feat: add QlogFileFactory and util methods on TransportConfig

* feat: reexport from quinn

* chore: clippy

* feat: qlog timers

* add more timers

* docs: improve

* refactor: disable keep alive timers in qlog to reduce noise

* address review

* fix: downgrade logging

* cleanup

* fixup naming

---------

Co-authored-by: Friedel Ziegelmayer <me@dignifiedquire.com>
2025-12-06 10:07:30 +00:00
Friedel Ziegelmayer 79aa0f8092 fix!: use PathId in more APIs and remove Connection::network_path_changed (#210)
* chore: add more Debug derives

* fix: do not unconditionally use path 0 in APIs

* fix(quinn): reexport PathId

* fixup: debug for controllermetrics

* cleanup and remove `network_path_changed` api
2025-12-06 09:27:27 +00:00
Friedel Ziegelmayer 988efd8578 fix: cleanup path closing errors (#221)
- update names to more closely match the RFC
- pass a fixed error code when the application closes the path

Closes https://github.com/n0-computer/iroh/issues/3633
2025-12-05 18:58:22 +00:00
Floris Bruynooghe 29c186d154 fix: do not use Instant::now in proto tests (#223)
* fix: do not use Instant::now in proto tests

Proto tests using the Pair driver should not use Instant::now() for
API calls. The Pair keeps track of time itself, and advances time
faster than real time. So time can be ahead of real time. API calls
that need a "now" should take the time from the Pair::time field.

* remove unused import

* Also fixup the non-multipath tests
2025-12-05 17:35:39 +00:00
Floris Bruynooghe f8afb5e861 Add a long and boring comment (#222) 2025-12-05 15:27:46 +00:00
Friedel Ziegelmayer 33156eb69a fix(proto): send path acks only in 1RTT space (#220)
* fix(proto): send path acks only in 1RTT space

Closes https://github.com/n0-computer/iroh/issues/3727

* check for multipath frames being on incoming

* fixup format

* fixup: undo filters

* expand frame checks

* expand check to also restrict QAD frames
2025-12-05 14:06:20 +00:00
Diva Martínez 1778966a91 move future challenges out of Retransmits (#216)
* keep info about sent challenges in the server state

* move the pending challenges to the hp state

This is not retransmittable data
2025-12-05 13:16:13 +00:00
Floris Bruynooghe 685f995826 fix: run MTU discovery on all paths (#215)
* fix: run MTU discovery on all paths

This ensures that MTU discovery is run on all open, validated paths
and not-abandoned paths.

Fixes #3526.

* spelling

* describe the conditions in text
2025-12-05 13:09:22 +00:00
Asmir Avdicevic f95435ef10 fix: add ci timeout to codecov (#217) 2025-12-04 21:48:55 +00:00
Diva Martínez fc35922d64 refactor: split client and server hp state (#214)
* clearly differentiate client and server states

This makes reasoning much easier since only the required fields are
present in the corresponding side state. It also reduces state size, now
it's 112 bytes, before it was 160 bytes

* apply clippy fixes

* fmt
2025-12-04 08:58:21 +00:00
ramfox 9c66e79377 feat: make TransportConfig Clone (#213)
Co-authored-by: “ramfox” <“kasey@n0.computer”>
2025-12-03 23:17:09 +00:00
Floris Bruynooghe c0cf8540eb fix: disable GSO on windows if failures happen (#209)
* fix: disable GSO on windows if failures happen

Unfortunately this is not feature gated, so had the risk of tanking
performance on windows. Though it should not normally happen.

* make this state exist

* love running compiler on ci

* params

* imports

* param

* and slowly doing everything arqu did...

* adjust the test
2025-12-02 19:45:43 +00:00
Franz Heinzmann 238057833a feat(proto): expand qlog support (#181)
* feat: add vantage point to qlog traces

* feat: record outgoing quic frames in qlog

feat: add ConnectionStarted to qlog

feat: track received packets in qlog

fix: cid groups, padding size, cleanups

fixup vantage_point method signature

chore: clippy

* address review!

* fixup

* refactor: use crate::Frame for recording sent frames in qlog

* fixup

* fixup

* docs: fixup

* chore: cleanup
2025-12-02 14:19:27 +00:00
Floris Bruynooghe cb60f6d1b0 Be more aggressive on slow tests (#206)
Tests are currently fast, that's a feature we'd like to keep
ideally. We can tune it if this ends up being flaky for slow CI hosts.
2025-12-02 13:38:21 +00:00
Friedel Ziegelmayer ea9dbb9fb0 feat: expose feature fast-apple-datapath (#204) 2025-12-02 13:13:06 +00:00
Asmir Avdicevic 2f508d5ab2 fix: fmt & spelling 2025-12-02 12:39:06 +00:00
Asmir Avdicevic 35f654b0c0 ci: fix more workflows 2025-12-02 13:24:18 +01:00
Philipp Krüger 1b83e4fea7 fix: Don't allow sending path status frames on non-multipath connections (#191) 2025-12-02 12:27:56 +01:00
Philipp Krüger 656f144f3d Merge branch 'main-iroh' into matheus23/fix-path-status-send 2025-12-02 12:24:41 +01:00
Asmir Avdicevic a1cc539566 ci: setup n0 based CI 2025-12-02 12:11:05 +01:00
Philipp Krüger 083fb7076f Merge remote-tracking branch 'origin/main-iroh' into matheus23/fix-path-status-send 2025-12-02 11:31:27 +01:00
Philipp Krüger 661cbd6f83 Revert OpenPathError -> PathError and NotOpen rename. 2025-12-02 11:31:19 +01:00
Floris Bruynooghe 0805840549 style: use display for PathId in tracing fields (#201) 2025-12-02 10:50:26 +01:00
Friedel Ziegelmayer 8954a64a7f chore: merge upstream (#194)
Updates up to
https://github.com/quinn-rs/quinn/commit/8bf6825da7876dc233434baaea546d3addc4b0ed
2025-12-02 09:53:00 +01:00