tor  0.4.2.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/routerlist_st.h"
33 #include "feature/nodelist/vote_routerstatus_st.h"
34 
35 #include "lib/container/order.h"
36 
42 #define UPTIME_TO_GUARANTEE_STABLE (3600*24*30)
43 
45 #define MTBF_TO_GUARANTEE_STABLE (60*60*24*5)
46 
50 #define TIME_KNOWN_TO_GUARANTEE_FAMILIAR (8*24*60*60)
51 
53 #define WFU_TO_GUARANTEE_GUARD (0.98)
54 
55 /* Thresholds for server performance: set by
56  * dirserv_compute_performance_thresholds, and used by
57  * generate_v2_networkstatus */
58 
60 static uint32_t stable_uptime = 0; /* start at a safe value */
62 static double stable_mtbf = 0.0;
65 static int enough_mtbf_info = 0;
68 static double guard_wfu = 0.0;
71 static long guard_tk = 0;
73 static uint32_t fast_bandwidth_kb = 0;
80 
83 static inline long
84 real_uptime(const routerinfo_t *router, time_t now)
85 {
86  if (now < router->cache_info.published_on)
87  return router->uptime;
88  else
89  return router->uptime + (now - router->cache_info.published_on);
90 }
91 
97 static int
99  const routerinfo_t *router,
100  int need_uptime, int need_capacity)
101 {
102  if (need_uptime) {
103  if (!enough_mtbf_info) {
104  /* XXXX We should change the rule from
105  * "use uptime if we don't have mtbf data" to "don't advertise Stable on
106  * v3 if we don't have enough mtbf data." Or maybe not, since if we ever
107  * hit a point where we need to reset a lot of authorities at once,
108  * none of them would be in a position to declare Stable.
109  */
110  long uptime = real_uptime(router, now);
111  if ((unsigned)uptime < stable_uptime &&
112  (unsigned)uptime < UPTIME_TO_GUARANTEE_STABLE)
113  return 1;
114  } else {
115  double mtbf =
116  rep_hist_get_stability(router->cache_info.identity_digest, now);
117  if (mtbf < stable_mtbf &&
119  return 1;
120  }
121  }
122  if (need_capacity) {
123  uint32_t bw_kb = dirserv_get_credible_bandwidth_kb(router);
124  if (bw_kb < fast_bandwidth_kb)
125  return 1;
126  }
127  return 0;
128 }
129 
134 static int
135 router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
136 {
137  time_t cutoff = now - ROUTER_MAX_AGE_TO_PUBLISH;
138  if (ri->cache_info.published_on < cutoff) {
139  return 0;
140  }
141  if (!node->is_running || !node->is_valid || ri->is_hibernating) {
142  return 0;
143  }
144  /* Only require bandwidth capacity in non-test networks, or
145  * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */
146  if (!ri->bandwidthcapacity) {
147  if (get_options()->TestingTorNetwork) {
148  if (get_options()->TestingMinExitFlagThreshold > 0) {
149  /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is,
150  * then require bandwidthcapacity */
151  return 0;
152  }
153  } else {
154  /* If we're not in a TestingTorNetwork, then require bandwidthcapacity */
155  return 0;
156  }
157  }
158  return 1;
159 }
160 
170 static int
172  const node_t *node, time_t now)
173 {
174 
175  long uptime;
176 
177  /* If we haven't been running for at least
178  * get_options()->MinUptimeHidServDirectoryV2 seconds, we can't
179  * have accurate data telling us a relay has been up for at least
180  * that long. We also want to allow a bit of slack: Reachability
181  * tests aren't instant. If we haven't been running long enough,
182  * trust the relay. */
183 
184  if (get_uptime() >
185  get_options()->MinUptimeHidServDirectoryV2 * 1.1)
186  uptime = MIN(rep_hist_get_uptime(router->cache_info.identity_digest, now),
187  real_uptime(router, now));
188  else
189  uptime = real_uptime(router, now);
190 
191  return (router->wants_to_be_hs_dir &&
193  node->is_stable && node->is_fast &&
194  uptime >= get_options()->MinUptimeHidServDirectoryV2 &&
195  router_is_active(router, node, now));
196 }
197 
200 #define ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB 4
201 
207 static int
208 router_counts_toward_thresholds(const node_t *node, time_t now,
209  const digestmap_t *omit_as_sybil,
210  int require_mbw)
211 {
212  /* Have measured bw? */
213  int have_mbw =
215  uint64_t min_bw_kb = ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB;
216  const or_options_t *options = get_options();
217 
218  if (options->TestingTorNetwork) {
219  min_bw_kb = (int64_t)options->TestingMinExitFlagThreshold / 1000;
220  }
221 
222  return node->ri && router_is_active(node->ri, node, now) &&
223  !digestmap_get(omit_as_sybil, node->identity) &&
224  (dirserv_get_credible_bandwidth_kb(node->ri) >= min_bw_kb) &&
225  (have_mbw || !require_mbw);
226 }
227 
235 void
236 dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil)
237 {
238  int n_active, n_active_nonexit, n_familiar;
239  uint32_t *uptimes, *bandwidths_kb, *bandwidths_excluding_exits_kb;
240  long *tks;
241  double *mtbfs, *wfus;
242  const smartlist_t *nodelist;
243  time_t now = time(NULL);
244  const or_options_t *options = get_options();
245 
246  /* Require mbw? */
247  int require_mbw =
249  options->MinMeasuredBWsForAuthToIgnoreAdvertised) ? 1 : 0;
250 
251  /* initialize these all here, in case there are no routers */
252  stable_uptime = 0;
253  stable_mtbf = 0;
254  fast_bandwidth_kb = 0;
257  guard_tk = 0;
258  guard_wfu = 0;
259 
261  nodelist = nodelist_get_list();
262 
263  /* Initialize arrays that will hold values for each router. We'll
264  * sort them and use that to compute thresholds. */
265  n_active = n_active_nonexit = 0;
266  /* Uptime for every active router. */
267  uptimes = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
268  /* Bandwidth for every active router. */
269  bandwidths_kb = tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
270  /* Bandwidth for every active non-exit router. */
271  bandwidths_excluding_exits_kb =
272  tor_calloc(smartlist_len(nodelist), sizeof(uint32_t));
273  /* Weighted mean time between failure for each active router. */
274  mtbfs = tor_calloc(smartlist_len(nodelist), sizeof(double));
275  /* Time-known for each active router. */
276  tks = tor_calloc(smartlist_len(nodelist), sizeof(long));
277  /* Weighted fractional uptime for each active router. */
278  wfus = tor_calloc(smartlist_len(nodelist), sizeof(double));
279 
280  /* Now, fill in the arrays. */
281  SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
282  if (options->BridgeAuthoritativeDir &&
283  node->ri &&
284  node->ri->purpose != ROUTER_PURPOSE_BRIDGE)
285  continue;
286 
287  routerinfo_t *ri = node->ri;
288  if (ri) {
289  node->is_exit = (!router_exit_policy_rejects_all(ri) &&
291  }
292 
293  if (router_counts_toward_thresholds(node, now, omit_as_sybil,
294  require_mbw)) {
295  const char *id = node->identity;
296  uint32_t bw_kb;
297 
298  /* resolve spurious clang shallow analysis null pointer errors */
299  tor_assert(ri);
300 
301  uptimes[n_active] = (uint32_t)real_uptime(ri, now);
302  mtbfs[n_active] = rep_hist_get_stability(id, now);
303  tks [n_active] = rep_hist_get_weighted_time_known(id, now);
304  bandwidths_kb[n_active] = bw_kb = dirserv_get_credible_bandwidth_kb(ri);
305  if (!node->is_exit || node->is_bad_exit) {
306  bandwidths_excluding_exits_kb[n_active_nonexit] = bw_kb;
307  ++n_active_nonexit;
308  }
309  ++n_active;
310  }
311  } SMARTLIST_FOREACH_END(node);
312 
313  /* Now, compute thresholds. */
314  if (n_active) {
315  /* The median uptime is stable. */
316  stable_uptime = median_uint32(uptimes, n_active);
317  /* The median mtbf is stable, if we have enough mtbf info */
318  stable_mtbf = median_double(mtbfs, n_active);
319  /* The 12.5th percentile bandwidth is fast. */
320  fast_bandwidth_kb = find_nth_uint32(bandwidths_kb, n_active, n_active/8);
321  /* (Now bandwidths is sorted.) */
322  if (fast_bandwidth_kb < RELAY_REQUIRED_MIN_BANDWIDTH/(2 * 1000))
323  fast_bandwidth_kb = bandwidths_kb[n_active/4];
325  third_quartile_uint32(bandwidths_kb, n_active);
326  guard_tk = find_nth_long(tks, n_active, n_active/8);
327  }
328 
331 
332  {
333  /* We can vote on a parameter for the minimum and maximum. */
334 #define ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG 4
335  int32_t min_fast_kb, max_fast_kb, min_fast, max_fast;
336  min_fast = networkstatus_get_param(NULL, "FastFlagMinThreshold",
337  ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
338  ABSOLUTE_MIN_VALUE_FOR_FAST_FLAG,
339  INT32_MAX);
340  if (options->TestingTorNetwork) {
341  min_fast = (int32_t)options->TestingMinFastFlagThreshold;
342  }
343  max_fast = networkstatus_get_param(NULL, "FastFlagMaxThreshold",
344  INT32_MAX, min_fast, INT32_MAX);
345  min_fast_kb = min_fast / 1000;
346  max_fast_kb = max_fast / 1000;
347 
348  if (fast_bandwidth_kb < (uint32_t)min_fast_kb)
349  fast_bandwidth_kb = min_fast_kb;
350  if (fast_bandwidth_kb > (uint32_t)max_fast_kb)
351  fast_bandwidth_kb = max_fast_kb;
352  }
353  /* Protect sufficiently fast nodes from being pushed out of the set
354  * of Fast nodes. */
355  if (options->AuthDirFastGuarantee &&
356  fast_bandwidth_kb > options->AuthDirFastGuarantee/1000)
357  fast_bandwidth_kb = (uint32_t)options->AuthDirFastGuarantee/1000;
358 
359  /* Now that we have a time-known that 7/8 routers are known longer than,
360  * fill wfus with the wfu of every such "familiar" router. */
361  n_familiar = 0;
362 
363  SMARTLIST_FOREACH_BEGIN(nodelist, node_t *, node) {
364  if (router_counts_toward_thresholds(node, now,
365  omit_as_sybil, require_mbw)) {
366  routerinfo_t *ri = node->ri;
367  const char *id = ri->cache_info.identity_digest;
368  long tk = rep_hist_get_weighted_time_known(id, now);
369  if (tk < guard_tk)
370  continue;
371  wfus[n_familiar++] = rep_hist_get_weighted_fractional_uptime(id, now);
372  }
373  } SMARTLIST_FOREACH_END(node);
374  if (n_familiar)
375  guard_wfu = median_double(wfus, n_familiar);
378 
380 
381  if (n_active_nonexit) {
383  find_nth_uint32(bandwidths_excluding_exits_kb,
384  n_active_nonexit, n_active_nonexit*3/4);
385  }
386 
387  log_info(LD_DIRSERV,
388  "Cutoffs: For Stable, %lu sec uptime, %lu sec MTBF. "
389  "For Fast: %lu kilobytes/sec. "
390  "For Guard: WFU %.03f%%, time-known %lu sec, "
391  "and bandwidth %lu or %lu kilobytes/sec. "
392  "We%s have enough stability data.",
393  (unsigned long)stable_uptime,
394  (unsigned long)stable_mtbf,
395  (unsigned long)fast_bandwidth_kb,
396  guard_wfu*100,
397  (unsigned long)guard_tk,
398  (unsigned long)guard_bandwidth_including_exits_kb,
399  (unsigned long)guard_bandwidth_excluding_exits_kb,
400  enough_mtbf_info ? "" : " don't");
401 
402  tor_free(uptimes);
403  tor_free(mtbfs);
404  tor_free(bandwidths_kb);
405  tor_free(bandwidths_excluding_exits_kb);
406  tor_free(tks);
407  tor_free(wfus);
408 }
409 
410 /* Use dirserv_compute_performance_thresholds() to compute the thresholds
411  * for the status flags, specifically for bridges.
412  *
413  * This is only called by a Bridge Authority from
414  * networkstatus_getinfo_by_purpose().
415  */
416 void
417 dirserv_compute_bridge_flag_thresholds(void)
418 {
419  digestmap_t *omit_as_sybil = digestmap_new();
421  digestmap_free(omit_as_sybil, NULL);
422 }
423 
426 char *
428 {
429  char *result=NULL;
430  const int measured_threshold =
431  get_options()->MinMeasuredBWsForAuthToIgnoreAdvertised;
432  const int enough_measured_bw =
433  dirserv_get_last_n_measured_bws() > measured_threshold;
434 
435  tor_asprintf(&result,
436  "stable-uptime=%lu stable-mtbf=%lu "
437  "fast-speed=%lu "
438  "guard-wfu=%.03f%% guard-tk=%lu "
439  "guard-bw-inc-exits=%lu guard-bw-exc-exits=%lu "
440  "enough-mtbf=%d ignoring-advertised-bws=%d",
441  (unsigned long)stable_uptime,
442  (unsigned long)stable_mtbf,
443  (unsigned long)fast_bandwidth_kb*1000,
444  guard_wfu*100,
445  (unsigned long)guard_tk,
446  (unsigned long)guard_bandwidth_including_exits_kb*1000,
447  (unsigned long)guard_bandwidth_excluding_exits_kb*1000,
448  enough_mtbf_info ? 1 : 0,
449  enough_measured_bw ? 1 : 0);
450 
451  return result;
452 }
453 
454 /* DOCDOC running_long_enough_to_decide_unreachable */
455 int
456 running_long_enough_to_decide_unreachable(void)
457 {
458  return time_of_process_start
459  + get_options()->TestingAuthDirTimeToLearnReachability < approx_time();
460 }
461 
465 #define REACHABLE_TIMEOUT (45*60)
466 
470 #define HIBERNATION_PUBLICATION_SKEW (60*60)
471 
475 void
477 {
478  /*XXXX This function is a mess. Separate out the part that calculates
479  whether it's reachable and the part that tells rephist that the router was
480  unreachable.
481  */
482  int answer;
483  const or_options_t *options = get_options();
484  node_t *node = node_get_mutable_by_id(router->cache_info.identity_digest);
485  tor_assert(node);
486 
487  if (router_is_me(router)) {
488  /* We always know if we are shutting down or hibernating ourselves. */
489  answer = ! we_are_hibernating();
490  } else if (router->is_hibernating &&
491  (router->cache_info.published_on +
493  /* A hibernating router is down unless we (somehow) had contact with it
494  * since it declared itself to be hibernating. */
495  answer = 0;
496  } else if (options->AssumeReachable) {
497  /* If AssumeReachable, everybody is up unless they say they are down! */
498  answer = 1;
499  } else {
500  /* Otherwise, a router counts as up if we found all announced OR
501  ports reachable in the last REACHABLE_TIMEOUT seconds.
502 
503  XXX prop186 For now there's always one IPv4 and at most one
504  IPv6 OR port.
505 
506  If we're not on IPv6, don't consider reachability of potential
507  IPv6 OR port since that'd kill all dual stack relays until a
508  majority of the dir auths have IPv6 connectivity. */
509  answer = (now < node->last_reachable + REACHABLE_TIMEOUT &&
510  (options->AuthDirHasIPv6Connectivity != 1 ||
511  tor_addr_is_null(&router->ipv6_addr) ||
512  now < node->last_reachable6 + REACHABLE_TIMEOUT));
513  }
514 
515  if (!answer && running_long_enough_to_decide_unreachable()) {
516  /* Not considered reachable. tell rephist about that.
517 
518  Because we launch a reachability test for each router every
519  REACHABILITY_TEST_CYCLE_PERIOD seconds, then the router has probably
520  been down since at least that time after we last successfully reached
521  it.
522 
523  XXX ipv6
524  */
525  time_t when = now;
526  if (node->last_reachable &&
529  rep_hist_note_router_unreachable(router->cache_info.identity_digest, when);
530  }
531 
532  node->is_running = answer;
533 }
534 
535 /* Check <b>node</b> and <b>ri</b> on whether or not we should publish a
536  * relay's IPv6 addresses. */
537 static int
538 should_publish_node_ipv6(const node_t *node, const routerinfo_t *ri,
539  time_t now)
540 {
541  const or_options_t *options = get_options();
542 
543  return options->AuthDirHasIPv6Connectivity == 1 &&
544  !tor_addr_is_null(&ri->ipv6_addr) &&
545  ((node->last_reachable6 >= now - REACHABLE_TIMEOUT) ||
546  router_is_me(ri));
547 }
548 
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  /* Set these flags so that set_routerstatus_from_routerinfo can copy them.
566  */
567  node->is_stable = !dirserv_thinks_router_is_unreliable(now, ri, 1, 0);
568  node->is_fast = !dirserv_thinks_router_is_unreliable(now, ri, 0, 1);
569  node->is_hs_dir = dirserv_thinks_router_is_hs_dir(ri, node, now);
570 
571  set_routerstatus_from_routerinfo(rs, node, ri);
572 
573  /* Override rs->is_possible_guard. */
574  if (node->is_fast && node->is_stable &&
576  ((options->AuthDirGuardBWGuarantee &&
577  routerbw_kb >= options->AuthDirGuardBWGuarantee/1000) ||
578  routerbw_kb >= MIN(guard_bandwidth_including_exits_kb,
581  node->identity, now);
583  node->identity, now);
584  rs->is_possible_guard = (wfu >= guard_wfu && tk >= guard_tk) ? 1 : 0;
585  } else {
586  rs->is_possible_guard = 0;
587  }
588 
589  /* Override rs->is_bad_exit */
590  rs->is_bad_exit = listbadexits && node->is_bad_exit;
591 
592  /* Set rs->is_staledesc. */
593  rs->is_staledesc =
594  (ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now;
595 
596  if (! should_publish_node_ipv6(node, ri, now)) {
597  /* We're not configured as having IPv6 connectivity or the node isn't:
598  * zero its IPv6 information. */
599  tor_addr_make_null(&rs->ipv6_addr, AF_INET6);
600  rs->ipv6_orport = 0;
601  }
602 
603  if (options->TestingTorNetwork) {
605  }
606 }
607 
612 STATIC void
614 {
615  const or_options_t *options = get_options();
616 
617  tor_assert(options->TestingTorNetwork);
618 
620  rs, 0)) {
621  rs->is_exit = 1;
622  } else if (options->TestingDirAuthVoteExitIsStrict) {
623  rs->is_exit = 0;
624  }
625 
627  rs, 0)) {
628  rs->is_possible_guard = 1;
629  } else if (options->TestingDirAuthVoteGuardIsStrict) {
630  rs->is_possible_guard = 0;
631  }
632 
634  rs, 0)) {
635  rs->is_hs_dir = 1;
636  } else if (options->TestingDirAuthVoteHSDirIsStrict) {
637  rs->is_hs_dir = 0;
638  }
639 }
640 
647 void
649 {
651 
653  if (ri->purpose == ROUTER_PURPOSE_BRIDGE)
655  } SMARTLIST_FOREACH_END(ri);
656 }
#define MTBF_TO_GUARANTEE_STABLE
Definition: voteflags.c:45
time_t time_of_process_start
Definition: mainloop.c:142
static int router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
Definition: voteflags.c:135
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:1621
long rep_hist_get_uptime(const char *id, time_t when)
Definition: rephist.c:490
static double guard_wfu
Definition: voteflags.c:68
int rep_hist_have_measured_enough_stability(void)
Definition: rephist.c:543
uint64_t AuthDirGuardBWGuarantee
#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:84
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:208
routerset_t * TestingDirAuthVoteGuard
static uint32_t stable_uptime
Definition: voteflags.c:60
#define HIBERNATION_PUBLICATION_SKEW
Definition: voteflags.c:470
Header file for config.c.
static double stable_mtbf
Definition: voteflags.c:62
#define REACHABLE_TIMEOUT
Definition: voteflags.c:465
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:476
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:98
unsigned int is_stable
Definition: node_st.h:62
Header file for mainloop.c.
static int enough_mtbf_info
Definition: voteflags.c:65
static uint32_t guard_bandwidth_including_exits_kb
Definition: voteflags.c:76
unsigned int is_valid
Definition: node_st.h:59
#define ABSOLUTE_MIN_BW_VALUE_TO_CONSIDER_KB
Definition: voteflags.c:200
void dirserv_set_bridges_running(time_t now)
Definition: voteflags.c:648
double rep_hist_get_weighted_fractional_uptime(const char *id, time_t when)
Definition: rephist.c:515
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:613
int router_exit_policy_rejects_all(const routerinfo_t *router)
Definition: routerlist.c:2243
Header file for hibernate.c.
Header file for policies.c.
void dirauth_set_routerstatus_from_routerinfo(routerstatus_t *rs, node_t *node, const routerinfo_t *ri, time_t now, int listbadexits)
Definition: voteflags.c:556
tor_assert(buffer)
unsigned int is_running
Definition: node_st.h:57
#define WFU_TO_GUARANTEE_GUARD
Definition: voteflags.c:53
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_staledesc
smartlist_t * exit_policy
Definition: routerinfo_st.h:56
unsigned int is_hs_dir
Definition: node_st.h:67
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
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:236
#define TIME_KNOWN_TO_GUARANTEE_FAMILIAR
Definition: voteflags.c:50
Header for order.c.
int exit_policy_is_general_exit(smartlist_t *policy)
Definition: policies.c:2347
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.
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.
void set_routerstatus_from_routerinfo(routerstatus_t *rs, const node_t *node, const routerinfo_t *ri)
static uint32_t guard_bandwidth_excluding_exits_kb
Definition: voteflags.c:79
routerset_t * TestingDirAuthVoteHSDir
static uint32_t fast_bandwidth_kb
Definition: voteflags.c:73
uint16_t ipv6_orport
uint8_t purpose
static int dirserv_thinks_router_is_hs_dir(const routerinfo_t *router, const node_t *node, time_t now)
Definition: voteflags.c:171
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
char * dirserv_get_flag_thresholds_line(void)
Definition: voteflags.c:427
unsigned int is_bad_exit
int AuthDirHasIPv6Connectivity
uint64_t TestingMinExitFlagThreshold
routerlist_t * router_get_routerlist(void)
Definition: routerlist.c:809
#define UPTIME_TO_GUARANTEE_STABLE
Definition: voteflags.c:42
static long guard_tk
Definition: voteflags.c:71
Header file for networkstatus.c.
smartlist_t * routers
Definition: routerlist_st.h:27
Header file for routerlist.c.