[or-cvs] start the process of making 0.0.7* obsolete
Roger Dingledine
arma at seul.org
Sun Oct 17 21:51:22 UTC 2004
Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/or
Modified Files:
circuitbuild.c circuituse.c connection_edge.c connection_or.c
cpuworker.c main.c router.c routerlist.c routerparse.c
Log Message:
start the process of making 0.0.7* obsolete
Index: circuitbuild.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuitbuild.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- circuitbuild.c 16 Oct 2004 22:56:46 -0000 1.41
+++ circuitbuild.c 17 Oct 2004 21:51:19 -0000 1.42
@@ -437,7 +437,6 @@
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 @@
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 @@
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 @@
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;
Index: circuituse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuituse.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- circuituse.c 16 Oct 2004 22:14:51 -0000 1.17
+++ circuituse.c 17 Oct 2004 21:51:20 -0000 1.18
@@ -76,8 +76,7 @@
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) {
Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_edge.c,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -d -r1.216 -r1.217
--- connection_edge.c 17 Oct 2004 21:10:41 -0000 1.216
+++ connection_edge.c 17 Oct 2004 21:51:20 -0000 1.217
@@ -974,6 +974,7 @@
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);
Index: connection_or.c
===================================================================
RCS file: /home/or/cvsroot/src/or/connection_or.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- connection_or.c 16 Oct 2004 22:14:51 -0000 1.130
+++ connection_or.c 17 Oct 2004 21:51:20 -0000 1.131
@@ -254,20 +254,8 @@
* 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;
Index: cpuworker.c
===================================================================
RCS file: /home/or/cvsroot/src/or/cpuworker.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- cpuworker.c 16 Oct 2004 22:14:51 -0000 1.50
+++ cpuworker.c 17 Oct 2004 21:51:20 -0000 1.51
@@ -188,8 +188,7 @@
* 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];
Index: main.c
===================================================================
RCS file: /home/or/cvsroot/src/or/main.c,v
retrieving revision 1.335
retrieving revision 1.336
diff -u -d -r1.335 -r1.336
--- main.c 16 Oct 2004 22:14:51 -0000 1.335
+++ main.c 17 Oct 2004 21:51:20 -0000 1.336
@@ -400,9 +400,7 @@
(!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 @@
/** 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) {
Index: router.c
===================================================================
RCS file: /home/or/cvsroot/src/or/router.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -d -r1.100 -r1.101
--- router.c 16 Oct 2004 22:14:52 -0000 1.100
+++ router.c 17 Oct 2004 21:51:20 -0000 1.101
@@ -237,23 +237,17 @@
/* 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 @@
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 @@
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 @@
/* 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);
Index: routerlist.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerlist.c,v
retrieving revision 1.163
retrieving revision 1.164
diff -u -d -r1.163 -r1.164
--- routerlist.c 16 Oct 2004 08:39:56 -0000 1.163
+++ routerlist.c 17 Oct 2004 21:51:20 -0000 1.164
@@ -423,9 +423,8 @@
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));
Index: routerparse.c
===================================================================
RCS file: /home/or/cvsroot/src/or/routerparse.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- routerparse.c 16 Oct 2004 22:14:52 -0000 1.61
+++ routerparse.c 17 Oct 2004 21:51:20 -0000 1.62
@@ -824,15 +824,13 @@
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;
}
More information about the tor-commits
mailing list