diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2013-01-30 21:27:38 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-02-01 17:01:16 -0500 |
commit | bce6714f99df6fd00c90918ac0a7407bf1f764e3 (patch) | |
tree | b879f615aeb6e4d5f8583bba3afc49026f75463e /src/or/circuitbuild.c | |
parent | 3a63e5ef4237464d6f499b271414ee4071856fe8 (diff) | |
download | tor-bce6714f99df6fd00c90918ac0a7407bf1f764e3.tar.gz tor-bce6714f99df6fd00c90918ac0a7407bf1f764e3.zip |
Refactor code that rolls back the use state
Also document it better.
Mention this refactoring in the comments for the path state machine.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 2a3c40cf06..545184b4fc 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1678,6 +1678,31 @@ pathbias_mark_use_success(origin_circuit_t *circ) } /** + * If a stream ever detatches from a circuit in a retriable way, + * we need to mark this circuit as still needing either another + * successful stream, or in need of a probe. + * + * An adversary could let the first stream request succeed (ie the + * resolve), but then tag and timeout the remainder (via cell + * dropping), forcing them on new circuits. + * + * Rolling back the state will cause us to probe such circuits, which + * should lead to probe failures in the event of such tagging due to + * either unrecognized cells coming in while we wait for the probe, + * or the cipher state getting out of sync in the case of dropped cells. + */ +void +pathbias_mark_use_rollback(origin_circuit_t *circ) +{ + if (circ->path_state == PATH_STATE_USE_SUCCEEDED) { + log_info(LD_CIRC, + "Rolling back pathbias use state to 'attempted' for detached " + "circuit %d", circ->global_identifier); + circ->path_state = PATH_STATE_USE_ATTEMPTED; + } +} + +/** * Actually count a circuit success towards a guard's usage counters * if the path state is appropriate. */ |