aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-proto/src
Commit message (Collapse)AuthorAgeFilesLines
* proto: Remove redundant headingGabriela Moldovan11 days1-2/+0
| | | | | | There is no `BackwardReactor` heading, because there isn't that much to say about it (it moves `RELAY` cells in the opposite direction, and rejects RELAY_EARLY and PADDING_NEGOTIATE).
* proto: Update table to mention all the other commands we handleGabriela Moldovan11 days1-2/+8
|
* proto: Be more specific about where the meta messages are handledGabriela Moldovan11 days1-14/+15
|
* proto: Say how forward DESTROY are handledGabriela Moldovan11 days1-1/+2
|
* proto: Clarify that "it" refers to the forward reactorGabriela Moldovan11 days1-1/+2
|
* proto: Update docs to clarify they apply to RELAY_EARLY tooGabriela Moldovan11 days1-3/+2
|
* proto: Update docs to say EXTEND2 is supportedGabriela Moldovan11 days1-5/+2
|
* proto: Update reactor docs to say TRUNCATE is unsupportedGabriela Moldovan11 days1-2/+3
|
* Merge branch 'unk-circid' into 'main'gabi-2502026-08-132-40/+49
|\ | | | | | | | | | | | | proto: Silently drop DESTROY/RELAY/CREATED cells on unknown circuits Closes #2655 See merge request tpo/core/arti!4301
| * proto: Explicitly drop the cells with unrecognized CircIdsGabriela Moldovan2026-08-121-0/+20
| | | | | | | | And say why it's okay to do so.
| * proto: Update tests now that unrecognized CREATED are droppedGabriela Moldovan2026-08-111-2/+2
| | | | | | | | | | These are no longer causing the channel reactor to shut down, so we need to update this test accordingly.
| * proto: Update tests now that we tolerate unrecognized CircIdsGabriela Moldovan2026-08-111-24/+8
| |
| * proto: s/channel/circuit in test commentGabriela Moldovan2026-08-111-1/+1
| |
| * proto: Ignore CREATED* with unrecognized CircIdsGabriela Moldovan2026-08-112-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we're a relay, we need to tolerate CREATED* with unrecognized CircIds: for example, if we time out[^1] while trying to extend the circuit by another hop, we will send a DESTROY to the extending hop, which can race with the CREATED* response. In other words, a CREATED* cell arriving on a closed circuit shouldn't be treated as a protocol violation. There are, however, a few cases where a CREATED* with an unknown CircId *is* a protocol violation (and probably *should* cause us to close down the channel): * if the CREATED* is moving in the forward direction (towards the exit), or * if we have not previously sent a CREATE* with that particular CircId As before, distinguishing these from the "closed circuit" case above would involve some tricky logic, and the benefits are unclear, while the downsides of closing a channel when we shouldn't have are significant. It seems better to just drop these cells for now. Closes #2655 [^1]: at the time of writing, we don't have timeouts for the circuit extension logic, so what I've described here cannot actually happen today. However, we *do* have a TODO for it, so the time outs I've described here will be implemented at some point
| * proto: Silently drop DESTROY/RELAY cells on unknown circuits (fmt)Gabriela Moldovan2026-08-111-5/+3
| |
| * proto: Silently drop DESTROY/RELAY cells on unknown circuitsGabriela Moldovan2026-08-111-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An unrecognized circuit ID is not always a protocol violation, so we shouldn't close down the channel if it happens. This change makes the channel reactor drop DESTROY and RELAY cells with unknown CircIds without closing down the channel. It affects both clients and relays. Instead of dropping these unconditionally, we could have implemented some more sophisticated checks to distinguish the bogus CircIds from the CircIds of closed circuits, but it's unclear if it's worth the added complexity (see discussion in #2655). This partly addresses #2646 (an unrecognized circuit ID shouldn't cause us to close down the channel if we're a relay). This commit partially undoes the changes from 4f567e4a9432b340c2799e600c8ceb3724ad3082, which was originally intended to mitigate flooding attacks. Part of #2655
* | Merge branch 'clippy-fixes' into 'main'gabi-2502026-08-134-5/+8
|\ \ | | | | | | | | | | | | tor-proto: Some misc rust/clippy warning fixes See merge request tpo/core/arti!4304
| * | tor-proto: 'expect' -> 'allow' in `CircReactorHandle`Steven Engler2026-08-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an `unfulfilled_lint_expectations` warning. tor-proto conditionally sets a global `allow(unused)`, and if you have an `expect(unused)` field within an `allow(unused)` struct, rust seems to warn with 'unfulfilled_lint_expectations'. https://github.com/rust-lang/rust/issues/160942
| * | tor-proto: fix a `clippy::unnecessary_filter_map`Steven Engler2026-08-111-0/+2
| | |
| * | tor-proto: box `CircParameters` in test-only `CtrlCmd::AddFakeHop`Steven Engler2026-08-112-2/+3
| | | | | | | | | | | | This fixes a `clippy::large_enum_variant`.
| * | tor-proto: fix a 'clippy::useless_conversion'Steven Engler2026-08-111-1/+1
| |/
* | tor-proto: make `CreateRequestHandler` methods asyncSteven Engler2026-08-122-28/+39
| |
* | tor-proto: use `CgoRelayCrypto`/`Tor1RelayCrypto` aliasesSteven Engler2026-08-121-8/+7
| |
* | tor-proto: change `TryFrom<_> for HandshakeSubprotocols` to a dedicated ↵Steven Engler2026-08-122-13/+16
| | | | | | | | | | | | constructor Replaces `TryFrom<SubprotocolRequest> for HandshakeSubprotocols`.
* | tor-proto: check the handshake type in the ntor testSteven Engler2026-08-121-8/+12
| |
* | tor-proto: implement the ntor-v3 handshakeSteven Engler2026-08-121-9/+199
| |
* | tor-proto: add `TryFrom<SubprotocolRequest> for HandshakeSubprotocols`Steven Engler2026-08-121-1/+74
| |
* | tor-proto: change some instances of `sendme_inc` to u8Steven Engler2026-08-123-9/+7
|/
* Merge branch 'cc-event-counters' into 'main'opara2026-08-041-6/+7
|\ | | | | | | | | | | | | tor-proto: Fix cc vegas counter updates on clock stall Closes #2651 See merge request tpo/core/arti!4256
| * tor-proto: fix cc vegas counter updates on clock stallSteven Engler2026-07-301-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pseudocode says: ```text if next_cc_event: next_cc_event-- if next_cwnd_event: next_cwnd_event-- if clock_stalled_or_jumped: inflight -= 'cc_sendme_inc' return ``` but we were previously decrementing these after the return rather than before.
* | proto: Remove a now-done TODOGabriela Moldovan2026-08-041-3/+0
| | | | | | | | We now have `add_relay_ent()` for this, so we can remove the TODO.
* | proto: Rename "hs" to "hc"Gabriela Moldovan2026-08-042-3/+3
| | | | | | | | | | I think this might have been c&p from the half-stream code ("hs" = "half-stream"). "hc" ("half-circuit") seems like a better name.
* | proto: Move comment to the right placeDavid Goulet2026-08-031-3/+3
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: Add {backward|forward} prefix to circ_id in logsDavid Goulet2026-08-0311-35/+35
| | | | | | | | Signed-off-by: David Goulet <[email protected]>
* | proto: Rename uniq_id to circ_unique_id mostly in loggingDavid Goulet2026-08-0314-55/+55
| | | | | | | | | | | | | | | | | | We have decided that instead of "uniq_id" in logging, we'll use the "<domaine>-[<type>]-id" syntax to indicate who is that unique ID. This commit only renames circuit's unique ID to "circ_uniq_id". Signed-off-by: David Goulet <[email protected]>
* | proto: Log both UniqId and CircId when possibleDavid Goulet2026-08-0315-65/+216
| | | | | | | | | | | | | | | | | | | | This commit only affects logging. Whenever possible, log both the UniqId and CircId. This also changes the log lines which is now "uniq_id=" and "circ_id=" as the UniqId is internal and circ_id (CircId) is protocol level. Signed-off-by: David Goulet <[email protected]>
* | proto: Rename CircId and UniqId variable nameDavid Goulet2026-08-038-26/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A CircId is now a circ_id and a UniqId is a unique_id so we stop confusing them in the code. Furthermore, channel_id that are CircId are now circ_id. Channel IDs are different and encoded internally into a UniqId. This is the first step to clarify semantic before we change the logging to log both unique ID and circ ID. No behavior change. Signed-off-by: David Goulet <[email protected]>
* | tor-proto: fix XON conversion from KB/s to B/sSteven Engler2026-07-301-4/+4
| | | | | | | | | | We previously interpreted the rate in the XON message as being Kbits per second, but it's really Kbytes per second.
* | tor-cell: update docs and variable names for `Xon`Steven Engler2026-07-302-3/+3
| |
* | tor-cell: rename `XonKbpsEwma` to `XonKBpsEwma`Steven Engler2026-07-3012-37/+37
|/
* Merge branch 'mock-net' into 'main'David Goulet2026-07-302-31/+69
|\ | | | | | | | | tor-proto: Small improvements to circuit handshake tests See merge request tpo/core/arti!4254
| * tor-proto: reuse existing channels in ntor testSteven Engler2026-07-301-8/+5
| | | | | | | | | | Now that we read all of the cells from the connection inspector, we can reuse the existing channel objects.
| * tor-proto: extend circ handshake tests to close the circuitSteven Engler2026-07-302-2/+38
| |
| * tor-proto: rename some methods on test `ConnInspector`Steven Engler2026-07-302-10/+10
| |
| * tor-proto: reword some TODOsSteven Engler2026-07-301-2/+2
| | | | | | | | These TODOs are for client issues, not relay isues.
| * tor-proto: don't drop stream rx in testsSteven Engler2026-07-302-10/+15
| | | | | | | | Otherwise the new circuit gets closed immediately by the relay.
* | Merge branch 'create-fast' into 'main'opara2026-07-303-37/+19
|\ \ | |/ |/| | | | | tor-protover,tor-proto: Add and use a new `subprotocol_restricted_set` macro See merge request tpo/core/arti!4241
| * tor-proto: use `subprotocol_restricted_set` macroSteven Engler2026-07-303-37/+19
| |
* | tor-proto: add unit tests for some circuit handshakesSteven Engler2026-07-291-0/+130
| |
* | tor-proto: add 'test_utils' mod for channel testsSteven Engler2026-07-292-0/+308
| | | | | | | | These help to establish connected channel objects to be used for tests.