]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
relay: Move inform_testing_rechability() to relay
authorteor <teor@torproject.org>
Tue, 17 Mar 2020 06:16:05 +0000 (16:16 +1000)
committerteor <teor@torproject.org>
Fri, 20 Mar 2020 08:05:10 +0000 (18:05 +1000)
Move inform_testing_rechability() to the relay module, and disable it
when the relay module is disabled.

Part of 33633.

src/core/or/circuitbuild.c
src/core/or/circuitbuild.h
src/feature/relay/relay_config.c
src/feature/relay/selftest.c
src/feature/relay/selftest.h

index 003b91af8df89817c1cd7ba62c4dd34c24df7f10..ea51d7b9b90cbb6abb05a65878ad113093374c28 100644 (file)
@@ -767,40 +767,6 @@ circuit_deliver_create_cell(circuit_t *circ, const create_cell_t *create_cell,
   return -1;
 }
 
-/** We've decided to start our reachability testing. If all
- * is set, log this to the user. Return 1 if we did, or 0 if
- * we chose not to log anything. */
-int
-inform_testing_reachability(void)
-{
-  char dirbuf[128];
-  char *address;
-  const routerinfo_t *me = router_get_my_routerinfo();
-  if (!me)
-    return 0;
-  address = tor_dup_ip(me->addr);
-  control_event_server_status(LOG_NOTICE,
-                              "CHECKING_REACHABILITY ORADDRESS=%s:%d",
-                              address, me->or_port);
-  if (me->dir_port) {
-    tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d",
-                 address, me->dir_port);
-    control_event_server_status(LOG_NOTICE,
-                                "CHECKING_REACHABILITY DIRADDRESS=%s:%d",
-                                address, me->dir_port);
-  }
-  log_notice(LD_OR, "Now checking whether ORPort %s:%d%s %s reachable... "
-                         "(this may take up to %d minutes -- look for log "
-                         "messages indicating success)",
-      address, me->or_port,
-      me->dir_port ? dirbuf : "",
-      me->dir_port ? "are" : "is",
-      TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT/60);
-
-  tor_free(address);
-  return 1;
-}
-
 /** Return true iff we should send a create_fast cell to start building a given
  * circuit */
 static inline int
index 48592dd346c1e4b139ecaa767798c9f06837284a..9a35c36ac5538aa926f9d49ebb9c1687f157f91a 100644 (file)
@@ -29,7 +29,6 @@ struct circuit_guard_state_t *origin_circuit_get_guard_state(
 int circuit_handle_first_hop(origin_circuit_t *circ);
 void circuit_n_chan_done(channel_t *chan, int status,
                          int close_origin_circuits);
-int inform_testing_reachability(void);
 int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
 int circuit_send_next_onion_skin(origin_circuit_t *circ);
 void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
index c8b40ae0545040929740210d5e6ab677109a941b..50cdde5dde66994325aa4391fb624ffb2dc60333 100644 (file)
@@ -29,7 +29,6 @@
 #include "core/mainloop/connection.h"
 #include "core/mainloop/cpuworker.h"
 #include "core/mainloop/mainloop.h"
-#include "core/or/circuitbuild.h"
 #include "core/or/connection_or.h"
 #include "core/or/port_cfg_st.h"
 
@@ -44,6 +43,7 @@
 #include "feature/dircache/consdiffmgr.h"
 #include "feature/relay/dns.h"
 #include "feature/relay/routermode.h"
+#include "feature/relay/selftest.h"
 
 /** Contents of most recently read DirPortFrontPage file. */
 static char *global_dirfrontpagecontents = NULL;
index 29febdee8238f76743317a5956a1f3da9fddadde..8aaf068f9c5b047c8a124e20d9953307b96b46ac 100644 (file)
@@ -213,6 +213,40 @@ router_do_reachability_checks(int test_or, int test_dir)
   }
 }
 
+/** We've decided to start our reachability testing. If all
+ * is set, log this to the user. Return 1 if we did, or 0 if
+ * we chose not to log anything. */
+int
+inform_testing_reachability(void)
+{
+  char dirbuf[128];
+  char *address;
+  const routerinfo_t *me = router_get_my_routerinfo();
+  if (!me)
+    return 0;
+  address = tor_dup_ip(me->addr);
+  control_event_server_status(LOG_NOTICE,
+                              "CHECKING_REACHABILITY ORADDRESS=%s:%d",
+                              address, me->or_port);
+  if (me->dir_port) {
+    tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d",
+                 address, me->dir_port);
+    control_event_server_status(LOG_NOTICE,
+                                "CHECKING_REACHABILITY DIRADDRESS=%s:%d",
+                                address, me->dir_port);
+  }
+  log_notice(LD_OR, "Now checking whether ORPort %s:%d%s %s reachable... "
+                         "(this may take up to %d minutes -- look for log "
+                         "messages indicating success)",
+      address, me->or_port,
+      me->dir_port ? dirbuf : "",
+      me->dir_port ? "are" : "is",
+      TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT/60);
+
+  tor_free(address);
+  return 1;
+}
+
 /** Annotate that we found our ORPort reachable. */
 void
 router_orport_found_reachable(void)
index ffe06eda6762655da1e067d918b2dce3253ab13c..f5babc95da77a7d2871a3a092564484da7c013d6 100644 (file)
@@ -20,6 +20,7 @@ int check_whether_dirport_reachable(const struct or_options_t *options);
 
 void router_do_reachability_checks(int test_or, int test_dir);
 void router_perform_bandwidth_test(int num_circs, time_t now);
+int inform_testing_reachability(void);
 
 void router_orport_found_reachable(void);
 void router_dirport_found_reachable(void);
@@ -47,6 +48,12 @@ router_perform_bandwidth_test(int num_circs, time_t now)
   (void)now;
   tor_assert_nonfatal_unreached();
 }
+static inline int
+inform_testing_reachability(void)
+{
+  tor_assert_nonfatal_unreached();
+  return 0;
+}
 
 #define router_orport_found_reachable() \
   STMT_NIL