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 | |
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')
-rw-r--r-- | src/or/circuitbuild.c | 35 | ||||
-rw-r--r-- | src/or/circuituse.c | 3 | ||||
-rw-r--r-- | src/or/connection_edge.c | 1 | ||||
-rw-r--r-- | src/or/connection_or.c | 14 | ||||
-rw-r--r-- | src/or/cpuworker.c | 3 | ||||
-rw-r--r-- | src/or/main.c | 9 | ||||
-rw-r--r-- | src/or/router.c | 25 | ||||
-rw-r--r-- | src/or/routerlist.c | 5 | ||||
-rw-r--r-- | src/or/routerparse.c | 6 |
9 files changed, 17 insertions, 84 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; diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 9ce848038..c373c366f 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -76,8 +76,7 @@ static int circuit_is_acceptable(circuit_t *circ, if (conn->socks_request && conn->socks_request->command == SOCKS_COMMAND_RESOLVE) { - /* 0.0.7 servers and earlier don't support DNS resolution. 0.0.8 servers - * have buggy resolve support. */ + /* 0.0.8 servers have buggy resolve support. */ if (!tor_version_as_new_as(exitrouter->platform, "0.0.9pre1")) return 0; } else if(purpose == CIRCUIT_PURPOSE_C_GENERAL) { diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 294c1155f..0fba0ae24 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -974,6 +974,7 @@ int connection_ap_can_use_exit(connection_t *conn, routerinfo_t *exit) exit->nickname, conn->socks_request->address, conn->socks_request->port); if (conn->socks_request->command == SOCKS_COMMAND_RESOLVE) { + /* 0.0.8 servers have buggy resolve support. */ return tor_version_as_new_as(exit->platform, "0.0.9pre1"); } addr = client_dns_lookup_entry(conn->socks_request->address); diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 7ad0230d4..02cb4fa23 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -254,20 +254,8 @@ connection_t *connection_or_connect(uint32_t addr, uint16_t port, * Return -1 if <b>conn</b> is broken, else return 0. */ int connection_tls_start_handshake(connection_t *conn, int receiving) { - int use_no_cert=0; conn->state = OR_CONN_STATE_HANDSHAKING; - if(receiving) { /* check if he's 0.0.7 and I'm unverified */ - routerinfo_t *him, *me; - him = router_get_by_digest(conn->identity_digest); - me = router_get_my_routerinfo(); - - if(him && !tor_version_as_new_as(him->platform, "0.0.8pre1") && - (!me || !me->is_verified)) { - log_fn(LOG_INFO,"He's running 0.0.7, and I'm unverified. Acting like OP."); - use_no_cert = 1; - } - } - conn->tls = tor_tls_new(conn->s, receiving, use_no_cert); + conn->tls = tor_tls_new(conn->s, receiving, 0); if(!conn->tls) { log_fn(LOG_WARN,"tor_tls_new failed. Closing."); return -1; diff --git a/src/or/cpuworker.c b/src/or/cpuworker.c index 1d6eee4bd..c3d2aa329 100644 --- a/src/or/cpuworker.c +++ b/src/or/cpuworker.c @@ -188,8 +188,7 @@ done_processing: * Negotiated keys KEY_LEN*2+DIGEST_LEN*2 * * (Note: this _should_ be by addr/port, since we're concerned with specific - * connections, not with routers (where we'd use identity). Also, using - * identity would break pre-0.0.8 OPs, which don't have identity keys.) + * connections, not with routers (where we'd use identity).) */ static int cpuworker_main(void *data) { unsigned char question[ONIONSKIN_CHALLENGE_LEN]; diff --git a/src/or/main.c b/src/or/main.c index 8c3e3e36a..b0bb65a34 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -400,9 +400,7 @@ static void run_connection_housekeeping(int i, time_t now) { (!clique_mode() && !circuit_get_by_conn(conn) && (!router || !server_mode() || !router_is_clique_mode(router)))) { /* our handshake has expired; - * or we're not an authdirserver, we have no circuits, and - * either he's an OP, we're an OP, or we're both ORs and he's - * running 0.0.8 and he's not an authdirserver, + * or we have no circuits and we're both either OPs or normal ORs, * then kill it. */ log_fn(LOG_INFO,"Expiring connection to %d (%s:%d).", i,conn->address, conn->port); @@ -535,10 +533,7 @@ static void run_scheduled_events(time_t now) { /** 1b. Every MAX_SSL_KEY_LIFETIME seconds, we change our TLS context. */ if (!last_rotated_certificate) last_rotated_certificate = now; - /*XXXX008 we should remove the server_mode() check once OPs also use - * identity keys (which they can't do until the known-router check in - * connection_or.c is removed. */ - if (server_mode() && last_rotated_certificate+MAX_SSL_KEY_LIFETIME < now) { + if (last_rotated_certificate+MAX_SSL_KEY_LIFETIME < now) { log_fn(LOG_INFO,"Rotating tls context."); if (tor_tls_context_new(get_identity_key(), 1, options.Nickname, MAX_SSL_KEY_LIFETIME) < 0) { diff --git a/src/or/router.c b/src/or/router.c index 08743abf8..cb1f5b316 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -237,23 +237,17 @@ int init_keys(void) { /* OP's don't need persistant keys; just make up an identity and * initialize the TLS context. */ if (!server_mode()) { -#if 0 - /* XXXX008 enable this once we make ORs tolerate unknown routers. */ if (!(prkey = crypto_new_pk_env())) return -1; if (crypto_pk_generate_key(prkey)) return -1; set_identity_key(prkey); +/* XXX NM: do we have a convention for what client's Nickname is? */ if (tor_tls_context_new(get_identity_key(), 1, options.Nickname, MAX_SSL_KEY_LIFETIME) < 0) { log_fn(LOG_ERR, "Error creating TLS context for OP."); return -1; } -#endif - if (tor_tls_context_new(NULL, 0, NULL, MAX_SSL_KEY_LIFETIME)<0) { - log_fn(LOG_ERR, "Error creating TLS context for OP."); - return -1; - } return 0; } /* Make sure DataDirectory exists, and is private. */ @@ -406,8 +400,6 @@ void router_retry_connections(void) { int router_is_clique_mode(routerinfo_t *router) { if(router->is_trusted_dir) return 1; - if(!tor_version_as_new_as(router->platform, "0.0.8pre1")) - return 1; return 0; } @@ -669,10 +661,7 @@ int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, router->address, router->or_port, router->socks_port, - /* Due to an 0.0.7 bug, we can't actually say that we have a dirport unles - * we're an authoritative directory. - */ - router->is_trusted_dir ? router->dir_port : 0, + router->dir_port, router->platform, published, fingerprint, @@ -694,16 +683,6 @@ int router_dump_router_to_string(char *s, size_t maxlen, routerinfo_t *router, /* From now on, we use 'written' to remember the current length of 's'. */ written = result; - if (router->dir_port && !router->is_trusted_dir) { - /* dircacheport wasn't recognized before 0.0.8pre. (When 0.0.7 is gone, - * we can fold this back into dirport anyway.) */ - result = snprintf(s+written,maxlen-written, "opt dircacheport %d\n", - router->dir_port); - if (result<0 || result+written > maxlen) - return -1; - written += result; - } - if (options.ContactInfo && strlen(options.ContactInfo)) { result = snprintf(s+written,maxlen-written, "opt contact %s\n", options.ContactInfo); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 39e51687f..0eeda7b58 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -423,9 +423,8 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl) bandwidths = smartlist_create(); for (i = 0; i < smartlist_len(sl); ++i) { router = smartlist_get(sl, i); - /* give capacity a default, until 0.0.7 is obsolete */ - tmp = (router->bandwidthcapacity == 0) ? 200000 : router->bandwidthcapacity; - this_bw = (tmp < router->bandwidthrate) ? tmp : router->bandwidthrate; + this_bw = (router->bandwidthcapacity < router->bandwidthrate) ? + router->bandwidthcapacity : router->bandwidthrate; if(this_bw > 800000) this_bw = 800000; /* if they claim something huge, don't believe it */ p = tor_malloc(sizeof(uint32_t)); diff --git a/src/or/routerparse.c b/src/or/routerparse.c index 8700502a0..7811881df 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -824,15 +824,13 @@ routerinfo_t *router_parse_entry_from_string(const char *s, log_fn(LOG_WARN,"Redundant bandwidth line"); goto err; } else if (tok) { - /* XXX set this to "< 3" once 0.0.7 is obsolete */ - if (tok->n_args < 2) { + if (tok->n_args < 3) { log_fn(LOG_WARN,"Not enough arguments to \"bandwidth\""); goto err; } router->bandwidthrate = tor_parse_long(tok->args[0],10,0,INT_MAX,NULL,NULL); router->bandwidthburst = tor_parse_long(tok->args[1],10,0,INT_MAX,NULL,NULL); - if(tok->n_args > 2) - router->bandwidthcapacity = tor_parse_long(tok->args[2],10,0,INT_MAX,NULL,NULL); + router->bandwidthcapacity = tor_parse_long(tok->args[2],10,0,INT_MAX,NULL,NULL); bw_set = 1; } |