mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Upload to trusted dir servers based on DirServer config options, not on routerinfos.
svn:r2529
This commit is contained in:
parent
01eacbca9e
commit
28dd458eaf
@ -73,28 +73,27 @@ void
|
|||||||
directory_post_to_dirservers(uint8_t purpose, const char *payload,
|
directory_post_to_dirservers(uint8_t purpose, const char *payload,
|
||||||
size_t payload_len)
|
size_t payload_len)
|
||||||
{
|
{
|
||||||
int i;
|
smartlist_t *dirservers;
|
||||||
|
|
||||||
routerinfo_t *router;
|
routerinfo_t *router;
|
||||||
routerlist_t *rl;
|
routerlist_t *rl;
|
||||||
char buf[16];
|
char buf[16];
|
||||||
|
|
||||||
router_get_routerlist(&rl);
|
router_get_trusted_dir_servers(&dirservers);
|
||||||
if(!rl)
|
tor_assert(dirservers);
|
||||||
return;
|
SMARTLIST_FOREACH(dirservers, trusted_dir_server_t *, ds,
|
||||||
|
{
|
||||||
for(i=0; i < smartlist_len(rl->routers); i++) {
|
/* Pay attention to fascistfirewall when we're uploading a
|
||||||
router = smartlist_get(rl->routers, i);
|
* router descriptor, but not when uploading a service
|
||||||
/* Note: this posts our descriptor to ourselves, if we're an
|
* descriptor -- those use Tor. */
|
||||||
* authdirserver. But I think that's ok. */
|
if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR &&
|
||||||
if(!router->is_trusted_dir)
|
!options.HttpProxy) {
|
||||||
continue;
|
sprintf(buf,"%d",ds->dir_port);
|
||||||
if (options.FascistFirewall && purpose == DIR_PURPOSE_UPLOAD_DIR) {
|
|
||||||
sprintf(buf,"%d",router->dir_port);
|
|
||||||
if (!smartlist_string_isin(options.FirewallPorts, buf))
|
if (!smartlist_string_isin(options.FirewallPorts, buf))
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
directory_initiate_command_router(router, purpose, payload, payload_len);
|
directory_initiate_command_trusted_dir(ds, purpose, payload, payload_len);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Start a connection to a random running directory server, using
|
/** Start a connection to a random running directory server, using
|
||||||
|
@ -1413,6 +1413,7 @@ typedef struct trusted_dir_server_t {
|
|||||||
} trusted_dir_server_t;
|
} trusted_dir_server_t;
|
||||||
|
|
||||||
int router_reload_router_list(void);
|
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);
|
||||||
trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, int fascistfirewall);
|
trusted_dir_server_t *router_pick_trusteddirserver(int requireothers, int fascistfirewall);
|
||||||
int all_trusted_directory_servers_down(void);
|
int all_trusted_directory_servers_down(void);
|
||||||
|
@ -69,6 +69,18 @@ int router_reload_router_list(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Set *<b>outp</b> to a smartlist containing a list of
|
||||||
|
* trusted_dir_server_t * for all known trusted dirservers. Callers
|
||||||
|
* must not modify the list or its contents.
|
||||||
|
*/
|
||||||
|
void router_get_trusted_dir_servers(smartlist_t **outp)
|
||||||
|
{
|
||||||
|
if (!trusted_dir_servers)
|
||||||
|
trusted_dir_servers = smartlist_create();
|
||||||
|
|
||||||
|
*outp = trusted_dir_servers;
|
||||||
|
}
|
||||||
|
|
||||||
/** Try to find a running dirserver. If there are no running dirservers
|
/** Try to find a running dirserver. If there are no running dirservers
|
||||||
* in our routerlist, set all the authoritative ones as running again,
|
* in our routerlist, set all the authoritative ones as running again,
|
||||||
* and pick one. If there are no dirservers at all in our routerlist,
|
* and pick one. If there are no dirservers at all in our routerlist,
|
||||||
|
Loading…
Reference in New Issue
Block a user