Tor
0.4.7.0-alpha-dev
|
Code to maintain our lists of directory authorities and fallback directories. More...
#include "core/or/or.h"
#include "app/config/config.h"
#include "app/config/resolve_addr.h"
#include "core/or/policies.h"
#include "feature/control/control_events.h"
#include "feature/dirauth/authmode.h"
#include "feature/dircommon/directory.h"
#include "feature/nodelist/dirlist.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerlist.h"
#include "feature/nodelist/routerset.h"
#include "feature/relay/router.h"
#include "lib/net/resolve.h"
#include "feature/dirclient/dir_server_st.h"
#include "feature/nodelist/node_st.h"
Go to the source code of this file.
Macros | |
#define | dir_server_free(val) FREE_AND_NULL(dir_server_t, dir_server_free_, (val)) |
Functions | |
static void | add_trusted_dir_to_nodelist_addr_set (const dir_server_t *dir) |
void | dirlist_add_trusted_dir_addresses (void) |
int | get_n_authorities (dirinfo_type_t type) |
smartlist_t * | router_get_trusted_dir_servers_mutable (void) |
smartlist_t * | router_get_fallback_dir_servers_mutable (void) |
const smartlist_t * | router_get_trusted_dir_servers (void) |
const smartlist_t * | router_get_fallback_dir_servers (void) |
void | router_reset_status_download_failures (void) |
dir_server_t * | router_get_trusteddirserver_by_digest (const char *digest) |
dir_server_t * | router_get_fallback_dirserver_by_digest (const char *digest) |
int | router_digest_is_fallback_dir (const char *digest) |
dir_server_t * | trusteddirserver_get_by_v3_auth_digest (const char *digest) |
void | mark_all_dirservers_up (smartlist_t *server_list) |
int | router_digest_is_trusted_dir_type (const char *digest, dirinfo_type_t type) |
bool | router_addr_is_trusted_dir_type (const tor_addr_t *addr, dirinfo_type_t type) |
static dir_server_t * | dir_server_new (int is_authority, const char *nickname, const tor_addr_t *ipv4_addr, const char *hostname, uint16_t ipv4_dirport, uint16_t ipv4_orport, const tor_addr_port_t *addrport_ipv6, const char *digest, const char *v3_auth_digest, dirinfo_type_t type, double weight) |
dir_server_t * | trusted_dir_server_new (const char *nickname, const char *address, uint16_t ipv4_dirport, uint16_t ipv4_orport, const tor_addr_port_t *ipv6_addrport, const char *digest, const char *v3_auth_digest, dirinfo_type_t type, double weight) |
dir_server_t * | fallback_dir_server_new (const tor_addr_t *ipv4_addr, uint16_t ipv4_dirport, uint16_t ipv4_orport, const tor_addr_port_t *addrport_ipv6, const char *id_digest, double weight) |
void | dir_server_add (dir_server_t *ent) |
static void | dir_server_free_ (dir_server_t *ds) |
void | clear_dir_servers (void) |
void | dirlist_free_all (void) |
Variables | |
static smartlist_t * | trusted_dir_servers = NULL |
static smartlist_t * | fallback_dir_servers = NULL |
Code to maintain our lists of directory authorities and fallback directories.
For the directory authorities, we have a list containing the public identity key, and contact points, for each authority. The authorities receive descriptors from relays, and publish consensuses, descriptors, and microdescriptors. This list is pre-configured.
Fallback directories are well-known, stable, but untrusted directory caches that clients which have not yet bootstrapped can use to get their first networkstatus consensus, in order to find out where the Tor network really is. This list is pre-configured in fallback_dirs.inc. Every authority also serves as a fallback.
Both fallback directories and directory authorities are are represented by a dir_server_t.
Definition in file dirlist.c.
|
static |
Helper: From a given trusted directory entry, add the v4 or/and v6 address to the nodelist address set.
Definition at line 56 of file dirlist.c.
Referenced by dirlist_add_trusted_dir_addresses().
void clear_dir_servers | ( | void | ) |
void dir_server_add | ( | dir_server_t * | ent | ) |
|
static |
|
static |
Create a directory server at address:port, with OR identity key digest which has DIGEST_LEN bytes. If address is NULL, add ourself. If is_authority, this is a directory authority. Return the new directory server entry on success or NULL on failure.
Definition at line 289 of file dirlist.c.
Referenced by fallback_dir_server_new().
void dirlist_add_trusted_dir_addresses | ( | void | ) |
dir_server_t* fallback_dir_server_new | ( | const tor_addr_t * | ipv4_addr, |
uint16_t | ipv4_dirport, | ||
uint16_t | ipv4_orport, | ||
const tor_addr_port_t * | addrport_ipv6, | ||
const char * | id_digest, | ||
double | weight | ||
) |
Return a new dir_server_t for a fallback directory server at addr:or_port/dir_port, with identity key digest id_digest
int get_n_authorities | ( | dirinfo_type_t | type | ) |
Return the number of directory authorities whose type matches some bit set in type
Definition at line 90 of file dirlist.c.
Referenced by fetch_bridge_descriptors(), networkstatus_check_consensus_signature(), and should_keep_srv().
void mark_all_dirservers_up | ( | smartlist_t * | server_list | ) |
Mark as running every dir_server_t in server_list.
Definition at line 219 of file dirlist.c.
Referenced by router_reset_status_download_failures().
bool router_addr_is_trusted_dir_type | ( | const tor_addr_t * | addr, |
dirinfo_type_t | type | ||
) |
int router_digest_is_fallback_dir | ( | const char * | digest | ) |
Return 1 if any fallback dirserver's identity key hashes to digest, or 0 if no such fallback is in the list of fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir and UseDefaultFallbackDirs torrc options.) The list of fallback directories includes the list of authorities.
int router_digest_is_trusted_dir_type | ( | const char * | digest, |
dirinfo_type_t | type | ||
) |
dir_server_t* router_get_fallback_dirserver_by_digest | ( | const char * | digest | ) |
Return the dir_server_t for the fallback dirserver whose identity key hashes to digest, or NULL if no such fallback is in the list of fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir and UseDefaultFallbackDirs torrc options.) The list of fallback directories includes the list of authorities.
Definition at line 168 of file dirlist.c.
Referenced by router_digest_is_fallback_dir().
smartlist_t* router_get_trusted_dir_servers_mutable | ( | void | ) |
Return a smartlist containing a list of dir_server_t * for all known trusted dirservers. Callers must not modify the list or its contents.
dir_server_t* router_get_trusteddirserver_by_digest | ( | const char * | digest | ) |
Return the dir_server_t for the directory authority whose identity key hashes to digest, or NULL if no such authority is known.
Definition at line 147 of file dirlist.c.
Referenced by handle_response_upload_dir().
void router_reset_status_download_failures | ( | void | ) |
dir_server_t* trusted_dir_server_new | ( | const char * | nickname, |
const char * | address, | ||
uint16_t | ipv4_dirport, | ||
uint16_t | ipv4_orport, | ||
const tor_addr_port_t * | ipv6_addrport, | ||
const char * | digest, | ||
const char * | v3_auth_digest, | ||
dirinfo_type_t | type, | ||
double | weight | ||
) |
dir_server_t* trusteddirserver_get_by_v3_auth_digest | ( | const char * | digest | ) |
Return the dir_server_t for the directory authority whose v3 identity key hashes to digest, or NULL if no such authority is known.
|
static |
Global list of dir_server_t objects for all directory authorities and all fallback directory servers.
Definition at line 51 of file dirlist.c.
Referenced by clear_dir_servers(), dir_server_add(), router_get_fallback_dirserver_by_digest(), and router_reset_status_download_failures().
|
static |
Global list of a dir_server_t object for each directory authority.
Definition at line 48 of file dirlist.c.
Referenced by dir_server_add(), dirlist_add_trusted_dir_addresses(), router_get_trusted_dir_servers_mutable(), router_get_trusteddirserver_by_digest(), and trusteddirserver_get_by_v3_auth_digest().