commit c5ee3d7eb8c337703498b8c41b0c286ddd3cf9b4 Author: teor teor@torproject.org Date: Thu Apr 30 15:11:50 2020 +1000
relay: Clarify reachability status check functions
This is an automated commit, generated by this command:
./scripts/maint/rename_c_identifier.py \ check_whether_orport_reachable router_skip_orport_reachability_check \ check_whether_dirport_reachable router_skip_dirport_reachability_check
It was generated with --no-verify, so it probably breaks some commit hooks. The commiter should be sure to fix them up in a subsequent commit.
Part of 33222. --- src/core/or/circuitbuild.c | 2 +- src/core/or/circuituse.c | 4 ++-- src/feature/control/control_getinfo.c | 8 ++++---- src/feature/relay/relay_periodic.c | 4 ++-- src/feature/relay/router.c | 4 ++-- src/feature/relay/selftest.c | 12 ++++++------ src/feature/relay/selftest.h | 8 ++++---- src/feature/stats/predict_ports.c | 4 ++-- 8 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c index 0381a4dc3..0d51369e7 100644 --- a/src/core/or/circuitbuild.c +++ b/src/core/or/circuitbuild.c @@ -1050,7 +1050,7 @@ circuit_build_no_more_hops(origin_circuit_t *circ) control_event_bootstrap(BOOTSTRAP_STATUS_DONE, 0); control_event_client_status(LOG_NOTICE, "CIRCUIT_ESTABLISHED"); clear_broken_connection_map(1); - if (server_mode(options) && !check_whether_orport_reachable(options)) { + if (server_mode(options) && !router_skip_orport_reachability_check(options)) { inform_testing_reachability(); router_do_reachability_checks(1, 1); } diff --git a/src/core/or/circuituse.c b/src/core/or/circuituse.c index 066d5d437..51e328133 100644 --- a/src/core/or/circuituse.c +++ b/src/core/or/circuituse.c @@ -1641,7 +1641,7 @@ static void circuit_testing_opened(origin_circuit_t *circ) { if (have_performed_bandwidth_test || - !check_whether_orport_reachable(get_options())) { + !router_skip_orport_reachability_check(get_options())) { /* either we've already done everything we want with testing circuits, * or this testing circuit became open due to a fluke, e.g. we picked * a last hop where we already had the connection open due to an @@ -1659,7 +1659,7 @@ static void circuit_testing_failed(origin_circuit_t *circ, int at_last_hop) { const or_options_t *options = get_options(); - if (server_mode(options) && check_whether_orport_reachable(options)) + if (server_mode(options) && router_skip_orport_reachability_check(options)) return;
log_info(LD_GENERAL, diff --git a/src/feature/control/control_getinfo.c b/src/feature/control/control_getinfo.c index 5dcc4b170..d80d5a73f 100644 --- a/src/feature/control/control_getinfo.c +++ b/src/feature/control/control_getinfo.c @@ -1276,15 +1276,15 @@ getinfo_helper_events(control_connection_t *control_conn, *answer = tor_strdup(directories_have_accepted_server_descriptor() ? "1" : "0"); } else if (!strcmp(question, "status/reachability-succeeded/or")) { - *answer = tor_strdup(check_whether_orport_reachable(options) ? + *answer = tor_strdup(router_skip_orport_reachability_check(options) ? "1" : "0"); } else if (!strcmp(question, "status/reachability-succeeded/dir")) { - *answer = tor_strdup(check_whether_dirport_reachable(options) ? + *answer = tor_strdup(router_skip_dirport_reachability_check(options) ? "1" : "0"); } else if (!strcmp(question, "status/reachability-succeeded")) { tor_asprintf(answer, "OR=%d DIR=%d", - check_whether_orport_reachable(options) ? 1 : 0, - check_whether_dirport_reachable(options) ? 1 : 0); + router_skip_orport_reachability_check(options) ? 1 : 0, + router_skip_dirport_reachability_check(options) ? 1 : 0); } else if (!strcmp(question, "status/bootstrap-phase")) { *answer = control_event_boot_last_msg(); } else if (!strcmpstart(question, "status/version/")) { diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c index b751323e0..c8b6a7d80 100644 --- a/src/feature/relay/relay_periodic.c +++ b/src/feature/relay/relay_periodic.c @@ -201,7 +201,7 @@ reachability_warnings_callback(time_t now, const or_options_t *options) have_completed_a_circuit()) { /* every 20 minutes, check and complain if necessary */ const routerinfo_t *me = router_get_my_routerinfo(); - if (me && !check_whether_orport_reachable(options)) { + if (me && !router_skip_orport_reachability_check(options)) { char *address = tor_dup_ip(me->addr); log_warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that " "its ORPort is reachable. Relays do not publish descriptors " @@ -214,7 +214,7 @@ reachability_warnings_callback(time_t now, const or_options_t *options) tor_free(address); }
- if (me && !check_whether_dirport_reachable(options)) { + if (me && !router_skip_dirport_reachability_check(options)) { char *address = tor_dup_ip(me->addr); log_warn(LD_CONFIG, "Your server (%s:%d) has not managed to confirm that its " diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c index 2858371af..ebe656590 100644 --- a/src/feature/relay/router.c +++ b/src/feature/relay/router.c @@ -1361,14 +1361,14 @@ decide_if_publishable_server(void) return 1; if (!router_get_advertised_or_port(options)) return 0; - if (!check_whether_orport_reachable(options)) + if (!router_skip_orport_reachability_check(options)) return 0; if (router_have_consensus_path() == CONSENSUS_PATH_INTERNAL) { /* All set: there are no exits in the consensus (maybe this is a tiny * test network), so we can't check our DirPort reachability. */ return 1; } else { - return check_whether_dirport_reachable(options); + return router_skip_dirport_reachability_check(options); } }
diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c index 0088ce019..3b938d750 100644 --- a/src/feature/relay/selftest.c +++ b/src/feature/relay/selftest.c @@ -70,7 +70,7 @@ router_reachability_checks_disabled(const or_options_t *options) * - the network is disabled. */ int -check_whether_orport_reachable(const or_options_t *options) +router_skip_orport_reachability_check(const or_options_t *options) { int reach_checks_disabled = router_reachability_checks_disabled(options); return reach_checks_disabled || @@ -87,7 +87,7 @@ check_whether_orport_reachable(const or_options_t *options) * - the network is disabled. */ int -check_whether_dirport_reachable(const or_options_t *options) +router_skip_dirport_reachability_check(const or_options_t *options) { int reach_checks_disabled = router_reachability_checks_disabled(options) || !options->DirPort_set; @@ -171,7 +171,7 @@ router_do_reachability_checks(int test_or, int test_dir) { const routerinfo_t *me = router_get_my_routerinfo(); const or_options_t *options = get_options(); - int orport_reachable = check_whether_orport_reachable(options); + int orport_reachable = router_skip_orport_reachability_check(options); tor_addr_t addr;
if (router_should_check_reachability(test_or, test_dir)) { @@ -188,7 +188,7 @@ router_do_reachability_checks(int test_or, int test_dir)
/* XXX IPv6 self testing */ tor_addr_from_ipv4h(&addr, me->addr); - if (test_dir && !check_whether_dirport_reachable(options) && + if (test_dir && !router_skip_dirport_reachability_check(options) && !connection_get_by_type_addr_port_purpose( CONN_TYPE_DIR, &addr, me->dir_port, DIR_PURPOSE_FETCH_SERVERDESC)) { @@ -258,7 +258,7 @@ router_orport_found_reachable(void) log_notice(LD_OR,"Self-testing indicates your ORPort is reachable from " "the outside. Excellent.%s", options->PublishServerDescriptor_ != NO_DIRINFO - && check_whether_dirport_reachable(options) ? + && router_skip_dirport_reachability_check(options) ? " Publishing server descriptor." : ""); can_reach_or_port = 1; mark_my_descriptor_dirty("ORPort found reachable"); @@ -285,7 +285,7 @@ router_dirport_found_reachable(void) log_notice(LD_DIRSERV,"Self-testing indicates your DirPort is reachable " "from the outside. Excellent.%s", options->PublishServerDescriptor_ != NO_DIRINFO - && check_whether_orport_reachable(options) ? + && router_skip_orport_reachability_check(options) ? " Publishing server descriptor." : ""); can_reach_dir_port = 1; if (router_should_advertise_dirport(options, me->dir_port)) { diff --git a/src/feature/relay/selftest.h b/src/feature/relay/selftest.h index f5babc95d..ce30d92a2 100644 --- a/src/feature/relay/selftest.h +++ b/src/feature/relay/selftest.h @@ -15,8 +15,8 @@ #ifdef HAVE_MODULE_RELAY
struct or_options_t; -int check_whether_orport_reachable(const struct or_options_t *options); -int check_whether_dirport_reachable(const struct or_options_t *options); +int router_skip_orport_reachability_check(const struct or_options_t *options); +int router_skip_dirport_reachability_check(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); @@ -29,9 +29,9 @@ void router_reset_reachability(void);
#else /* !defined(HAVE_MODULE_RELAY) */
-#define check_whether_orport_reachable(opts) \ +#define router_skip_orport_reachability_check(opts) \ ((void)(opts), 0) -#define check_whether_dirport_reachable(opts) \ +#define router_skip_dirport_reachability_check(opts) \ ((void)(opts), 0)
static inline void diff --git a/src/feature/stats/predict_ports.c b/src/feature/stats/predict_ports.c index d728f106a..4cb576c7c 100644 --- a/src/feature/stats/predict_ports.c +++ b/src/feature/stats/predict_ports.c @@ -270,10 +270,10 @@ rep_hist_circbuilding_dormant(time_t now)
/* see if we'll still need to build testing circuits */ if (server_mode(options) && - (!check_whether_orport_reachable(options) || + (!router_skip_orport_reachability_check(options) || !circuit_enough_testing_circs())) return 0; - if (!check_whether_dirport_reachable(options)) + if (!router_skip_dirport_reachability_check(options)) return 0;
return 1;
tor-commits@lists.torproject.org