Tor  0.4.6.0-alpha-dev
selftest.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-2020, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
6 
7 /**
8  * \file selftest.c
9  * \brief Relay self-testing
10  *
11  * Relays need to make sure that their own ports are reachable, and estimate
12  * their own bandwidth, before publishing.
13  */
14 
15 #include "core/or/or.h"
16 
17 #include "app/config/config.h"
18 
20 #include "core/mainloop/mainloop.h"
22 
23 #include "core/or/circuitbuild.h"
24 #include "core/or/circuitlist.h"
25 #include "core/or/circuituse.h"
26 #include "core/or/crypt_path_st.h"
27 #include "core/or/extendinfo.h"
28 #include "core/or/extend_info_st.h"
30 #include "core/or/relay.h"
31 
33 
36 
40 #include "feature/nodelist/routerlist.h" // but...
43 
45 #include "feature/relay/router.h"
46 #include "feature/relay/selftest.h"
47 
48 static bool have_orport_for_family(int family);
49 static void inform_testing_reachability(const tor_addr_t *addr,
50  uint16_t port,
51  bool is_dirport);
52 
53 /** Whether we can reach our IPv4 ORPort from the outside. */
54 static bool can_reach_or_port_ipv4 = false;
55 /** Whether we can reach our IPv6 ORPort from the outside. */
56 static bool can_reach_or_port_ipv6 = false;
57 /** Whether we can reach our DirPort from the outside. */
58 static bool can_reach_dir_port = false;
59 
60 /** Has informed_testing_reachable logged a message about testing our IPv4
61  * ORPort? */
63 /** Has informed_testing_reachable logged a message about testing our IPv6
64  * ORPort? */
66 /** Has informed_testing_reachable logged a message about testing our
67  * DirPort? */
68 static bool have_informed_testing_dir_port = false;
69 
70 /** Forget what we have learned about our reachability status. */
71 void
73 {
78 }
79 
80 /** Return 1 if we won't do reachability checks, because:
81  * - AssumeReachable is set, or
82  * - the network is disabled.
83  * Otherwise, return 0.
84  */
85 static int
87 {
88  return options->AssumeReachable ||
90 }
91 
92 /** Return 0 if we need to do an ORPort reachability check, because:
93  * - no reachability check has been done yet, or
94  * - we've initiated reachability checks, but none have succeeded.
95  * Return 1 if we don't need to do an ORPort reachability check, because:
96  * - we've seen a successful reachability check, or
97  * - AssumeReachable is set, or
98  * - the network is disabled.
99 
100  * If `family'`is AF_INET or AF_INET6, return true only when we should skip
101  * the given family's orport check (Because it's been checked, or because we
102  * aren't checking it.) If `family` is 0, return true if we can skip _all_
103  * orport checks.
104  */
105 int
107  int family)
108 {
109  tor_assert_nonfatal(family == AF_INET || family == AF_INET6 || family == 0);
110  int reach_checks_disabled = router_reachability_checks_disabled(options);
111  if (reach_checks_disabled) {
112  return true;
113  }
114 
115  // Note that we do a == 1 here, not just a boolean check. This value
116  // is also an autobool, so CFG_AUTO does not mean that we should
117  // assume IPv6 ports are reachable.
118  const bool ipv6_assume_reachable = (options->AssumeReachableIPv6 == 1);
119 
120  // Which reachability flags should we look at?
121  const bool checking_ipv4 = (family == AF_INET || family == 0);
122  const bool checking_ipv6 = (family == AF_INET6 || family == 0);
123 
124  if (checking_ipv4) {
126  return false;
127  }
128  }
129  if (checking_ipv6 && !ipv6_assume_reachable) {
131  return false;
132  }
133  }
134 
135  return true;
136 }
137 
138 /** Return 0 if we need to do a DirPort reachability check, because:
139  * - no reachability check has been done yet, or
140  * - we've initiated reachability checks, but none have succeeded.
141  * Return 1 if we don't need to do a DirPort reachability check, because:
142  * - we've seen a successful reachability check, or
143  * - there is no DirPort set, or
144  * - AssumeReachable is set, or
145  * - the network is disabled.
146  */
147 int
149 {
150  int reach_checks_disabled = router_reachability_checks_disabled(options) ||
151  !options->DirPort_set;
152  return reach_checks_disabled ||
154 }
155 
156 /** See if we currently believe our ORPort or DirPort to be
157  * unreachable. If so, return 1 else return 0.
158  */
159 static int
160 router_should_check_reachability(int test_or, int test_dir)
161 {
163  const or_options_t *options = get_options();
164 
165  if (!me)
166  return 0;
167 
168  /* Doesn't check our IPv6 address, see #34065. */
169  if (routerset_contains_router(options->ExcludeNodes, me, -1) &&
170  options->StrictNodes) {
171  /* If we've excluded ourself, and StrictNodes is set, we can't test
172  * ourself. */
173  if (test_or || test_dir) {
174 #define SELF_EXCLUDED_WARN_INTERVAL 3600
175  static ratelim_t warning_limit=RATELIM_INIT(SELF_EXCLUDED_WARN_INTERVAL);
176  log_fn_ratelim(&warning_limit, LOG_WARN, LD_CIRC,
177  "Can't perform self-tests for this relay: we have "
178  "listed ourself in ExcludeNodes, and StrictNodes is set. "
179  "We cannot learn whether we are usable, and will not "
180  "be able to advertise ourself.");
181  }
182  return 0;
183  }
184  return 1;
185 }
186 
187 /**
188  * Return true if we have configured an ORPort for the given family that
189  * we would like to advertise.
190  *
191  * Like other self-testing functions, this function looks at our most
192  * recently built descriptor.
193  **/
194 static bool
196 {
198 
199  if (!me)
200  return false;
201 
202  tor_addr_port_t ap;
203  if (router_get_orport(me, &ap, family) < 0) {
204  return false;
205  }
206  return true;
207 }
208 
209 /** Allocate and return a new extend_info_t that can be used to build
210  * a circuit to or through the router <b>r</b>, using an address from
211  * <b>family</b> (if available).
212  *
213  * Clients don't have routerinfos, so this function should only be called on a
214  * server.
215  *
216  * If the requested address is not available, returns NULL. */
217 static extend_info_t *
219 {
220  crypto_pk_t *rsa_pubkey;
221  extend_info_t *info;
222  tor_addr_port_t ap;
223 
224  if (BUG(!r)) {
225  return NULL;
226  }
227 
228  /* Relays always assume that the first hop is reachable. They ignore
229  * ReachableAddresses. */
230  tor_assert_nonfatal(router_or_conn_should_skip_reachable_address_check(
231  get_options(), 0));
232 
233  const ed25519_public_key_t *ed_id_key;
234  if (r->cache_info.signing_key_cert)
235  ed_id_key = &r->cache_info.signing_key_cert->signing_key;
236  else
237  ed_id_key = NULL;
238 
239  if (router_get_orport(r, &ap, family) < 0) {
240  /* We don't have an ORPort for the requested family. */
241  return NULL;
242  }
243  rsa_pubkey = router_get_rsa_onion_pkey(r->onion_pkey, r->onion_pkey_len);
244  info = extend_info_new(r->nickname, r->cache_info.identity_digest,
245  ed_id_key,
246  rsa_pubkey, r->onion_curve25519_pkey,
247  &ap.addr, ap.port);
248  crypto_pk_free(rsa_pubkey);
249  return info;
250 }
251 
252 /** Launch a self-testing circuit to one of our ORPorts, using an address from
253  * <b>family</b> (if available). The circuit can be used to test reachability
254  * or bandwidth. <b>me</b> is our own routerinfo.
255  *
256  * Logs an info-level status message. If <b>orport_reachable</b> is false,
257  * call it a reachability circuit. Otherwise, call it a bandwidth circuit.
258  *
259  * See router_do_reachability_checks() for details. */
260 static void
262  int family,
263  int orport_reachable)
264 {
265  extend_info_t *ei = extend_info_from_router(me, family);
266  int ipv6_flags = (family == AF_INET6 ? CIRCLAUNCH_IS_IPV6_SELFTEST : 0);
267 
268  /* If we're trying to test IPv6, but we don't have an IPv6 ORPort, ei will
269  * be NULL. */
270  if (ei) {
271  const char *family_name = fmt_af_family(family);
272  const tor_addr_port_t *ap = extend_info_get_orport(ei, family);
273  log_info(LD_CIRC, "Testing %s of my %s ORPort: %s.",
274  !orport_reachable ? "reachability" : "bandwidth",
275  family_name, fmt_addrport_ap(ap));
276 
277  inform_testing_reachability(&ap->addr, ap->port, false);
278 
282  ipv6_flags);
283  extend_info_free(ei);
284  }
285 }
286 
287 /** Launch a self-testing circuit, and ask an exit to connect to our DirPort.
288  * <b>me</b> is our own routerinfo.
289  *
290  * Relays don't advertise IPv6 DirPorts, so this function only supports IPv4.
291  *
292  * See router_do_reachability_checks() for details. */
293 static void
295 {
296  tor_addr_port_t my_dirport;
297  tor_addr_copy(&my_dirport.addr, &me->ipv4_addr);
298  my_dirport.port = me->ipv4_dirport;
299 
300  /* If there is already a pending connection, don't open another one. */
303  &my_dirport.addr, my_dirport.port,
305  /* ask myself, via tor, for my server descriptor. */
306  directory_request_t *req =
308  directory_request_set_dir_addr_port(req, &my_dirport);
310  me->cache_info.identity_digest);
311  /* ask via an anon circuit, connecting to our dirport. */
313  directory_request_set_resource(req, "authority.z");
315  directory_request_free(req);
316 
317  inform_testing_reachability(&my_dirport.addr, my_dirport.port, true);
318  }
319 }
320 
321 /** Some time has passed, or we just got new directory information.
322  * See if we currently believe our ORPort or DirPort to be
323  * unreachable. If so, launch a new test for it.
324  *
325  * For ORPort, we simply try making a circuit that ends at ourselves.
326  * Success is noticed in onionskin_answer().
327  *
328  * For DirPort, we make a connection via Tor to our DirPort and ask
329  * for our own server descriptor.
330  * Success is noticed in connection_dir_client_reached_eof().
331  */
332 void
333 router_do_reachability_checks(int test_or, int test_dir)
334 {
336  const or_options_t *options = get_options();
337  int orport_reachable_v4 =
338  router_orport_seems_reachable(options, AF_INET);
339  int orport_reachable_v6 =
340  router_orport_seems_reachable(options, AF_INET6);
341 
342  if (router_should_check_reachability(test_or, test_dir)) {
343  bool need_testing = !circuit_enough_testing_circs();
344  /* At the moment, tor relays believe that they are reachable when they
345  * receive any create cell on an inbound connection, if the address
346  * family is correct.
347  */
348  if (test_or && (!orport_reachable_v4 || need_testing)) {
349  router_do_orport_reachability_checks(me, AF_INET, orport_reachable_v4);
350  }
351  if (test_or && (!orport_reachable_v6 || need_testing)) {
352  router_do_orport_reachability_checks(me, AF_INET6, orport_reachable_v6);
353  }
354 
355  if (test_dir && !router_dirport_seems_reachable(options)) {
357  }
358  }
359 }
360 
361 /** Log a message informing the user that we are testing a port for
362  * reachability, if we have not already logged such a message.
363  *
364  * If @a is_dirport is true, then the port is a DirPort; otherwise it is an
365  * ORPort.
366  *
367  * Calls to router_reset_reachability() will reset our view of whether we have
368  * logged this message for a given port. */
369 static void
371  uint16_t port,
372  bool is_dirport)
373 {
375  return;
376 
377  bool *have_informed_ptr;
378  if (is_dirport) {
379  have_informed_ptr = &have_informed_testing_dir_port;
380  } else if (tor_addr_family(addr) == AF_INET) {
381  have_informed_ptr = &have_informed_testing_or_port_ipv4;
382  } else {
383  have_informed_ptr = &have_informed_testing_or_port_ipv6;
384  }
385 
386  if (*have_informed_ptr) {
387  /* We already told the user that we're testing this port; no need to
388  * do it again. */
389  return;
390  }
391 
392  char addr_buf[TOR_ADDRPORT_BUF_LEN];
393  strlcpy(addr_buf, fmt_addrport(addr, port), sizeof(addr_buf));
394 
395  const char *control_addr_type = is_dirport ? "DIRADDRESS" : "ORADDRESS";
396  const char *port_type = is_dirport ? "DirPort" : "ORPort";
397  const char *afname = fmt_af_family(tor_addr_family(addr));
398 
400  "CHECKING_REACHABILITY %s=%s",
401  control_addr_type, addr_buf);
402 
403  log_notice(LD_OR, "Now checking whether %s %s %s is reachable... "
404  "(this may take up to %d minutes -- look for log "
405  "messages indicating success)",
406  afname, port_type, addr_buf,
408 
409  *have_informed_ptr = true;
410 }
411 
412 /**
413  * Return true if this module knows of no reason why we shouldn't publish
414  * a server descriptor.
415  **/
416 static bool
418 {
419  return options->PublishServerDescriptor_ != NO_DIRINFO &&
421  router_all_orports_seem_reachable(options);
422 }
423 
424 /** Annotate that we found our ORPort reachable with a given address
425  * family. */
426 void
428 {
430  const or_options_t *options = get_options();
431  const char *reachable_reason = "ORPort found reachable";
432  bool *can_reach_ptr;
433  if (family == AF_INET) {
434  can_reach_ptr = &can_reach_or_port_ipv4;
435  } else if (family == AF_INET6) {
436  can_reach_ptr = &can_reach_or_port_ipv6;
437  } else {
439  return;
440  }
441  if (!*can_reach_ptr && me) {
442  tor_addr_port_t ap;
443  if (router_get_orport(me, &ap, family) < 0) {
444  return;
445  }
446  char *address = tor_strdup(fmt_addrport_ap(&ap));
447 
448  *can_reach_ptr = true;
449 
450  log_notice(LD_OR,"Self-testing indicates your ORPort %s is reachable from "
451  "the outside. Excellent.%s",
452  address,
453  ready_to_publish(options) ?
454  " Publishing server descriptor." : "");
455 
456  /* Make sure our descriptor is marked to publish the IPv6 if it is now
457  * reachable. This can change at runtime. */
458  if (family == AF_INET6) {
459  mark_my_descriptor_if_omit_ipv6_changes(reachable_reason, false);
460  } else {
461  mark_my_descriptor_dirty(reachable_reason);
462  }
463  /* This is a significant enough change to upload immediately,
464  * at least in a test network */
465  if (options->TestingTorNetwork == 1) {
467  }
469  "REACHABILITY_SUCCEEDED ORADDRESS=%s",
470  address);
471  tor_free(address);
472  }
473 }
474 
475 /** Annotate that we found our DirPort reachable. */
476 void
478 {
480  const or_options_t *options = get_options();
481 
482  if (!can_reach_dir_port && me) {
483  char *address = tor_addr_to_str_dup(&me->ipv4_addr);
484 
485  if (!address)
486  return;
487 
488  can_reach_dir_port = true;
489  log_notice(LD_DIRSERV,"Self-testing indicates your DirPort is reachable "
490  "from the outside. Excellent.%s",
491  ready_to_publish(options) ?
492  " Publishing server descriptor." : "");
493 
494  if (router_should_advertise_dirport(options, me->ipv4_dirport)) {
495  mark_my_descriptor_dirty("DirPort found reachable");
496  /* This is a significant enough change to upload immediately,
497  * at least in a test network */
498  if (options->TestingTorNetwork == 1) {
500  }
501  }
503  "REACHABILITY_SUCCEEDED DIRADDRESS=%s:%d",
504  address, me->ipv4_dirport);
505  tor_free(address);
506  }
507 }
508 
509 /** We have enough testing circuits open. Send a bunch of "drop"
510  * cells down each of them, to exercise our bandwidth.
511  *
512  * May use IPv4 and IPv6 testing circuits (if available). */
513 void
514 router_perform_bandwidth_test(int num_circs, time_t now)
515 {
516  int num_cells = (int)(get_options()->BandwidthRate * 10 /
518  int max_cells = num_cells < CIRCWINDOW_START ?
519  num_cells : CIRCWINDOW_START;
520  int cells_per_circuit = max_cells / num_circs;
521  origin_circuit_t *circ = NULL;
522 
523  log_notice(LD_OR,"Performing bandwidth self-test...done.");
524  while ((circ = circuit_get_next_by_pk_and_purpose(circ, NULL,
526  /* dump cells_per_circuit drop cells onto this circ */
527  int i = cells_per_circuit;
528  if (circ->base_.state != CIRCUIT_STATE_OPEN)
529  continue;
530  circ->base_.timestamp_dirty = now;
531  while (i-- > 0) {
532  if (relay_send_command_from_edge(0, TO_CIRCUIT(circ),
533  RELAY_COMMAND_DROP,
534  NULL, 0, circ->cpath->prev)<0) {
535  return; /* stop if error */
536  }
537  }
538  }
539 }
TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT
Definition: or.h:550
CELL_MAX_NETWORK_SIZE
#define CELL_MAX_NETWORK_SIZE
Definition: or.h:580
selftest.h
Header file for selftest.c.
net_is_disabled
int net_is_disabled(void)
Definition: netstatus.c:25
tor_free
#define tor_free(p)
Definition: malloc.h:52
routerinfo_t
Definition: routerinfo_st.h:20
tor_addr_family
static sa_family_t tor_addr_family(const tor_addr_t *a)
Definition: address.h:187
CIRCUIT_STATE_OPEN
#define CIRCUIT_STATE_OPEN
Definition: circuitlist.h:32
routerinfo.h
Header file for routerinfo.c.
or_options_t::BandwidthRate
uint64_t BandwidthRate
Definition: or_options_st.h:416
circuit_t::timestamp_dirty
time_t timestamp_dirty
Definition: circuit_st.h:187
tor_addr_t
Definition: address.h:69
directory_initiate_request
void directory_initiate_request(directory_request_t *request)
Definition: dirclient.c:1235
LOG_NOTICE
#define LOG_NOTICE
Definition: log.h:50
ready_to_publish
static bool ready_to_publish(const or_options_t *options)
Definition: selftest.c:417
netstatus.h
Header for netstatus.c.
CIRCLAUNCH_NEED_CAPACITY
#define CIRCLAUNCH_NEED_CAPACITY
Definition: circuituse.h:43
mark_my_descriptor_if_omit_ipv6_changes
void mark_my_descriptor_if_omit_ipv6_changes(const char *reason, bool omit_ipv6)
Definition: router.c:2487
CONN_TYPE_DIR
#define CONN_TYPE_DIR
Definition: connection.h:55
router_do_dirport_reachability_checks
static void router_do_dirport_reachability_checks(const routerinfo_t *me)
Definition: selftest.c:294
router.h
Header file for router.c.
or_options_t::PublishServerDescriptor_
dirinfo_type_t PublishServerDescriptor_
Definition: or_options_st.h:306
circuituse.h
Header file for circuituse.c.
router_get_my_routerinfo
const routerinfo_t * router_get_my_routerinfo(void)
Definition: router.c:1763
reschedule_descriptor_update_check
void reschedule_descriptor_update_check(void)
Definition: relay_periodic.c:358
circuit_get_next_by_pk_and_purpose
origin_circuit_t * circuit_get_next_by_pk_and_purpose(origin_circuit_t *start, const uint8_t *digest, uint8_t purpose)
Definition: circuitlist.c:1820
circuit_enough_testing_circs
int circuit_enough_testing_circs(void)
Definition: circuituse.c:1627
have_informed_testing_dir_port
static bool have_informed_testing_dir_port
Definition: selftest.c:68
inform_testing_reachability
static void inform_testing_reachability(const tor_addr_t *addr, uint16_t port, bool is_dirport)
Definition: selftest.c:370
routerinfo_t::onion_pkey_len
size_t onion_pkey_len
Definition: routerinfo_st.h:39
signed_descriptor_t::identity_digest
char identity_digest[DIGEST_LEN]
Definition: signed_descriptor_st.h:31
LD_CIRC
#define LD_CIRC
Definition: log.h:82
extend_info_new
extend_info_t * extend_info_new(const char *nickname, const char *rsa_id_digest, const ed25519_public_key_t *ed_id, crypto_pk_t *onion_key, const curve25519_public_key_t *ntor_key, const tor_addr_t *addr, uint16_t port)
Definition: extendinfo.c:33
circuitlist.h
Header file for circuitlist.c.
mainloop.h
Header file for mainloop.c.
crypt_path_st.h
Path structures for origin circuits.
DIR_PURPOSE_FETCH_SERVERDESC
#define DIR_PURPOSE_FETCH_SERVERDESC
Definition: directory.h:39
directory_request_set_directory_id_digest
void directory_request_set_directory_id_digest(directory_request_t *req, const char *digest)
Definition: dirclient.c:1004
routerinfo_t::ipv4_addr
tor_addr_t ipv4_addr
Definition: routerinfo_st.h:25
tor_addr_port_t
Definition: address.h:81
tor_assert_nonfatal_unreached
#define tor_assert_nonfatal_unreached()
Definition: util_bug.h:176
origin_circuit_t
Definition: origin_circuit_st.h:79
LD_OR
#define LD_OR
Definition: log.h:92
control_event_server_status
int control_event_server_status(int severity, const char *format,...)
Definition: control_events.c:1796
torcert.h
Header for torcert.c.
router_do_reachability_checks
void router_do_reachability_checks(int test_or, int test_dir)
Definition: selftest.c:333
directory.h
Header file for directory.c.
ed25519_public_key_t
Definition: crypto_ed25519.h:23
or_options_t::ExcludeNodes
struct routerset_t * ExcludeNodes
Definition: or_options_st.h:120
authority_cert_st.h
Authority certificate structure.
or_options_t::StrictNodes
int StrictNodes
Definition: or_options_st.h:117
router_should_check_reachability
static int router_should_check_reachability(int test_or, int test_dir)
Definition: selftest.c:160
routerlist.h
Header file for routerlist.c.
routerset.h
Header file for routerset.c.
routerinfo_st.h
Router descriptor structure.
extendinfo.h
Header for core/or/extendinfo.c.
tor_addr_to_str_dup
char * tor_addr_to_str_dup(const tor_addr_t *addr)
Definition: address.c:1164
routerset_contains_router
int routerset_contains_router(const routerset_t *set, const routerinfo_t *ri, country_t country)
Definition: routerset.c:328
router_dirport_found_reachable
void router_dirport_found_reachable(void)
Definition: selftest.c:477
directory_request_set_dir_addr_port
void directory_request_set_dir_addr_port(directory_request_t *req, const tor_addr_port_t *p)
Definition: dirclient.c:994
CIRCWINDOW_START
#define CIRCWINDOW_START
Definition: or.h:502
or_options_t::AssumeReachable
int AssumeReachable
Definition: or_options_st.h:233
control_events.h
Header file for control_events.c.
get_options
const or_options_t * get_options(void)
Definition: config.c:932
circuitbuild.h
Header file for circuitbuild.c.
fmt_addrport
const char * fmt_addrport(const tor_addr_t *addr, uint16_t port)
Definition: address.c:1199
have_informed_testing_or_port_ipv4
static bool have_informed_testing_or_port_ipv4
Definition: selftest.c:62
routerinfo_t::onion_pkey
char * onion_pkey
Definition: routerinfo_st.h:37
relay_periodic.h
Header for feature/relay/relay_periodic.c.
CIRCLAUNCH_IS_INTERNAL
#define CIRCLAUNCH_IS_INTERNAL
Definition: circuituse.h:46
directory_request_set_resource
void directory_request_set_resource(directory_request_t *req, const char *resource)
Definition: dirclient.c:1045
extend_info_st.h
Extend-info structure.
router_get_orport
int router_get_orport(const routerinfo_t *router, tor_addr_port_t *ap_out, int family)
Definition: routerinfo.c:27
TOR_ADDRPORT_BUF_LEN
#define TOR_ADDRPORT_BUF_LEN
Definition: address.h:233
signed_descriptor_t::signing_key_cert
struct tor_cert_st * signing_key_cert
Definition: signed_descriptor_st.h:39
origin_circuit_t::cpath
crypt_path_t * cpath
Definition: origin_circuit_st.h:129
relay.h
Header file for relay.c.
connection.h
Header file for connection.c.
directory_request_new
directory_request_t * directory_request_new(uint8_t dir_purpose)
Definition: dirclient.c:948
crypt_path_t::prev
struct crypt_path_t * prev
Definition: crypt_path_st.h:75
dirclient.h
Header file for dirclient.c.
log_fn_ratelim
#define log_fn_ratelim(ratelim, severity, domain, args,...)
Definition: log.h:288
crypto_pk_t
Definition: crypto_rsa_nss.c:37
or_options_t::TestingTorNetwork
int TestingTorNetwork
Definition: or_options_st.h:814
CIRCUIT_PURPOSE_TESTING
#define CIRCUIT_PURPOSE_TESTING
Definition: circuitlist.h:120
router_dirport_seems_reachable
int router_dirport_seems_reachable(const or_options_t *options)
Definition: selftest.c:148
router_do_orport_reachability_checks
static void router_do_orport_reachability_checks(const routerinfo_t *me, int family, int orport_reachable)
Definition: selftest.c:261
can_reach_dir_port
static bool can_reach_dir_port
Definition: selftest.c:58
LOG_WARN
#define LOG_WARN
Definition: log.h:53
can_reach_or_port_ipv6
static bool can_reach_or_port_ipv6
Definition: selftest.c:56
router_perform_bandwidth_test
void router_perform_bandwidth_test(int num_circs, time_t now)
Definition: selftest.c:514
extend_info_from_router
static extend_info_t * extend_info_from_router(const routerinfo_t *r, int family)
Definition: selftest.c:218
fmt_af_family
const char * fmt_af_family(sa_family_t family)
Definition: address.c:1246
have_orport_for_family
static bool have_orport_for_family(int family)
Definition: selftest.c:195
DIRIND_ANON_DIRPORT
@ DIRIND_ANON_DIRPORT
Definition: dirclient.h:43
config.h
Header file for config.c.
LD_DIRSERV
#define LD_DIRSERV
Definition: log.h:90
router_reachability_checks_disabled
static int router_reachability_checks_disabled(const or_options_t *options)
Definition: selftest.c:86
CIRCLAUNCH_IS_IPV6_SELFTEST
#define CIRCLAUNCH_IS_IPV6_SELFTEST
Definition: circuituse.h:54
extend_info_get_orport
const tor_addr_port_t * extend_info_get_orport(const extend_info_t *ei, int family)
Definition: extendinfo.c:263
TO_CIRCUIT
#define TO_CIRCUIT(x)
Definition: or.h:965
or_options_t
Definition: or_options_st.h:64
or_options_t::AssumeReachableIPv6
int AssumeReachableIPv6
Definition: or_options_st.h:238
router_reset_reachability
void router_reset_reachability(void)
Definition: selftest.c:72
routerinfo_t::nickname
char * nickname
Definition: routerinfo_st.h:22
can_reach_or_port_ipv4
static bool can_reach_or_port_ipv4
Definition: selftest.c:54
connection_get_by_type_addr_port_purpose
connection_t * connection_get_by_type_addr_port_purpose(int type, const tor_addr_t *addr, uint16_t port, int purpose)
Definition: connection.c:4763
directory_request_t
struct directory_request_t directory_request_t
Definition: dirclient.h:52
origin_circuit_st.h
Origin circuit structure.
router_should_advertise_dirport
int router_should_advertise_dirport(const or_options_t *options, uint16_t dir_port)
Definition: router.c:1323
circuit_launch_by_extend_info
origin_circuit_t * circuit_launch_by_extend_info(uint8_t purpose, extend_info_t *extend_info, int flags)
Definition: circuituse.c:2121
router_orport_found_reachable
void router_orport_found_reachable(int family)
Definition: selftest.c:427
circuit_t::state
uint8_t state
Definition: circuit_st.h:110
directory_request_set_indirection
void directory_request_set_indirection(directory_request_t *req, dir_indirection_t indirection)
Definition: dirclient.c:1032
mark_my_descriptor_dirty
void mark_my_descriptor_dirty(const char *reason)
Definition: router.c:2550
tor_addr_copy
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
Definition: address.c:933
routerinfo_t::onion_curve25519_pkey
struct curve25519_public_key_t * onion_curve25519_pkey
Definition: routerinfo_st.h:43
extend_info_t
Definition: extend_info_st.h:27
router_orport_seems_reachable
int router_orport_seems_reachable(const or_options_t *options, int family)
Definition: selftest.c:106
ratelim_t
Definition: ratelim.h:42
or.h
Master header file for Tor-specific functionality.
have_informed_testing_or_port_ipv6
static bool have_informed_testing_or_port_ipv6
Definition: selftest.c:65