diff options
author | Roger Dingledine <arma@torproject.org> | 2004-10-17 21:51:20 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-10-17 21:51:20 +0000 |
commit | 97a0a435114e99e14dafa9f6ee72df644254b460 (patch) | |
tree | d47de4e5a5cbfe9d5450706d66a554d7d776228b /src/or/circuitbuild.c | |
parent | 640544ae3e6d6e8b576327442c98750359eccbf6 (diff) | |
download | tor-97a0a435114e99e14dafa9f6ee72df644254b460.tar tor-97a0a435114e99e14dafa9f6ee72df644254b460.tar.gz |
start the process of making 0.0.7* obsolete
svn:r2565
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r-- | src/or/circuitbuild.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 3aa7e797b..5b5c8e9a6 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -437,7 +437,6 @@ int circuit_send_next_onion_skin(circuit_t *circ) { int circuit_extend(cell_t *cell, circuit_t *circ) { connection_t *n_conn; relay_header_t rh; - int old_format; char *onionskin; char *id_digest=NULL; routerinfo_t *router; @@ -449,11 +448,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) { relay_header_unpack(&rh, cell->payload); - if (rh.length == 4+2+ONIONSKIN_CHALLENGE_LEN) { - old_format = 1; - } else if (rh.length == 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) { - old_format = 0; - } else { + if (rh.length < 4+2+ONIONSKIN_CHALLENGE_LEN+DIGEST_LEN) { log_fn(LOG_WARN, "Wrong length %d on extend cell. Closing circuit.", rh.length); return -1; } @@ -461,19 +456,9 @@ int circuit_extend(cell_t *cell, circuit_t *circ) { circ->n_addr = ntohl(get_uint32(cell->payload+RELAY_HEADER_SIZE)); circ->n_port = ntohs(get_uint16(cell->payload+RELAY_HEADER_SIZE+4)); - if (old_format) { - n_conn = connection_exact_get_by_addr_port(circ->n_addr,circ->n_port); - onionskin = cell->payload+RELAY_HEADER_SIZE+4+2; - if(!n_conn) { /* hunt around for it a bit before giving up */ - router = router_get_by_addr_port(circ->n_addr, circ->n_port); - if(router) - n_conn = connection_get_by_identity_digest(router->identity_digest, CONN_TYPE_OR); - } - } else { - onionskin = cell->payload+RELAY_HEADER_SIZE+4+2; - id_digest = cell->payload+RELAY_HEADER_SIZE+4+2+ONIONSKIN_CHALLENGE_LEN; - n_conn = connection_get_by_identity_digest(id_digest, CONN_TYPE_OR); - } + onionskin = cell->payload+RELAY_HEADER_SIZE+4+2; + id_digest = cell->payload+RELAY_HEADER_SIZE+4+2+ONIONSKIN_CHALLENGE_LEN; + n_conn = connection_get_by_identity_digest(id_digest, CONN_TYPE_OR); if(!n_conn || n_conn->state != OR_CONN_STATE_OPEN) { /* Note that this will close circuits where the onion has the same @@ -484,17 +469,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) { log_fn(LOG_INFO,"Next router (%s:%d) not connected. Connecting.", inet_ntoa(in), circ->n_port); - if (old_format) { - router = router_get_by_addr_port(circ->n_addr, circ->n_port); - if(!router) { - log_fn(LOG_WARN,"Next hop is an unknown router. Closing."); - return -1; - } - id_digest = router->identity_digest; - } else { /* new format */ - router = router_get_by_digest(id_digest); - } - tor_assert(id_digest); + router = router_get_by_digest(id_digest); memcpy(circ->onionskin, onionskin, ONIONSKIN_CHALLENGE_LEN); circ->state = CIRCUIT_STATE_OR_WAIT; |