diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 9a45492589..e64d4a9343 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -435,6 +435,7 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
int old_format;
char *onionskin;
char *id_digest=NULL;
+ routerinfo_t *router;
if(circ->n_conn) {
log_fn(LOG_WARN,"n_conn already set. Bug/attack. Closing.");
@@ -458,6 +459,11 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
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;
@@ -468,7 +474,6 @@ int circuit_extend(cell_t *cell, circuit_t *circ) {
/* Note that this will close circuits where the onion has the same
* router twice in a row in the path. I think that's ok.
*/
- routerinfo_t *router;
struct in_addr in;
in.s_addr = htonl(circ->n_addr);
log_fn(LOG_INFO,"Next router (%s:%d) not connected. Connecting.",
@@ -803,7 +808,7 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
routerinfo_t *router;
preferredentries = smartlist_create();
- add_nickname_list_to_smartlist(preferredentries,options.EntryNodes);
+ add_nickname_list_to_smartlist(preferredentries,options.EntryNodes,1);
get_connection_array(&carray, &n_connections);
@@ -892,10 +897,10 @@ static routerinfo_t *choose_good_exit_server_general(routerlist_t *dir)
n_best_support, best_support, n_pending_connections);
preferredexits = smartlist_create();
- add_nickname_list_to_smartlist(preferredexits,options.ExitNodes);
+ add_nickname_list_to_smartlist(preferredexits,options.ExitNodes,1);
excludedexits = smartlist_create();
- add_nickname_list_to_smartlist(excludedexits,options.ExcludeNodes);
+ add_nickname_list_to_smartlist(excludedexits,options.ExcludeNodes,0);
sl = smartlist_create();
@@ -1177,7 +1182,7 @@ onion_extend_cpath(crypt_path_t **head_ptr, cpath_build_state_t
state->desired_path_len);
excludednodes = smartlist_create();
- add_nickname_list_to_smartlist(excludednodes,options.ExcludeNodes);
+ add_nickname_list_to_smartlist(excludednodes,options.ExcludeNodes,0);
if(cur_len == state->desired_path_len - 1) { /* Picking last node */
choice = router_get_by_digest(state->chosen_exit_digest);
diff --git a/src/or/command.c b/src/or/command.c
index 284c4c6a9c..f80dd6fcea 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -48,7 +48,7 @@ static void command_time_process_cell(cell_t *cell, connection_t *conn, int *tim
time_passed = tv_udiff(&start, &end) ;
if (time_passed > 10000) { /* more than 10ms */
- log_fn(LOG_INFO,"That call just took %ld ms.",time_passed/1000);
+ log_fn(LOG_DEBUG,"That call just took %ld ms.",time_passed/1000);
}
*time += time_passed;
}
diff --git a/src/or/or.h b/src/or/or.h
index 36fd64fbe0..8d52eb8a28 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -1394,7 +1394,7 @@ int is_legal_nickname_or_hexdigest(const char *s);
routerinfo_t *router_pick_directory_server(int requireauth, int requireothers);
int all_directory_servers_down(void);
struct smartlist_t;
-void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list);
+void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list, int warn_if_down);
routerinfo_t *routerlist_find_my_routerinfo(void);
int router_nickname_matches(routerinfo_t *router, const char *nickname);
routerinfo_t *routerlist_sl_choose_by_bandwidth(smartlist_t *sl);
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index d24286a0b0..cda2ef5fda 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -152,7 +152,9 @@ int all_directory_servers_down(void) {
* nicknames in list name routers in our routerlist that are
* currently running. Add the routerinfos for those routers to sl.
*/
-void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) {
+void
+add_nickname_list_to_smartlist(smartlist_t *sl, const char *list, int warn_if_down)
+{
const char *start,*end;
char nick[MAX_HEX_NICKNAME_LEN+1];
routerinfo_t *router;
@@ -177,7 +179,8 @@ void add_nickname_list_to_smartlist(smartlist_t *sl, const char *list) {
if (router->is_running)
smartlist_add(sl,router);
else
- log_fn(LOG_WARN,"Nickname list includes '%s' which is known but down.",nick);
+ log_fn(warn_if_down ? LOG_WARN : LOG_DEBUG,
+ "Nickname list includes '%s' which is known but down.",nick);
} else
log_fn(has_fetched_directory ? LOG_WARN : LOG_INFO,
"Nickname list includes '%s' which isn't a known router.",nick);
@@ -284,7 +287,7 @@ routerlist_sl_choose_by_bandwidth(smartlist_t *sl)
SMARTLIST_FOREACH(bandwidths, uint32_t*, p, tor_free(p));
smartlist_free(bandwidths);
router = smartlist_get(sl, i);
- log_fn(LOG_INFO,"Picked %s.", router->nickname);
+// log_fn(LOG_INFO,"Picked %s.", router->nickname);
return router;
}
@@ -304,11 +307,11 @@ routerinfo_t *router_choose_random_node(char *preferred, char *excluded,
routerinfo_t *choice;
excludednodes = smartlist_create();
- add_nickname_list_to_smartlist(excludednodes,excluded);
+ add_nickname_list_to_smartlist(excludednodes,excluded,0);
/* try the preferred nodes first */
sl = smartlist_create();
- add_nickname_list_to_smartlist(sl,preferred);
+ add_nickname_list_to_smartlist(sl,preferred,1);
smartlist_subtract(sl,excludednodes);
if(excludedsmartlist)
smartlist_subtract(sl,excludedsmartlist);