diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2012-12-11 17:49:12 -0800 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2012-12-11 17:49:12 -0800 |
commit | ccaeef22e168af34e9b6a63d65ce17e58dd702e2 (patch) | |
tree | 114633471fe0c31b9687c2de69a16d21d109a2c3 /src/or/relay.c | |
parent | af9011f82430a5fac0a6db368f1afb1aa4bbc9f6 (diff) | |
download | tor-ccaeef22e168af34e9b6a63d65ce17e58dd702e2.tar.gz tor-ccaeef22e168af34e9b6a63d65ce17e58dd702e2.zip |
Tags on relay cells can result in certain reason codes.
Close the circuit (it's probably junk anyways), and make sure we don't probe
it/count it as a success.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index fd8f8579a7..b4b77007cd 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -694,13 +694,23 @@ connection_ap_process_end_not_open( (void) layer_hint; /* unused */ if (rh->length > 0) { - /* Path bias: If we get a valid reason code from the exit, - * it wasn't due to tagging */ - // XXX: This relies on recognized+digest being strong enough not - // to be spoofable.. Is that a valid assumption? - // Or more accurately: is it better than nothing? Can the attack - // be done offline? - circ->path_state = PATH_STATE_USE_SUCCEEDED; + if (reason == END_STREAM_REASON_TORPROTOCOL || + reason == END_STREAM_REASON_INTERNAL || + reason == END_STREAM_REASON_DESTROY) { + /* All three of these reasons could mean a failed tag + * hit the exit and it shat itself. Do not probe. + * Fail the circuit. */ + circ->path_state = PATH_STATE_USE_FAILED; + return -END_CIRC_REASON_TORPROTOCOL; + } else { + /* Path bias: If we get a valid reason code from the exit, + * it wasn't due to tagging */ + // XXX: This relies on recognized+digest being strong enough not + // to be spoofable.. Is that a valid assumption? + // Or more accurately: is it better than nothing? Can the attack + // be done offline? + circ->path_state = PATH_STATE_USE_SUCCEEDED; + } } if (rh->length > 0 && edge_reason_is_retriable(reason) && |