From af658b7828e2ab814d70acbbb99f414dee239def Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 12 Jun 2007 09:17:23 +0000 Subject: More work towards making bridge users able to connect via bridges: - demand options->Bridges and options->TunnelDirConns if options->UseBridges is set. - after directory fetches, accept descriptors that aren't referenced by our networkstatuses, *if* they're for a configured bridge. - delay directory fetching until we have at least one bridge descriptor. - learn how to build a one-hop circuit when we have neither routerinfo nor routerstatus for our destination. - teach directory connections how to pick a bridge as the destination directory when doing non-anonymous fetches. - tolerate directory commands for which the dir_port is 0. - remember descriptors when the requested_resource was "authority", rather than just ignoring them. - put bridges on our entry_guards list once we have a descriptor for them. When UseBridges is set, only pick entry guards that are bridges. Else vice versa. svn:r10571 --- src/or/circuituse.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/or/circuituse.c') diff --git a/src/or/circuituse.c b/src/or/circuituse.c index d1044b491e..fef1471fdd 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1034,18 +1034,22 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, want_onehop, conn->chosen_exit_name); if (want_onehop && conn->chosen_exit_name[0] == '$') { /* We're asking for a one-hop circuit to a router that - * we don't have a routerinfo about. Hope we have a - * routerstatus or equivalent. */ - routerstatus_t *s = - routerstatus_get_by_hexdigest(conn->chosen_exit_name+1); - if (s) { - extend_info = extend_info_from_routerstatus(s); - } else { - log_warn(LD_APP, - "Requested router '%s' is not known. Closing.", - conn->chosen_exit_name); + * we don't have a routerinfo about. Make up an extend_info. */ + char digest[DIGEST_LEN]; + char *hexdigest = conn->chosen_exit_name+1; + struct in_addr in; + if (strlen(hexdigest) < HEX_DIGEST_LEN || + base16_decode(digest,DIGEST_LEN,hexdigest,HEX_DIGEST_LEN)<0) { + log_info(LD_DIR, "Broken exit digest on tunnel conn. Closing."); return -1; } + if (!tor_inet_aton(conn->socks_request->address, &in)) { + log_info(LD_DIR, "Broken address on tunnel conn. Closing."); + return -1; + } + extend_info = extend_info_alloc(conn->chosen_exit_name+1, + digest, NULL, ntohl(in.s_addr), + conn->socks_request->port); } else { /* We will need an onion key for the router, and we * don't have one. Refuse or relax requirements. */ -- cgit v1.2.3-54-g00ecf