diff options
author | Roger Dingledine <arma@torproject.org> | 2007-01-27 19:29:16 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2007-01-27 19:29:16 +0000 |
commit | add7d7af195109a06c46c6072b3a4faf4f6ce363 (patch) | |
tree | 33e15ddf3f3fcf3e9797a913e0571ae5da13f518 /src/or/circuituse.c | |
parent | 0e01dda145d372840011ad168d61b30b2b6cde32 (diff) | |
download | tor-add7d7af195109a06c46c6072b3a4faf4f6ce363.tar.gz tor-add7d7af195109a06c46c6072b3a4faf4f6ce363.zip |
Bring us one step closer to being able to establish an encrypted
directory tunnel without knowing a descriptor first. Still not
ready yet. As part of the change, now assume we can use a
create_fast cell if we don't know anything about a router.
svn:r9440
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r-- | src/or/circuituse.c | 40 |
1 files changed, 30 insertions, 10 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c index 4114d12959..36c7a0ac1e 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -1011,18 +1011,38 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn, if (conn->chosen_exit_name) { routerinfo_t *r; int opt = conn->_base.chosen_exit_optional; - if (!(r = router_get_by_nickname(conn->chosen_exit_name, 1))) { - log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, - "Requested exit point '%s' is not known. %s.", - conn->chosen_exit_name, opt ? "Trying others" : "Closing"); - if (opt) { - conn->_base.chosen_exit_optional = 0; - tor_free(conn->chosen_exit_name); - return 0; + r = router_get_by_nickname(conn->chosen_exit_name, 1); + if (r) { + extend_info = extend_info_from_router(r); + } else { + 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); + return -1; + } + } else { + /* We will need an onion key for the router, and we + * don't have one. Refuse or relax requirements. */ + log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP, + "Requested exit point '%s' is not known. %s.", + conn->chosen_exit_name, opt ? "Trying others" : "Closing"); + if (opt) { + conn->_base.chosen_exit_optional = 0; + tor_free(conn->chosen_exit_name); + return 0; + } + return -1; } - return -1; } - extend_info = extend_info_from_router(r); } } |