aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2012-10-03 23:56:34 -0400
committerRoger Dingledine <arma@torproject.org>2012-10-03 23:56:34 -0400
commit10b43f4c46378c5d08aaba01ee00081c18002a44 (patch)
tree063de88bda8c427e6a1c891127364f1deb1c95da /src
parent05f6f8f26d5911ec33e953f0c21ca56021bfe17d (diff)
downloadtor-10b43f4c46378c5d08aaba01ee00081c18002a44.tar.gz
tor-10b43f4c46378c5d08aaba01ee00081c18002a44.zip
pass the reason from the truncated cell to the controller
(rather than just always declaring that the reason is END_CIRC_REASON_OR_CONN_CLOSED) resolves bug 7039.
Diffstat (limited to 'src')
-rw-r--r--src/or/circuitbuild.c4
-rw-r--r--src/or/circuitbuild.h3
-rw-r--r--src/or/relay.c3
3 files changed, 6 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 09eef64eff..be97b7c1cf 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2999,7 +2999,7 @@ circuit_finish_handshake(origin_circuit_t *circ, uint8_t reply_type,
* just give up: for circ to close, and return 0.
*/
int
-circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer)
+circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer, int reason)
{
// crypt_path_t *victim;
// connection_t *stream;
@@ -3012,7 +3012,7 @@ circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer)
* just give up.
*/
circuit_mark_for_close(TO_CIRCUIT(circ),
- END_CIRC_REASON_FLAG_REMOTE|END_CIRC_REASON_OR_CONN_CLOSED);
+ END_CIRC_REASON_FLAG_REMOTE|reason);
return 0;
#if 0
diff --git a/src/or/circuitbuild.h b/src/or/circuitbuild.h
index c3905ca21a..8ec48beb0b 100644
--- a/src/or/circuitbuild.h
+++ b/src/or/circuitbuild.h
@@ -32,7 +32,8 @@ int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
int reverse);
int circuit_finish_handshake(origin_circuit_t *circ, uint8_t cell_type,
const uint8_t *reply);
-int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer);
+int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer,
+ int reason);
int onionskin_answer(or_circuit_t *circ, uint8_t cell_type,
const char *payload, const char *keys);
int circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
diff --git a/src/or/relay.c b/src/or/relay.c
index 54f66346d9..4a50b710dd 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -1251,7 +1251,8 @@ connection_edge_process_relay_cell(cell_t *cell, circuit_t *circ,
"'truncated' unsupported at non-origin. Dropping.");
return 0;
}
- circuit_truncated(TO_ORIGIN_CIRCUIT(circ), layer_hint);
+ circuit_truncated(TO_ORIGIN_CIRCUIT(circ), layer_hint,
+ get_uint8(cell->payload + RELAY_HEADER_SIZE));
return 0;
case RELAY_COMMAND_CONNECTED:
if (conn) {