Tor  0.4.7.0-alpha-dev
dirlist.c
Go to the documentation of this file.
1 /* Copyright (c) 2001 Matej Pfajfar.
2  * Copyright (c) 2001-2004, Roger Dingledine.
3  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4  * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file dirlist.c
9  * \brief Code to maintain our lists of directory authorities and
10  * fallback directories.
11  *
12  * For the directory authorities, we have a list containing the public
13  * identity key, and contact points, for each authority. The
14  * authorities receive descriptors from relays, and publish consensuses,
15  * descriptors, and microdescriptors. This list is pre-configured.
16  *
17  * Fallback directories are well-known, stable, but untrusted directory
18  * caches that clients which have not yet bootstrapped can use to get
19  * their first networkstatus consensus, in order to find out where the
20  * Tor network really is. This list is pre-configured in
21  * fallback_dirs.inc. Every authority also serves as a fallback.
22  *
23  * Both fallback directories and directory authorities are are
24  * represented by a dir_server_t.
25  */
26 
27 #include "core/or/or.h"
28 
29 #include "app/config/config.h"
31 #include "core/or/policies.h"
40 #include "feature/relay/router.h"
41 #include "lib/net/resolve.h"
42 
45 
46 /** Information about an (HTTP) dirport for a directory authority. */
48  /** What is the intended usage for this dirport? One of AUTH_USAGE_* */
50  /** What is the correct address/port ? */
52 };
53 
54 /** Global list of a dir_server_t object for each directory
55  * authority. */
57 /** Global list of dir_server_t objects for all directory authorities
58  * and all fallback directory servers. */
60 
61 /** Helper: From a given trusted directory entry, add the v4 or/and v6 address
62  * to the nodelist address set. */
63 static void
65 {
66  tor_assert(dir);
68 
69  /* Add IPv4 and then IPv6 if applicable. For authorities, we add the ORPort
70  * and DirPort so re-entry into the network back to them is not possible. */
71  nodelist_add_addr_to_address_set(&dir->ipv4_addr, dir->ipv4_orport,
72  dir->ipv4_dirport);
73  if (!tor_addr_is_null(&dir->ipv6_addr)) {
74  /* IPv6 DirPort is not a thing yet for authorities. */
76  }
77  if (dir->auth_dirports) {
79  nodelist_add_addr_to_address_set(&p->dirport.addr, 0, p->dirport.port);
80  } SMARTLIST_FOREACH_END(p);
81  }
82 }
83 
84 /** Go over the trusted directory server list and add their address(es) to the
85  * nodelist address set. This is called every time a new consensus is set. */
86 MOCK_IMPL(void,
88 {
89  if (!trusted_dir_servers) {
90  return;
91  }
92 
94  if (ent->is_authority) {
96  }
97  } SMARTLIST_FOREACH_END(ent);
98 }
99 
100 /** Return the number of directory authorities whose type matches some bit set
101  * in <b>type</b> */
102 int
104 {
105  int n = 0;
106  if (!trusted_dir_servers)
107  return 0;
109  if (ds->type & type)
110  ++n);
111  return n;
112 }
113 
114 /** Return a smartlist containing a list of dir_server_t * for all
115  * known trusted dirservers. Callers must not modify the list or its
116  * contents.
117  */
118 smartlist_t *
120 {
121  if (!trusted_dir_servers)
123 
124  return trusted_dir_servers;
125 }
126 
127 smartlist_t *
128 router_get_fallback_dir_servers_mutable(void)
129 {
132 
133  return fallback_dir_servers;
134 }
135 
136 const smartlist_t *
137 router_get_trusted_dir_servers(void)
138 {
140 }
141 
142 const smartlist_t *
143 router_get_fallback_dir_servers(void)
144 {
145  return router_get_fallback_dir_servers_mutable();
146 }
147 
148 /** Reset all internal variables used to count failed downloads of network
149  * status objects. */
150 void
152 {
154 }
155 
156 /** Return the dir_server_t for the directory authority whose identity
157  * key hashes to <b>digest</b>, or NULL if no such authority is known.
158  */
159 dir_server_t *
161 {
162  if (!trusted_dir_servers)
163  return NULL;
164 
166  {
167  if (tor_memeq(ds->digest, digest, DIGEST_LEN))
168  return ds;
169  });
170 
171  return NULL;
172 }
173 
174 /** Return the dir_server_t for the fallback dirserver whose identity
175  * key hashes to <b>digest</b>, or NULL if no such fallback is in the list of
176  * fallback_dir_servers. (fallback_dir_servers is affected by the FallbackDir
177  * and UseDefaultFallbackDirs torrc options.)
178  * The list of fallback directories includes the list of authorities.
179  */
180 dir_server_t *
182 {
184  return NULL;
185 
186  if (!digest)
187  return NULL;
188 
190  {
191  if (tor_memeq(ds->digest, digest, DIGEST_LEN))
192  return ds;
193  });
194 
195  return NULL;
196 }
197 
198 /** Return 1 if any fallback dirserver's identity key hashes to <b>digest</b>,
199  * or 0 if no such fallback is in the list of fallback_dir_servers.
200  * (fallback_dir_servers is affected by the FallbackDir and
201  * UseDefaultFallbackDirs torrc options.)
202  * The list of fallback directories includes the list of authorities.
203  */
204 int
205 router_digest_is_fallback_dir(const char *digest)
206 {
207  return (router_get_fallback_dirserver_by_digest(digest) != NULL);
208 }
209 
210 /** Return the dir_server_t for the directory authority whose
211  * v3 identity key hashes to <b>digest</b>, or NULL if no such authority
212  * is known.
213  */
216 {
217  if (!trusted_dir_servers)
218  return NULL;
219 
221  {
222  if (tor_memeq(ds->v3_identity_digest, digest, DIGEST_LEN) &&
223  (ds->type & V3_DIRINFO))
224  return ds;
225  });
226 
227  return NULL;
228 }
229 
230 /** Mark as running every dir_server_t in <b>server_list</b>. */
231 void
233 {
234  if (server_list) {
235  SMARTLIST_FOREACH_BEGIN(server_list, dir_server_t *, dir) {
236  routerstatus_t *rs;
237  node_t *node;
238  dir->is_running = 1;
239  node = node_get_mutable_by_id(dir->digest);
240  if (node)
241  node->is_running = 1;
243  if (rs) {
244  rs->last_dir_503_at = 0;
246  }
247  } SMARTLIST_FOREACH_END(dir);
248  }
250 }
251 
252 /** Return true iff <b>digest</b> is the digest of the identity key of a
253  * trusted directory matching at least one bit of <b>type</b>. If <b>type</b>
254  * is zero (NO_DIRINFO), or ALL_DIRINFO, any authority is okay. */
256  (const char *digest, dirinfo_type_t type))
257 {
258  if (!trusted_dir_servers)
259  return 0;
260  if (authdir_mode(get_options()) && router_digest_is_me(digest))
261  return 1;
263  if (tor_memeq(digest, ent->digest, DIGEST_LEN)) {
264  return (!type) || ((type & ent->type) != 0);
265  });
266  return 0;
267 }
268 
269 /** Return true iff the given address matches a trusted directory that matches
270  * at least one bit of type.
271  *
272  * If type is NO_DIRINFO or ALL_DIRINFO, any authority is matched.
273  *
274  * Only ORPorts' addresses are considered.
275  */
276 bool
278 {
279  int family = tor_addr_family(addr);
280 
281  if (!trusted_dir_servers) {
282  return false;
283  }
284 
286  /* Ignore entries that don't match the given type. */
287  if (type != NO_DIRINFO && (type & ent->type) == 0) {
288  continue;
289  }
290  /* Match IPv4 or IPv6 address. */
291  if ((family == AF_INET && tor_addr_eq(addr, &ent->ipv4_addr)) ||
292  (family == AF_INET6 && tor_addr_eq(addr, &ent->ipv6_addr))) {
293  return true;
294  }
295  } SMARTLIST_FOREACH_END(ent);
296 
297  return false;
298 }
299 
300 /** Return an appropriate usage value describing which authdir port to use
301  * for a given directory connection purpose.
302  */
305 {
306  switch (purpose) {
312  return AUTH_USAGE_DOWNLOAD;
313 
315  return AUTH_USAGE_UPLOAD;
316 
321  return AUTH_USAGE_VOTING;
322 
323  case DIR_PURPOSE_SERVER:
327  default:
329  return AUTH_USAGE_LEGACY;
330  }
331 }
332 
333 /** Create a directory server at <b>address</b>:<b>port</b>, with OR identity
334  * key <b>digest</b> which has DIGEST_LEN bytes. If <b>address</b> is NULL,
335  * add ourself. If <b>is_authority</b>, this is a directory authority. Return
336  * the new directory server entry on success or NULL on failure. */
337 static dir_server_t *
338 dir_server_new(int is_authority,
339  const char *nickname,
340  const tor_addr_t *ipv4_addr,
341  const char *hostname,
342  uint16_t ipv4_dirport, uint16_t ipv4_orport,
343  const tor_addr_port_t *addrport_ipv6,
344  const char *digest, const char *v3_auth_digest,
345  dirinfo_type_t type,
346  double weight)
347 {
348  dir_server_t *ent;
349  char *hostname_ = NULL;
350 
351  tor_assert(digest);
352 
353  if (weight < 0)
354  return NULL;
355 
356  if (!ipv4_addr) {
357  return NULL;
358  }
359 
360  if (!hostname)
361  hostname_ = tor_addr_to_str_dup(ipv4_addr);
362  else
363  hostname_ = tor_strdup(hostname);
364 
365  ent = tor_malloc_zero(sizeof(dir_server_t));
366  ent->nickname = nickname ? tor_strdup(nickname) : NULL;
367  ent->address = hostname_;
368  tor_addr_copy(&ent->ipv4_addr, ipv4_addr);
369  ent->ipv4_dirport = ipv4_dirport;
370  ent->ipv4_orport = ipv4_orport;
371  ent->is_running = 1;
372  ent->is_authority = is_authority;
373  ent->type = type;
374  ent->weight = weight;
375  if (addrport_ipv6 && tor_addr_port_is_valid_ap(addrport_ipv6, 0)) {
376  if (tor_addr_family(&addrport_ipv6->addr) != AF_INET6) {
377  log_warn(LD_BUG, "Hey, I got a non-ipv6 addr as addrport_ipv6.");
379  } else {
380  tor_addr_copy(&ent->ipv6_addr, &addrport_ipv6->addr);
381  ent->ipv6_orport = addrport_ipv6->port;
382  }
383  } else {
385  }
386 
387  memcpy(ent->digest, digest, DIGEST_LEN);
388  if (v3_auth_digest && (type & V3_DIRINFO))
389  memcpy(ent->v3_identity_digest, v3_auth_digest, DIGEST_LEN);
390 
391  if (nickname)
392  tor_asprintf(&ent->description, "directory server \"%s\" at %s:%" PRIu16,
393  nickname, hostname_, ipv4_dirport);
394  else
395  tor_asprintf(&ent->description, "directory server at %s:%" PRIu16,
396  hostname_, ipv4_dirport);
397 
398  tor_addr_copy(&ent->fake_status.ipv4_addr, &ent->ipv4_addr);
400  memcpy(ent->fake_status.identity_digest, digest, DIGEST_LEN);
401  if (nickname)
402  strlcpy(ent->fake_status.nickname, nickname,
403  sizeof(ent->fake_status.nickname));
404  else
405  ent->fake_status.nickname[0] = '\0';
407  ent->fake_status.ipv4_orport = ent->ipv4_orport;
408  ent->fake_status.ipv6_orport = ent->ipv6_orport;
409  ent->fake_status.is_authority = !! is_authority;
410 
411  return ent;
412 }
413 
414 /** Create an authoritative directory server at <b>address</b>:<b>port</b>,
415  * with identity key <b>digest</b>. If <b>ipv4_addr_str</b> is NULL, add
416  * ourself. Return the new trusted directory server entry on success or NULL
417  * if we couldn't add it. */
418 dir_server_t *
419 trusted_dir_server_new(const char *nickname, const char *address,
420  uint16_t ipv4_dirport, uint16_t ipv4_orport,
421  const tor_addr_port_t *ipv6_addrport,
422  const char *digest, const char *v3_auth_digest,
423  dirinfo_type_t type, double weight)
424 {
425  tor_addr_t ipv4_addr;
426  char *hostname=NULL;
427  dir_server_t *result;
428 
429  if (!address) { /* The address is us; we should guess. */
430  if (!find_my_address(get_options(), AF_INET, LOG_WARN, &ipv4_addr,
431  NULL, &hostname)) {
432  log_warn(LD_CONFIG,
433  "Couldn't find a suitable address when adding ourself as a "
434  "trusted directory server.");
435  return NULL;
436  }
437  if (!hostname)
438  hostname = tor_addr_to_str_dup(&ipv4_addr);
439 
440  if (!hostname)
441  return NULL;
442  } else {
443  if (tor_addr_lookup(address, AF_INET, &ipv4_addr)) {
444  log_warn(LD_CONFIG,
445  "Unable to lookup address for directory server at '%s'",
446  address);
447  return NULL;
448  }
449  hostname = tor_strdup(address);
450  }
451 
452  result = dir_server_new(1, nickname, &ipv4_addr, hostname,
453  ipv4_dirport, ipv4_orport,
454  ipv6_addrport,
455  digest,
456  v3_auth_digest, type, weight);
457 
458  if (ipv4_dirport) {
459  tor_addr_port_t p;
460  memset(&p, 0, sizeof(p));
461  tor_addr_copy(&p.addr, &ipv4_addr);
462  p.port = ipv4_dirport;
464  }
465  tor_free(hostname);
466  return result;
467 }
468 
469 /**
470  * Add @a dirport as an HTTP DirPort contact point for the directory authority
471  * @a ds, for use when contacting that authority for the given @a usage.
472  *
473  * Multiple ports of the same usage are allowed; if present, then only
474  * the first one of each address family is currently used.
475  */
476 void
478  auth_dirport_usage_t usage,
479  const tor_addr_port_t *dirport)
480 {
481  tor_assert(ds);
482  tor_assert(dirport);
483 
484  if (BUG(! ds->is_authority)) {
485  return;
486  }
487 
488  if (ds->auth_dirports == NULL) {
490  }
491 
492  auth_dirport_t *port = tor_malloc_zero(sizeof(auth_dirport_t));
493  port->usage = usage;
494  tor_addr_port_copy(&port->dirport, dirport);
495  smartlist_add(ds->auth_dirports, port);
496 }
497 
498 /**
499  * Helper for trusted_dir_server_get_dirport: only return the exact requested
500  * usage type.
501  */
502 const tor_addr_port_t *
504  auth_dirport_usage_t usage,
505  int addr_family)
506 {
507  tor_assert(ds);
508  tor_assert_nonfatal(addr_family == AF_INET || addr_family == AF_INET6);
509  if (ds->auth_dirports == NULL)
510  return NULL;
511 
513  if (port->usage == usage &&
514  tor_addr_family(&port->dirport.addr) == addr_family) {
515  return &port->dirport;
516  }
517  } SMARTLIST_FOREACH_END(port);
518 
519  return NULL;
520 }
521 
522 /**
523  * Return the DirPort of the authority @a ds for with the usage type
524  * @a usage and address family @a addr_family. If none is found, try
525  * again with an AUTH_USAGE_LEGACY dirport, if there is one. Return NULL
526  * if no port can be found.
527  */
528 const tor_addr_port_t *
530  auth_dirport_usage_t usage,
531  int addr_family)
532 {
533  const tor_addr_port_t *port;
534 
535  while (1) {
536  port = trusted_dir_server_get_dirport_exact(ds, usage, addr_family);
537  if (port)
538  return port;
539 
540  // If we tried LEGACY, there is no fallback from this point.
541  if (usage == AUTH_USAGE_LEGACY)
542  return NULL;
543 
544  // Try again with LEGACY.
545  usage = AUTH_USAGE_LEGACY;
546  }
547 }
548 
549 /** Return a new dir_server_t for a fallback directory server at
550  * <b>addr</b>:<b>or_port</b>/<b>dir_port</b>, with identity key digest
551  * <b>id_digest</b> */
552 dir_server_t *
554  uint16_t ipv4_dirport, uint16_t ipv4_orport,
555  const tor_addr_port_t *addrport_ipv6,
556  const char *id_digest, double weight)
557 {
558  return dir_server_new(0, NULL, ipv4_addr, NULL, ipv4_dirport, ipv4_orport,
559  addrport_ipv6, id_digest, NULL, ALL_DIRINFO, weight);
560 }
561 
562 /** Add a directory server to the global list(s). */
563 void
565 {
566  if (!trusted_dir_servers)
570 
571  if (ent->is_authority)
573 
576 }
577 
578 #define dir_server_free(val) \
579  FREE_AND_NULL(dir_server_t, dir_server_free_, (val))
580 
581 /** Free storage held in <b>ds</b>. */
582 static void
584 {
585  if (!ds)
586  return;
587 
588  if (ds->auth_dirports) {
590  smartlist_free(ds->auth_dirports);
591  }
592  tor_free(ds->nickname);
593  tor_free(ds->description);
594  tor_free(ds->address);
595  tor_free(ds);
596 }
597 
598 /** Remove all members from the list of dir servers. */
599 void
601 {
602  if (fallback_dir_servers) {
604  dir_server_free(ent));
606  } else {
608  }
609  if (trusted_dir_servers) {
611  } else {
613  }
615 }
616 
617 void
618 dirlist_free_all(void)
619 {
621  smartlist_free(trusted_dir_servers);
622  smartlist_free(fallback_dir_servers);
624 }
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
Definition: address.c:933
void tor_addr_make_unspec(tor_addr_t *a)
Definition: address.c:225
char * tor_addr_to_str_dup(const tor_addr_t *addr)
Definition: address.c:1164
int tor_addr_is_null(const tor_addr_t *addr)
Definition: address.c:780
void tor_addr_port_copy(tor_addr_port_t *dest, const tor_addr_port_t *source)
Definition: address.c:2121
static sa_family_t tor_addr_family(const tor_addr_t *a)
Definition: address.h:187
#define tor_addr_eq(a, b)
Definition: address.h:280
int authdir_mode(const or_options_t *options)
Definition: authmode.c:25
Header file for directory authority mode.
const or_options_t * get_options(void)
Definition: config.c:919
Header file for config.c.
int control_event_networkstatus_changed_single(const routerstatus_t *rs)
Header file for control_events.c.
int tor_memeq(const void *a, const void *b, size_t sz)
Definition: di_ops.c:107
#define DIGEST_LEN
Definition: digest_sizes.h:20
Trusted/fallback directory server structure.
Header file for directory.c.
#define DIR_PURPOSE_FETCH_EXTRAINFO
Definition: directory.h:39
#define DIR_PURPOSE_FETCH_CERTIFICATE
Definition: directory.h:57
#define DIR_PURPOSE_UPLOAD_HSDESC
Definition: directory.h:67
#define DIR_PURPOSE_FETCH_MICRODESC
Definition: directory.h:65
#define DIR_PURPOSE_UPLOAD_VOTE
Definition: directory.h:43
#define DIR_PURPOSE_FETCH_DETACHED_SIGNATURES
Definition: directory.h:51
#define DIR_PURPOSE_FETCH_CONSENSUS
Definition: directory.h:54
#define DIR_PURPOSE_SERVER
Definition: directory.h:60
#define DIR_PURPOSE_FETCH_SERVERDESC
Definition: directory.h:36
#define DIR_PURPOSE_UPLOAD_SIGNATURES
Definition: directory.h:45
#define DIR_PURPOSE_FETCH_STATUS_VOTE
Definition: directory.h:48
#define DIR_PURPOSE_HAS_FETCHED_HSDESC
Definition: directory.h:72
#define DIR_PURPOSE_UPLOAD_DIR
Definition: directory.h:41
#define DIR_PURPOSE_FETCH_HSDESC
Definition: directory.h:69
bool router_addr_is_trusted_dir_type(const tor_addr_t *addr, dirinfo_type_t type)
Definition: dirlist.c:277
void trusted_dir_server_add_dirport(dir_server_t *ds, auth_dirport_usage_t usage, const tor_addr_port_t *dirport)
Definition: dirlist.c:477
void mark_all_dirservers_up(smartlist_t *server_list)
Definition: dirlist.c:232
int get_n_authorities(dirinfo_type_t type)
Definition: dirlist.c:103
dir_server_t * trusteddirserver_get_by_v3_auth_digest(const char *digest)
Definition: dirlist.c:215
void router_reset_status_download_failures(void)
Definition: dirlist.c:151
dir_server_t * router_get_trusteddirserver_by_digest(const char *digest)
Definition: dirlist.c:160
static smartlist_t * trusted_dir_servers
Definition: dirlist.c:56
const tor_addr_port_t * trusted_dir_server_get_dirport_exact(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
Definition: dirlist.c:503
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)
Definition: dirlist.c:553
int router_digest_is_trusted_dir_type(const char *digest, dirinfo_type_t type)
Definition: dirlist.c:256
void clear_dir_servers(void)
Definition: dirlist.c:600
auth_dirport_usage_t auth_dirport_usage_for_purpose(int purpose)
Definition: dirlist.c:304
const tor_addr_port_t * trusted_dir_server_get_dirport(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
Definition: dirlist.c:529
void dir_server_add(dir_server_t *ent)
Definition: dirlist.c:564
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)
Definition: dirlist.c:419
int router_digest_is_fallback_dir(const char *digest)
Definition: dirlist.c:205
void dirlist_add_trusted_dir_addresses(void)
Definition: dirlist.c:87
dir_server_t * router_get_fallback_dirserver_by_digest(const char *digest)
Definition: dirlist.c:181
static smartlist_t * fallback_dir_servers
Definition: dirlist.c:59
smartlist_t * router_get_trusted_dir_servers_mutable(void)
Definition: dirlist.c:119
static void dir_server_free_(dir_server_t *ds)
Definition: dirlist.c:583
static void add_trusted_dir_to_nodelist_addr_set(const dir_server_t *dir)
Definition: dirlist.c:64
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)
Definition: dirlist.c:338
Header file for dirlist.c.
auth_dirport_usage_t
Definition: dirlist.h:22
@ AUTH_USAGE_VOTING
Definition: dirlist.h:30
@ AUTH_USAGE_DOWNLOAD
Definition: dirlist.h:33
@ AUTH_USAGE_LEGACY
Definition: dirlist.h:25
@ AUTH_USAGE_UPLOAD
Definition: dirlist.h:28
#define LD_BUG
Definition: log.h:86
#define LD_CONFIG
Definition: log.h:68
#define LOG_WARN
Definition: log.h:53
#define tor_free(p)
Definition: malloc.h:52
routerstatus_t * router_get_mutable_consensus_status_by_id(const char *digest)
Header file for networkstatus.c.
Node information structure.
node_t * node_get_mutable_by_id(const char *identity_digest)
Definition: nodelist.c:197
void router_dir_info_changed(void)
Definition: nodelist.c:2470
void nodelist_add_addr_to_address_set(const tor_addr_t *addr, uint16_t or_port, uint16_t dir_port)
Definition: nodelist.c:525
Header file for nodelist.c.
Master header file for Tor-specific functionality.
dirinfo_type_t
Definition: or.h:785
@ V3_DIRINFO
Definition: or.h:788
Header file for policies.c.
int tor_asprintf(char **strp, const char *fmt,...)
Definition: printf.c:75
int tor_addr_lookup(const char *name, uint16_t family, tor_addr_t *addr)
Definition: resolve.c:190
Header for resolve.c.
bool find_my_address(const or_options_t *options, int family, int warn_severity, tor_addr_t *addr_out, resolved_addr_method_t *method_out, char **hostname_out)
Attempt to find our IP address that can be used as our external reachable address.
Definition: resolve_addr.c:727
Header file for resolve_addr.c.
int router_digest_is_me(const char *digest)
Definition: router.c:1739
Header file for router.c.
Header file for routerlist.c.
Header file for routerset.c.
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
void smartlist_clear(smartlist_t *sl)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
tor_addr_port_t dirport
Definition: dirlist.c:51
auth_dirport_usage_t usage
Definition: dirlist.c:49
uint16_t ipv6_orport
Definition: dir_server_st.h:33
unsigned int is_running
Definition: dir_server_st.h:39
tor_addr_t ipv6_addr
Definition: dir_server_st.h:32
routerstatus_t fake_status
Definition: dir_server_st.h:57
struct smartlist_t * auth_dirports
Definition: dir_server_st.h:55
char * address
Definition: dir_server_st.h:26
uint16_t ipv4_dirport
Definition: dir_server_st.h:30
char digest[DIGEST_LEN]
Definition: dir_server_st.h:35
unsigned int is_authority
Definition: dir_server_st.h:40
dirinfo_type_t type
Definition: dir_server_st.h:48
uint16_t ipv4_orport
Definition: dir_server_st.h:31
char v3_identity_digest[DIGEST_LEN]
Definition: dir_server_st.h:36
Definition: node_st.h:34
unsigned int is_running
Definition: node_st.h:63
uint16_t ipv6_orport
tor_addr_t ipv6_addr
time_t last_dir_503_at
char identity_digest[DIGEST_LEN]
char nickname[MAX_NICKNAME_LEN+1]
uint16_t ipv4_dirport
unsigned int is_authority
uint16_t ipv4_orport
#define MOCK_IMPL(rv, funcname, arglist)
Definition: testsupport.h:133
#define tor_assert_nonfatal_unreached()
Definition: util_bug.h:176
#define tor_assert(expr)
Definition: util_bug.h:102