diff options
author | Mike Perry <mikeperry-git@fscked.org> | 2012-12-12 11:53:18 -0800 |
---|---|---|
committer | Mike Perry <mikeperry-git@fscked.org> | 2013-01-08 17:28:08 -0800 |
commit | 15fdfc2993777497883df8945c1c9138bea2b33a (patch) | |
tree | d681380bd17ea8812196f13b8ea4aaf239685997 /src/or/relay.c | |
parent | 3458d904f62b2d97dce5fea6f85285ea34851724 (diff) | |
download | tor-15fdfc2993777497883df8945c1c9138bea2b33a.tar.gz tor-15fdfc2993777497883df8945c1c9138bea2b33a.zip |
Bug 7691: Send a probe cell down certain types of circs.
In general, if we tried to use a circ for a stream, but then decided to place
that stream on a different circuit, we need to probe the original circuit
before deciding it was a "success".
We also need to do the same for cannibalized circuits that go unused.
Diffstat (limited to 'src/or/relay.c')
-rw-r--r-- | src/or/relay.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/or/relay.c b/src/or/relay.c index f58c5c9c55..a942e44651 100644 --- a/src/or/relay.c +++ b/src/or/relay.c @@ -186,7 +186,17 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, } if (recognized) { - edge_connection_t *conn = relay_lookup_conn(circ, cell, cell_direction, + edge_connection_t *conn = NULL; + + if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { + pathbias_check_probe_response(circ, cell); + + /* We need to drop this cell no matter what to avoid code that expects + * a certain purpose (such as the hidserv code). */ + return 0; + } + + conn = relay_lookup_conn(circ, cell, cell_direction, layer_hint); if (cell_direction == CELL_DIRECTION_OUT) { ++stats_n_relay_cells_delivered; @@ -222,7 +232,15 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, } else { log_fn(LOG_PROTOCOL_WARN, LD_OR, "Dropping unrecognized inbound cell on origin circuit."); - return 0; + /* If we see unrecognized cells on path bias testing circs, + * it's bad mojo. Those circuits need to die. + * XXX: Shouldn't they always die? */ + if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { + TO_ORIGIN_CIRCUIT(circ)->path_state = PATH_STATE_USE_FAILED; + return -END_CIRC_REASON_TORPROTOCOL; + } else { + return 0; + } } if (!chan) { |