summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-06-12 09:17:23 +0000
committerRoger Dingledine <arma@torproject.org>2007-06-12 09:17:23 +0000
commitaf658b7828e2ab814d70acbbb99f414dee239def (patch)
tree427b317c28c17c9cd2aa50f32f10b4bf56719afa /src/or/circuituse.c
parent622dd4927e1d3044fe34a1ec6c9785e044923953 (diff)
downloadtor-af658b7828e2ab814d70acbbb99f414dee239def.tar.gz
tor-af658b7828e2ab814d70acbbb99f414dee239def.zip
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
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c24
1 files changed, 14 insertions, 10 deletions
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. */