From 959199340a8b777f13a6b5ce921d9d8eab9510e0 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Fri, 10 Sep 2004 21:40:29 +0000 Subject: [PATCH] don't pick administrative-friends when picking your path (just a skeleton for now) svn:r2349 --- src/or/circuitbuild.c | 17 +++++++++++++---- src/or/config.c | 3 ++- src/or/or.h | 1 + src/or/routerlist.c | 7 +++++++ 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 12b2afe908..7acb876bc5 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -1074,14 +1074,19 @@ static routerinfo_t *choose_good_middle_server(cpath_build_state_t *state, log_fn(LOG_DEBUG, "Contemplating intermediate hop: random choice."); excluded = smartlist_create(); - if((r = router_get_by_digest(state->chosen_exit_digest))) + if((r = router_get_by_digest(state->chosen_exit_digest))) { smartlist_add(excluded, r); - if((r = routerlist_find_my_routerinfo())) + routerlist_add_friends(excluded, r); + } + if((r = routerlist_find_my_routerinfo())) { smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); + } for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) { r = router_get_by_digest(cpath->identity_digest); tor_assert(r); smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); } choice = router_choose_random_node("", options.ExcludeNodes, excluded, 0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0); @@ -1095,10 +1100,14 @@ static routerinfo_t *choose_good_entry_server(cpath_build_state_t *state) smartlist_t *excluded = smartlist_create(); char buf[16]; - if((r = router_get_by_digest(state->chosen_exit_digest))) + if((r = router_get_by_digest(state->chosen_exit_digest))) { smartlist_add(excluded, r); - if((r = routerlist_find_my_routerinfo())) + routerlist_add_friends(excluded, r); + } + if((r = routerlist_find_my_routerinfo())) { smartlist_add(excluded, r); + routerlist_add_friends(excluded, r); + } if(options.FascistFirewall) { /* exclude all ORs that listen on the wrong port */ routerlist_t *rl; diff --git a/src/or/config.c b/src/or/config.c index 6f78b0b660..7e060efa19 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1045,7 +1045,8 @@ const char *get_data_directory(or_options_t *options) { if (d && strncmp(d,"~/",2)==0) { char *fn = expand_filename(d); if(!fn) { - /* XXX complain and exit(1) here */ + log_fn(LOG_ERR,"Failed to expand filename '%s'. Exiting.",d); + exit(1); } tor_free(options->DataDirectory); options->DataDirectory = fn; diff --git a/src/or/or.h b/src/or/or.h index c04403aac9..04f02aba2e 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -1394,6 +1394,7 @@ int router_reload_router_list(void); routerinfo_t *router_pick_directory_server(int requireauth, int requireothers); int all_directory_servers_down(void); struct smartlist_t; +void routerlist_add_friends(struct smartlist_t *sl, routerinfo_t *router); 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); diff --git a/src/or/routerlist.c b/src/or/routerlist.c index dfd58283c2..86d11c09eb 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -175,6 +175,13 @@ int all_directory_servers_down(void) { return 1; } +/** Add all the friends of router to the smartlist sl. + */ +void routerlist_add_friends(smartlist_t *sl, routerinfo_t *router) { + + +} + /** Given a comma-and-whitespace separated list of nicknames, see which * nicknames in list name routers in our routerlist that are * currently running. Add the routerinfos for those routers to sl.