tor  0.4.1.0-alpha-dev
voteflags.c
Go to the documentation of this file.
1 /* Copyright (c) 2001-2004, Roger Dingledine.
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2019, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
12 #define VOTEFLAGS_PRIVATE
13 #include "core/or/or.h"
15 
16 #include "app/config/config.h"
17 #include "core/mainloop/mainloop.h"
18 #include "core/or/policies.h"
19 #include "feature/dirauth/bwauth.h"
26 #include "feature/nodelist/routerset.h"
27 #include "feature/relay/router.h"
28 #include "feature/stats/rephist.h"
29 
30 #include "feature/nodelist/node_st.h"
31 #include "feature/nodelist/routerinfo_st.h"
32 #include "feature/nodelist/vote_routerstatus_st.h"
33 
34 #include "lib/container/order.h"
35 
41 #define UPTIME_TO_GUARANTEE_STABLE (3600*24*30)
42 
44 #define MTBF_TO_GUARANTEE_STABLE (60*60*24*5)
45 
49 #define TIME_KNOWN_TO_GUARANTEE_FAMILIAR (8*24*60*60)
50 
52 #define WFU_TO_GUARANTEE_GUARD (0.98)
53 
54 /* Thresholds for server performance: set by
55  * dirserv_compute_performance_thresholds, and used by
56  * generate_v2_networkstatus */
57 
59 static uint32_t stable_uptime = 0; /* start at a safe value */
61 static double stable_mtbf = 0.0;
64 static int enough_mtbf_info = 0;
67 static double guard_wfu = 0.0;
70 static long guard_tk = 0;
72 static uint32_t fast_bandwidth_kb = 0;
79 
82 static inline long
83 real_uptime(const routerinfo_t *router, time_t now)
84 {
85  if (now < router->cache_info.published_on)
86  return router->uptime;
87  else
88  return router->uptime + (now - router->cache_info.published_on);
89 }
90 
96 static int
98  const routerinfo_t *router,
99  int need_uptime, int need_capacity)
100 {
101  if (need_uptime) {
102  if (!enough_mtbf_info) {
103  /* XXXX We should change the rule from
104  * "use uptime if we don't have mtbf data" to "don't advertise Stable on
105  * v3 if we don't have enough mtbf data." Or maybe not, since if we ever
106  * hit a point where we need to reset a lot of authorities at once,
107  * none of them would be in a position to declare Stable.
108  */
109  long uptime = real_uptime(router, now);
110  if ((unsigned)uptime < stable_uptime &&
111  (unsigned)uptime < UPTIME_TO_GUARANTEE_STABLE)
112  return 1;
113  } else {
114  double mtbf =
115  rep_hist_get_stability(router->cache_info.identity_digest, now);
116  if (mtbf < stable_mtbf &&
118  return 1;
119  }
120  }
121  if (need_capacity) {
122  uint32_t bw_kb = dirserv_get_credible_bandwidth_kb(router);
123  if (bw_kb < fast_bandwidth_kb)
124  return 1;
125  }
126  return 0;
127 }
128 
133 static int
134 router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
135 {
136  time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
137  if (ri->cache_info.published_on < cutoff) {
138  return 0;
139  }
140  if (!node->is_running || !node->is_valid || ri->is_hibernating) {
141  return 0;
142  }
143  /* Only require bandwidth capacity in non-test networks, or
144  * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */
145  if (!ri->bandwidthcapacity) {
146  if (get_options()->TestingTorNetwork) {
147  if (get_options()->TestingMinExitFlagThreshold > 0) {
148  /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is,
149  * then require bandwidthcapacity */
150  return 0;
151  }
152  } else {
153  /* If we're not in a TestingTorNetwork, then require bandwidthcapacity */
154  return 0;
155  }
156  }
157  return 1;
158 }
159 
169 static int
171  const node_t *node, time_t now)
172 {
173 
174  long uptime;
175 
176  /* If we haven't been running for at least
177  * get_options()->MinUptimeHidServDirectoryV2 seconds, we can't
178  * have accurate data telling us a relay has been up for at least
179  * that long. We also want to allow a bit of slack: Reachability
180  * tests aren't instant. If we haven't been running long enough,
181  * trust the relay. */
182 
183  if (get_uptime() >
184  get_options()->MinUptimeHidServDirectoryV2 * 1.1)
185  uptime = MIN(rep_hist_get_uptime(router->cache_info.identity_digest, now),
186  real_uptime(router, now));
187  else
188  uptime = real_uptime(router, now);
189 
190  return (router->wants_to_be_hs_dir &&
192  node->is_stable && node->is_fast &&
193  uptime >= get_options()->MinUptimeHidServDirectoryV2 &&
194  router_is_active(router, node, now));
195 }
196 
199 #define ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB 4
200 
206 static int
207 router_counts_toward_thresholds(const node_t *node, time_t now,
208  const digestmap_t *omit_as_sybil,
209  int require_mbw)
210 {
211  /* Have measured bw? */
212  int have_mbw =
214  uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB;
215  const or_options_t *options = get_options();
216 
217  if (options->TestingTorNetwork) {
218  min_bw_kb = (int64_t)options->TestingMinExitFlagThreshold / 1000;
219  }
220 
221  return node->ri && router_is_active(node->ri, node, now) &&
222  !digestmap_get(omit_as_sybil, node->identity) &&
223  (dirserv_get_credible_bandwidth_kb(node->ri) >= min_bw_kb) &&
224  (have_mbw || !require_mbw);
225 }
226 
234 void
235 dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
236 {
237  int n_active, n_active_nonexit, n_familiar;
238  uint32_t *uptimes, *bandwidths_kb, *bandwidths_excluding_exits_kb;
239  long *tks;
240  double *mtbfs, *wfus;
241  smartlist_t *nodelist;
242  time_t now = time(NULL);
243  const or_options_t *options = get_options();
244 
245  /* Require mbw? */
246  int require_mbw =
248  options->MinMeasuredBWsForAuthToIgnoreAdvertised) ? 1 : 0;
249 
250  /* initialize these all here, in case there are no routers */
251  stable_uptime = 0;
252  stable_mtbf = 0;
253  fast_bandwidth_kb = 0;
256  guard_tk = 0;
257  guard_wfu = 0;
258 
260  nodelist = nodelist_get_list();
261 
262  /* Initialize arrays that will hold values for each router. We'll
263  * sort them and use that to compute thresholds. */
264  n_active = n_active_nonexit = 0;
265  /* Uptime for every active router. */
266  uptimes = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
267  /* Bandwidth for every active router. */
268  bandwidths_kb = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
269  /* Bandwidth for every active non-exit router. */
270  bandwidths_excluding_exits_kb =
271  tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
272  /* Weighted mean time between failure for each active router. */
273  mtbfs = tor_calloc(smartlist_len(nodelist), sizeof(double));
274  /* Time-known for each active router. */
275  tks = tor_calloc(smartlist_len(nodelist), sizeof(long));
276  /* Weighted fractional uptime for each active router. */
277  wfus = tor_calloc(smartlist_len(nodelist), sizeof(double));
278 
279  /* Now, fill in the arrays. */
280  SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
281  if (options->BridgeAuthoritativeDir &&
282  node->ri &&
283  node->ri->purpose != ROUTER_PURPOSE_BRIDGE)
284  continue;
285 
286  routerinfo_t *ri = node->ri;
287  if (ri) {
288  node->is_exit = (!router_exit_policy_rejects_all(ri) &&
290  }
291 
292  if (router_counts_toward_thresholds(node, now, omit_as_sybil,
293  require_mbw)) {
294  const char *id = node->identity;
295  uint32_t bw_kb;
296 
297  /* resolve spurious clang shallow analysis null pointer errors */
298  tor_assert(ri);
299 
300  uptimes[n_active] = (uint32_t)real_uptime(ri, now);
301  mtbfs[n_active] = rep_hist_get_stability(id, now);
302  tks [n_active] = rep_hist_get_weighted_time_known(id, now);
303  bandwidths_kb[n_active] = bw_kb = dirserv_get_credible_bandwidth_kb(ri);
304  if (!node->is_exit || node->is_bad_exit) {
305  bandwidths_excluding_exits_kb[n_active_nonexit] = bw_kb;
306  ++n_active_nonexit;
307  }
308  ++n_active;
309  }
310  } SMARTLIST_FOREACH_END(node);
311 
312  /* Now, compute thresholds. */
313  if (n_active) {
314  /* The median uptime is stable. */
315  stable_uptime = median_uint32(uptimes, n_active);
316  /* The median mtbf is stable, if we have enough mtbf info */
317  stable_mtbf = median_double(mtbfs, n_active);
318  /* The 12.5th percentile bandwidth is fast. */
319  fast_bandwidth_kb = find_nth_uint32(bandwidths_kb, n_active, n_active/8);
320  /* (Now bandwidths is sorted.) */
321  if (fast_bandwidth_kb < RELAY_REQUIRED_MIN_BANDWIDTH/(2 * 1000))
322  fast_bandwidth_kb = bandwidths_kb[n_active/4];
324  third_quartile_uint32(bandwidths_kb, n_active);
325  guard_tk = find_nth_long(tks, n_active, n_active/8);
326  }
327 
330 
331  {
332  /* We can vote on a parameter for the minimum and maximum. */
333 #define ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG 4
334  int32_t min_fast_kb, max_fast_kb, min_fast, max_fast;
335  min_fast = networkstatus_get_param(NULL, "FastFlagMinThreshold",
336  ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
337  ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
338  INT32_MAX);
339  if (options->TestingTorNetwork) {
340  min_fast = (int32_t)options->TestingMinFastFlagThreshold;
341  }
342  max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold",
343  INT32_MAX, min_fast, INT32_MAX);
344  min_fast_kb = min_fast / 1000;
345  max_fast_kb = max_fast / 1000;
346 
347  if (fast_bandwidth_kb < (uint32_t)min_fast_kb)
348  fast_bandwidth_kb = min_fast_kb;
349  if (fast_bandwidth_kb > (uint32_t)max_fast_kb)
350  fast_bandwidth_kb = max_fast_kb;
351  }
352  /* Protect sufficiently fast nodes from being pushed out of the set
353  * of Fast nodes. */
354  if (options->AuthDirFastGuarantee &&
355  fast_bandwidth_kb > options->AuthDirFastGuarantee/1000)
356  fast_bandwidth_kb = (uint32_t)options->AuthDirFastGuarantee/1000;
357 
358  /* Now that we have a time-known that 7/8 routers are known longer than,
359  * fill wfus with the wfu of every such "familiar" router. */
360  n_familiar = 0;
361 
362  SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
363  if (router_counts_toward_thresholds(node, now,
364  omit_as_sybil, require_mbw)) {
365  routerinfo_t *ri = node->ri;
366  const char *id = ri->cache_info.identity_digest;
367  long tk = rep_hist_get_weighted_time_known(id, now);
368  if (tk < guard_tk)
369  continue;
370  wfus[n_familiar++] = rep_hist_get_weighted_fractional_uptime(id, now);
371  }
372  } SMARTLIST_FOREACH_END(node);
373  if (n_familiar)
374  guard_wfu = median_double(wfus, n_familiar);
377 
379 
380  if (n_active_nonexit) {
382  find_nth_uint32(bandwidths_excluding_exits_kb,
383  n_active_nonexit, n_active_nonexit*3/4);
384  }
385 
386  log_info(LD_DIRSERV,
387  "Cutoffs: For Stable, %lu sec uptime, %lu sec MTBF. "
388  "For Fast: %lu kilobytes/sec. "
389  "For Guard: WFU %.03f%%, time-known %lu sec, "
390  "and bandwidth %lu or %lu kilobytes/sec. "
391  "We%s have enough stability data.",
392  (unsigned long)stable_uptime,
393  (unsigned long)stable_mtbf,
394  (unsigned long)fast_bandwidth_kb,
395  guard_wfu*100,
396  (unsigned long)guard_tk,
397  (unsigned long)guard_bandwidth_including_exits_kb,
398  (unsigned long)guard_bandwidth_excluding_exits_kb,
399  enough_mtbf_info ? "" : " don't");
400 
401  tor_free(uptimes);
402  tor_free(mtbfs);
403  tor_free(bandwidths_kb);
404  tor_free(bandwidths_excluding_exits_kb);
405  tor_free(tks);
406  tor_free(wfus);
407 }
408 
409 /* Use dirserv_compute_performance_thresholds() to compute the thresholds
410  * for the status flags, specifically for bridges.
411  *
412  * This is only called by a Bridge Authority from
413  * networkstatus_getinfo_by_purpose().
414  */
415 void
416 dirserv_compute_bridge_flag_thresholds(void)
417 {
418  digestmap_t *omit_as_sybil = digestmap_new();
420  digestmap_free(omit_as_sybil, NULL);
421 }
422 
425 char *
427 {
428  char *result=NULL;
429  const int measured_threshold =
430  get_options()->MinMeasuredBWsForAuthToIgnoreAdvertised;
431  const int enough_measured_bw =
432  dirserv_get_last_n_measured_bws() > measured_threshold;
433 
434  tor_asprintf(&result,
435  "stable-uptime=%lu stable-mtbf=%lu "
436  "fast-speed=%lu "
437  "guard-wfu=%.03f%% guard-tk=%lu "
438  "guard-bw-inc-exits=%lu guard-bw-exc-exits=%lu "
439  "enough-mtbf=%d ignoring-advertised-bws=%d",
440  (unsigned long)stable_uptime,
441  (unsigned long)stable_mtbf,
442  (unsigned long)fast_bandwidth_kb*1000,
443  guard_wfu*100,
444  (unsigned long)guard_tk,
445  (unsigned long)guard_bandwidth_including_exits_kb*1000,
446  (unsigned long)guard_bandwidth_excluding_exits_kb*1000,
447  enough_mtbf_info ? 1 : 0,
448  enough_measured_bw ? 1 : 0);
449 
450  return result;
451 }
452 
453 /* DOCDOC running_long_enough_to_decide_unreachable */
454 int
455 running_long_enough_to_decide_unreachable(void)
456 {
457  return time_of_process_start
458  + get_options()->TestingAuthDirTimeToLearnReachability < approx_time();
459 }
460 
464 #define REACHABLE_TIMEOUT (45*60)
465 
469 #define HIBERNATION_PUBLICATION_SKEW (60*60)
470 
474 void
476 {
477  /*XXXX This function is a mess. Separate out the part that calculates
478  whether it's reachable and the part that tells rephist that the router was
479  unreachable.
480  */
481  int answer;
482  const or_options_t *options = get_options();
483  node_t *node = node_get_mutable_by_id(router->cache_info.identity_digest);
484  tor_assert(node);
485 
486  if (router_is_me(router)) {
487  /* We always know if we are shutting down or hibernating ourselves. */
488  answer = ! we_are_hibernating();
489  } else if (router->is_hibernating &&
490  (router->cache_info.published_on +
492  /* A hibernating router is down unless we (somehow) had contact with it
493  * since it declared itself to be hibernating. */
494  answer = 0;
495  } else if (options->AssumeReachable) {
496  /* If AssumeReachable, everybody is up unless they say they are down! */
497  answer = 1;
498  } else {
499  /* Otherwise, a router counts as up if we found all announced OR
500  ports reachable in the last REACHABLE_TIMEOUT seconds.
501 
502  XXX prop186 For now there's always one IPv4 and at most one
503  IPv6 OR port.
504 
505  If we're not on IPv6, don't consider reachability of potential
506  IPv6 OR port since that'd kill all dual stack relays until a
507  majority of the dir auths have IPv6 connectivity. */
508  answer = (now < node->last_reachable + REACHABLE_TIMEOUT &&
509  (options->AuthDirHasIPv6Connectivity != 1 ||
510  tor_addr_is_null(&router->ipv6_addr) ||
511  now < node->last_reachable6 + REACHABLE_TIMEOUT));
512  }
513 
514  if (!answer && running_long_enough_to_decide_unreachable()) {
515  /* Not considered reachable. tell rephist about that.
516 
517  Because we launch a reachability test for each router every
518  REACHABILITY_TEST_CYCLE_PERIOD seconds, then the router has probably
519  been down since at least that time after we last successfully reached
520  it.
521 
522  XXX ipv6
523  */
524  time_t when = now;
525  if (node->last_reachable &&
528  rep_hist_note_router_unreachable(router->cache_info.identity_digest, when);
529  }
530 
531  node->is_running = answer;
532 }
533 
534 /* Check <b>node</b> and <b>ri</b> on whether or not we should publish a
535  * relay's IPv6 addresses. */
536 static int
537 should_publish_node_ipv6(const node_t *node, const routerinfo_t *ri,
538  time_t now)
539 {
540  const or_options_t *options = get_options();
541 
542  return options->AuthDirHasIPv6Connectivity == 1 &&
543  !tor_addr_is_null(&ri->ipv6_addr) &&
544  ((node->last_reachable6 >= now - REACHABLE_TIMEOUT) ||
545  router_is_me(ri));
546 }
547 
555 void
557  node_t *node,
558  const routerinfo_t *ri,
559  time_t now,
560  int listbadexits)
561 {
562  const or_options_t *options = get_options();
563  uint32_t routerbw_kb = dirserv_get_credible_bandwidth_kb(ri);
564 
565  memset(rs, 0, sizeof(routerstatus_t));
566 
567  rs->is_authority =
568  router_digest_is_trusted_dir(ri->cache_info.identity_digest);
569 
570  /* Already set by compute_performance_thresholds. */
571  rs->is_exit = node->is_exit;
572  rs->is_stable = node->is_stable =
573  !dirserv_thinks_router_is_unreliable(now, ri, 1, 0);
574  rs->is_fast = node->is_fast =
575  !dirserv_thinks_router_is_unreliable(now, ri, 0, 1);
576  rs->is_flagged_running = node->is_running; /* computed above */
577 
578  rs->is_valid = node->is_valid;
579 
580  if (node->is_fast && node->is_stable &&
582  ((options->AuthDirGuardBWGuarantee &&
583  routerbw_kb >= options->AuthDirGuardBWGuarantee/1000) ||
584  routerbw_kb >= MIN(guard_bandwidth_including_exits_kb,
587  node->identity, now);
589  node->identity, now);
590  rs->is_possible_guard = (wfu >= guard_wfu && tk >= guard_tk) ? 1 : 0;
591  } else {
592  rs->is_possible_guard = 0;
593  }
594 
595  rs->is_bad_exit = listbadexits && node->is_bad_exit;
596  rs->is_hs_dir = node->is_hs_dir =
597  dirserv_thinks_router_is_hs_dir(ri, node, now);
598 
599  rs->is_named = rs->is_unnamed = 0;
600 
601  rs->published_on = ri->cache_info.published_on;
602  memcpy(rs->identity_digest, node->identity, DIGEST_LEN);
603  memcpy(rs->descriptor_digest, ri->cache_info.signed_descriptor_digest,
604  DIGEST_LEN);
605  rs->addr = ri->addr;
606  strlcpy(rs->nickname, ri->nickname, sizeof(rs->nickname));
607  rs->or_port = ri->or_port;
608  rs->dir_port = ri->dir_port;
609  rs->is_v2_dir = ri->supports_tunnelled_dir_requests;
610 
611  rs->is_staledesc =
612  (ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now;
613 
614  if (should_publish_node_ipv6(node, ri, now)) {
615  /* We're configured as having IPv6 connectivity. There's an IPv6
616  OR port and it's reachable so copy it to the routerstatus. */
617  tor_addr_copy(&rs->ipv6_addr, &ri->ipv6_addr);
618  rs->ipv6_orport = ri->ipv6_orport;
619  } else {
620  tor_addr_make_null(&rs->ipv6_addr, AF_INET6);
621  rs->ipv6_orport = 0;
622  }
623 
624  if (options->TestingTorNetwork) {
626  }
627 }
628 
633 STATIC void
635 {
636  const or_options_t *options = get_options();
637 
638  tor_assert(options->TestingTorNetwork);
639 
641  rs, 0)) {
642  rs->is_exit = 1;
643  } else if (options->TestingDirAuthVoteExitIsStrict) {
644  rs->is_exit = 0;
645  }
646 
648  rs, 0)) {
649  rs->is_possible_guard = 1;
650  } else if (options->TestingDirAuthVoteGuardIsStrict) {
651  rs->is_possible_guard = 0;
652  }
653 
655  rs, 0)) {
656  rs->is_hs_dir = 1;
657  } else if (options->TestingDirAuthVoteHSDirIsStrict) {
658  rs->is_hs_dir = 0;
659  }
660 }
#define MTBF_TO_GUARANTEE_STABLE
Definition: voteflags.c:44
time_t time_of_process_start
Definition: mainloop.c:145
static int router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
Definition: voteflags.c:134
unsigned int is_fast
unsigned int is_valid
Definition: node_st.h:28
Header file for voteflags.c.
unsigned int is_hs_dir
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
int router_is_me(const routerinfo_t *router)
Definition: router.c:1618
long rep_hist_get_uptime(const char *id, time_t when)
Definition: rephist.c:490
static double guard_wfu
Definition: voteflags.c:67
int rep_hist_have_measured_enough_stability(void)
Definition: rephist.c:543
uint64_t AuthDirGuardBWGuarantee
char identity_digest[DIGEST_LEN]
#define REACHABILITY_TEST_CYCLE_PERIOD
Definition: reachability.h:24
Header file for nodelist.c.
void tor_addr_make_null(tor_addr_t *a, sa_family_t family)
Definition: address.c:235
static long real_uptime(const routerinfo_t *router, time_t now)
Definition: voteflags.c:83
static int router_counts_toward_thresholds(const node_t *node, time_t now, const digestmap_t *omit_as_sybil, int require_mbw)
Definition: voteflags.c:207
routerset_t * TestingDirAuthVoteGuard
static uint32_t stable_uptime
Definition: voteflags.c:59
#define HIBERNATION_PUBLICATION_SKEW
Definition: voteflags.c:469
Header file for config.c.
static double stable_mtbf
Definition: voteflags.c:61
#define REACHABLE_TIMEOUT
Definition: voteflags.c:464
char signed_descriptor_digest[DIGEST_LEN]
Header file for reachability.c.
unsigned int supports_tunnelled_dir_requests
Definition: routerinfo_st.h:83
#define tor_free(p)
Definition: malloc.h:52
void dirserv_set_router_is_running(routerinfo_t *router, time_t now)
Definition: voteflags.c:475
int dirserv_has_measured_bw(const char *node_id)
Definition: bwauth.c:157
static int dirserv_thinks_router_is_unreliable(time_t now, const routerinfo_t *router, int need_uptime, int need_capacity)
Definition: voteflags.c:97
unsigned int is_stable
Definition: node_st.h:62
Header file for mainloop.c.
static int enough_mtbf_info
Definition: voteflags.c:64
static uint32_t guard_bandwidth_including_exits_kb
Definition: voteflags.c:75
unsigned int is_valid
Definition: node_st.h:59
#define ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB
Definition: voteflags.c:199
unsigned int is_authority
double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when)
Definition: rephist.c:515
unsigned int is_exit
Definition: node_st.h:64
uint32_t dirserv_get_credible_bandwidth_kb(const routerinfo_t *ri)
Definition: bwauth.c:175
STATIC void dirserv_set_routerstatus_testing(routerstatus_t *rs)
Definition: voteflags.c:634
int router_exit_policy_rejects_all(const routerinfo_t *router)
Definition: routerlist.c:2238
Header file for hibernate.c.
Header file for policies.c.
unsigned int is_named
tor_assert(buffer)
unsigned int is_running
Definition: node_st.h:57
#define WFU_TO_GUARANTEE_GUARD
Definition: voteflags.c:52
unsigned int wants_to_be_hs_dir
Definition: routerinfo_st.h:72
int tor_asprintf(char **strp, const char *fmt,...)
Definition: printf.c:75
unsigned int is_unnamed
unsigned int is_staledesc
smartlist_t * exit_policy
Definition: routerinfo_st.h:56
unsigned int is_hs_dir
Definition: node_st.h:67
#define DIGEST_LEN
Definition: digest_sizes.h:20
uint64_t AuthDirFastGuarantee
char identity[DIGEST_LEN]
Definition: node_st.h:40
Master header file for Tor-specific functionality.
time_t last_reachable
Definition: node_st.h:93
#define LD_DIRSERV
Definition: log.h:87
Header file for bwauth.c.
long rep_hist_get_weighted_time_known(const char *id, time_t when)
Definition: rephist.c:531
Header file for rephist.c.
tor_addr_t ipv6_addr
int tor_addr_is_null(const tor_addr_t *addr)
Definition: address.c:769
routerset_t * TestingDirAuthVoteExit
char nickname[MAX_NICKNAME_LEN+1]
double rep_hist_get_stability(const char *id, time_t when)
Definition: rephist.c:503
unsigned int is_exit
int BridgeAuthoritativeDir
uint64_t TestingMinFastFlagThreshold
void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
Definition: voteflags.c:235
#define TIME_KNOWN_TO_GUARANTEE_FAMILIAR
Definition: voteflags.c:49
Header for order.c.
char descriptor_digest[DIGEST256_LEN]
int exit_policy_is_general_exit(smartlist_t *policy)
Definition: policies.c:2261
unsigned int is_possible_guard
char identity_digest[DIGEST_LEN]
int dirserv_get_last_n_measured_bws(void)
Definition: bwauth.c:53
void rep_hist_note_router_unreachable(const char *id, time_t when)
Definition: rephist.c:314
#define ROUTER_MAX_AGE_TO_PUBLISH
Definition: or.h:162
void nodelist_assert_ok(void)
Definition: nodelist.c:851
Header file for router.c.
char * nickname
Definition: routerinfo_st.h:17
unsigned int is_stable
uint16_t dir_port
Definition: routerinfo_st.h:21
time_t approx_time(void)
Definition: approx_time.c:32
int MinMeasuredBWsForAuthToIgnoreAdvertised
uint32_t bandwidthcapacity
Definition: routerinfo_st.h:55
Header file for dirlist.c.
uint32_t addr
Definition: routerinfo_st.h:19
static uint32_t guard_bandwidth_excluding_exits_kb
Definition: voteflags.c:78
routerset_t * TestingDirAuthVoteHSDir
static uint32_t fast_bandwidth_kb
Definition: voteflags.c:72
uint16_t ipv6_orport
static int dirserv_thinks_router_is_hs_dir(const routerinfo_t *router, const node_t *node, time_t now)
Definition: voteflags.c:170
unsigned int is_flagged_running
unsigned int is_hibernating
Definition: routerinfo_st.h:65
unsigned int is_bad_exit
Definition: node_st.h:65
int routerset_contains_routerstatus(const routerset_t *set, const routerstatus_t *rs, country_t country)
Definition: routerset.c:318
tor_addr_t ipv6_addr
Definition: routerinfo_st.h:27
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
Definition: address.c:903
char * dirserv_get_flag_thresholds_line(void)
Definition: voteflags.c:426
void set_routerstatus_from_routerinfo(routerstatus_t *rs, node_t *node, const routerinfo_t *ri, time_t now, int listbadexits)
Definition: voteflags.c:556
unsigned int is_bad_exit
int AuthDirHasIPv6Connectivity
uint64_t TestingMinExitFlagThreshold
#define UPTIME_TO_GUARANTEE_STABLE
Definition: voteflags.c:41
static long guard_tk
Definition: voteflags.c:70
Header file for networkstatus.c.
Header file for routerlist.c.
uint16_t or_port
Definition: routerinfo_st.h:20