Loading doc/TODO +5 −3 Original line number Diff line number Diff line Loading @@ -12,12 +12,14 @@ ARMA - arma claims For 0.0.9: N&R- bring tor-spec up to date N . cache and serve running-routers on other nodes? . cache running-routers - download running-routers from servers running rc5-cvs or later o cache and serve running-routers on other nodes? o cache running-routers o download running-routers from servers running rc5-cvs or later N - pump up periods for fetching things; figure out how to do this backward-compatibily, so that people who did set dirfetchpostperiod get the right behavior. - If dirport is set, we should have a maximum dirfetchperiod and a maximum statusfetchperiod, or else we'll serve very stale stuff. N - Adapt version parsing code to handle new version scheme; document new version scheme. N&R. make loglevels info,debug less noisy Loading src/or/directory.c +7 −6 Original line number Diff line number Diff line Loading @@ -152,21 +152,22 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource) trusted_dir_server_t *ds = NULL; int fascistfirewall = get_options()->FascistFirewall; if (purpose == DIR_PURPOSE_FETCH_DIR) { if (purpose == DIR_PURPOSE_FETCH_DIR || purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { if (advertised_server_mode()) { /* only ask authdirservers, and don't ask myself */ ds = router_pick_trusteddirserver(1, fascistfirewall); } else { /* anybody with a non-zero dirport will do */ r = router_pick_directory_server(1, fascistfirewall); r = router_pick_directory_server(1, fascistfirewall, purpose==DIR_PURPOSE_FETCH_RUNNING_LIST); if (!r) { log_fn(LOG_INFO, "No router found for directory; falling back to dirserver list"); log_fn(LOG_INFO, "No router found for %s; falling back to dirserver list", purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ? "status list" : "directory"); ds = router_pick_trusteddirserver(1, fascistfirewall); } } } else if (purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { /* right now, running-routers isn't cached, so ask a trusted directory */ ds = router_pick_trusteddirserver(0, fascistfirewall); } else { // (purpose == DIR_PURPOSE_FETCH_RENDDESC) /* only ask authdirservers, any of them will do */ /* Never use fascistfirewall; we're going via Tor. */ Loading src/or/or.h +1 −1 Original line number Diff line number Diff line Loading @@ -1560,7 +1560,7 @@ typedef struct trusted_dir_server_t { int router_reload_router_list(void); void router_get_trusted_dir_servers(smartlist_t **outp); routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall); routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall, int for_running_routers); trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, int fascistfirewall); int all_trusted_directory_servers_down(void); struct smartlist_t; Loading src/or/routerlist.c +21 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,8 @@ static smartlist_t *trusted_dir_servers = NULL; /* static function prototypes */ static routerinfo_t * router_pick_directory_server_impl(int requireothers, int fascistfirewall); router_pick_directory_server_impl(int requireothers, int fascistfirewall, int for_runningrouters); static trusted_dir_server_t * router_pick_trusteddirserver_impl(int requireother, int fascistfirewall); static void mark_all_trusteddirservers_up(void); Loading Loading @@ -87,15 +88,20 @@ void router_get_trusted_dir_servers(smartlist_t **outp) /** Try to find a running dirserver. If there are no running dirservers * in our routerlist, set all the authoritative ones as running again, * and pick one. If there are no dirservers at all in our routerlist, * reload the routerlist and try one last time. */ * reload the routerlist and try one last time. If for_runningrouters is * true, then only pick a dirserver that can answer runningrouters queries * (that is, a trusted dirserver, or one running 0.0.9rc5-cvs or later). */ routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall) { int fascistfirewall, int for_runningrouters) { routerinfo_t *choice; if (!routerlist) return NULL; choice = router_pick_directory_server_impl(requireothers, fascistfirewall); choice = router_pick_directory_server_impl(requireothers, fascistfirewall, for_runningrouters); if (choice) return choice; Loading @@ -103,7 +109,8 @@ routerinfo_t *router_pick_directory_server(int requireothers, /* mark all authdirservers as up again */ mark_all_trusteddirservers_up(); /* try again */ choice = router_pick_directory_server_impl(requireothers, fascistfirewall); choice = router_pick_directory_server_impl(requireothers, fascistfirewall, for_runningrouters); if (choice) return choice; Loading @@ -114,7 +121,8 @@ routerinfo_t *router_pick_directory_server(int requireothers, return NULL; } /* give it one last try */ choice = router_pick_directory_server_impl(requireothers, 0); choice = router_pick_directory_server_impl(requireothers, 0, for_runningrouters); return choice; } Loading Loading @@ -149,7 +157,8 @@ trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, * it has to be a trusted server. If requireothers, it cannot be us. */ static routerinfo_t * router_pick_directory_server_impl(int requireothers, int fascistfirewall) router_pick_directory_server_impl(int requireothers, int fascistfirewall, int for_runningrouters) { int i; routerinfo_t *router; Loading @@ -175,6 +184,11 @@ router_pick_directory_server_impl(int requireothers, int fascistfirewall) if (!smartlist_string_isin(get_options()->FirewallPorts, buf)) continue; } /* before 0.0.9rc5-cvs, only trusted dirservers served status info. */ if (for_runningrouters && !(tor_version_as_new_as(router->platform,"0.0.9rc5-cvs") || router_digest_is_trusted_dir(router->identity_digest))) continue; smartlist_add(sl, router); } Loading Loading
doc/TODO +5 −3 Original line number Diff line number Diff line Loading @@ -12,12 +12,14 @@ ARMA - arma claims For 0.0.9: N&R- bring tor-spec up to date N . cache and serve running-routers on other nodes? . cache running-routers - download running-routers from servers running rc5-cvs or later o cache and serve running-routers on other nodes? o cache running-routers o download running-routers from servers running rc5-cvs or later N - pump up periods for fetching things; figure out how to do this backward-compatibily, so that people who did set dirfetchpostperiod get the right behavior. - If dirport is set, we should have a maximum dirfetchperiod and a maximum statusfetchperiod, or else we'll serve very stale stuff. N - Adapt version parsing code to handle new version scheme; document new version scheme. N&R. make loglevels info,debug less noisy Loading
src/or/directory.c +7 −6 Original line number Diff line number Diff line Loading @@ -152,21 +152,22 @@ directory_get_from_dirserver(uint8_t purpose, const char *resource) trusted_dir_server_t *ds = NULL; int fascistfirewall = get_options()->FascistFirewall; if (purpose == DIR_PURPOSE_FETCH_DIR) { if (purpose == DIR_PURPOSE_FETCH_DIR || purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { if (advertised_server_mode()) { /* only ask authdirservers, and don't ask myself */ ds = router_pick_trusteddirserver(1, fascistfirewall); } else { /* anybody with a non-zero dirport will do */ r = router_pick_directory_server(1, fascistfirewall); r = router_pick_directory_server(1, fascistfirewall, purpose==DIR_PURPOSE_FETCH_RUNNING_LIST); if (!r) { log_fn(LOG_INFO, "No router found for directory; falling back to dirserver list"); log_fn(LOG_INFO, "No router found for %s; falling back to dirserver list", purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ? "status list" : "directory"); ds = router_pick_trusteddirserver(1, fascistfirewall); } } } else if (purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) { /* right now, running-routers isn't cached, so ask a trusted directory */ ds = router_pick_trusteddirserver(0, fascistfirewall); } else { // (purpose == DIR_PURPOSE_FETCH_RENDDESC) /* only ask authdirservers, any of them will do */ /* Never use fascistfirewall; we're going via Tor. */ Loading
src/or/or.h +1 −1 Original line number Diff line number Diff line Loading @@ -1560,7 +1560,7 @@ typedef struct trusted_dir_server_t { int router_reload_router_list(void); void router_get_trusted_dir_servers(smartlist_t **outp); routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall); routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall, int for_running_routers); trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, int fascistfirewall); int all_trusted_directory_servers_down(void); struct smartlist_t; Loading
src/or/routerlist.c +21 −7 Original line number Diff line number Diff line Loading @@ -20,7 +20,8 @@ static smartlist_t *trusted_dir_servers = NULL; /* static function prototypes */ static routerinfo_t * router_pick_directory_server_impl(int requireothers, int fascistfirewall); router_pick_directory_server_impl(int requireothers, int fascistfirewall, int for_runningrouters); static trusted_dir_server_t * router_pick_trusteddirserver_impl(int requireother, int fascistfirewall); static void mark_all_trusteddirservers_up(void); Loading Loading @@ -87,15 +88,20 @@ void router_get_trusted_dir_servers(smartlist_t **outp) /** Try to find a running dirserver. If there are no running dirservers * in our routerlist, set all the authoritative ones as running again, * and pick one. If there are no dirservers at all in our routerlist, * reload the routerlist and try one last time. */ * reload the routerlist and try one last time. If for_runningrouters is * true, then only pick a dirserver that can answer runningrouters queries * (that is, a trusted dirserver, or one running 0.0.9rc5-cvs or later). */ routerinfo_t *router_pick_directory_server(int requireothers, int fascistfirewall) { int fascistfirewall, int for_runningrouters) { routerinfo_t *choice; if (!routerlist) return NULL; choice = router_pick_directory_server_impl(requireothers, fascistfirewall); choice = router_pick_directory_server_impl(requireothers, fascistfirewall, for_runningrouters); if (choice) return choice; Loading @@ -103,7 +109,8 @@ routerinfo_t *router_pick_directory_server(int requireothers, /* mark all authdirservers as up again */ mark_all_trusteddirservers_up(); /* try again */ choice = router_pick_directory_server_impl(requireothers, fascistfirewall); choice = router_pick_directory_server_impl(requireothers, fascistfirewall, for_runningrouters); if (choice) return choice; Loading @@ -114,7 +121,8 @@ routerinfo_t *router_pick_directory_server(int requireothers, return NULL; } /* give it one last try */ choice = router_pick_directory_server_impl(requireothers, 0); choice = router_pick_directory_server_impl(requireothers, 0, for_runningrouters); return choice; } Loading Loading @@ -149,7 +157,8 @@ trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, * it has to be a trusted server. If requireothers, it cannot be us. */ static routerinfo_t * router_pick_directory_server_impl(int requireothers, int fascistfirewall) router_pick_directory_server_impl(int requireothers, int fascistfirewall, int for_runningrouters) { int i; routerinfo_t *router; Loading @@ -175,6 +184,11 @@ router_pick_directory_server_impl(int requireothers, int fascistfirewall) if (!smartlist_string_isin(get_options()->FirewallPorts, buf)) continue; } /* before 0.0.9rc5-cvs, only trusted dirservers served status info. */ if (for_runningrouters && !(tor_version_as_new_as(router->platform,"0.0.9rc5-cvs") || router_digest_is_trusted_dir(router->identity_digest))) continue; smartlist_add(sl, router); } Loading