104 tor_assert_nonfatal(family == AF_INET || family == AF_INET6 || family == 0);
106 if (reach_checks_disabled) {
116 const bool checking_ipv4 = (family == AF_INET || family == 0);
117 const bool checking_ipv6 = (family == AF_INET6 || family == 0);
124 if (checking_ipv6 && !ipv6_assume_reachable) {
159#define SELF_EXCLUDED_WARN_INTERVAL 3600
160 static ratelim_t warning_limit=RATELIM_INIT(SELF_EXCLUDED_WARN_INTERVAL);
162 "Can't perform self-tests for this relay: we have "
163 "listed ourself in ExcludeNodes, and StrictNodes is set. "
164 "We cannot learn whether we are usable, and will not "
165 "be able to advertise ourself.");
213 tor_assert_nonfatal(router_or_conn_should_skip_reachable_address_check(
248 int orport_reachable)
260 extend_info_free(ei);
263 log_info(
LD_CIRC,
"Testing %s of my %s ORPort: %s.",
264 !orport_reachable ?
"reachability" :
"bandwidth",
265 family_name, fmt_addrport_ap(ap));
267 if (!orport_reachable) {
278 extend_info_free(ei);
294 int orport_reachable_v4 =
296 int orport_reachable_v6 =
305 if (!orport_reachable_v4 || need_testing) {
308 if (!orport_reachable_v6 || need_testing) {
325 bool *have_informed_ptr;
332 if (*have_informed_ptr) {
339 strlcpy(addr_buf,
fmt_addrport(addr, port),
sizeof(addr_buf));
344 "CHECKING_REACHABILITY ORADDRESS=%s",
347 log_notice(
LD_OR,
"Now checking whether %s ORPort %s is reachable... "
348 "(this may take up to %d minutes -- look for log "
349 "messages indicating success)",
353 *have_informed_ptr =
true;
364 router_all_orports_seem_reachable(options);
374 const char *reachable_reason =
"ORPort found reachable";
376 if (family == AF_INET) {
378 }
else if (family == AF_INET6) {
384 if (!*can_reach_ptr && me) {
389 char *address = tor_strdup(fmt_addrport_ap(&ap));
391 *can_reach_ptr =
true;
393 log_notice(
LD_OR,
"Self-testing indicates your ORPort %s is reachable from "
394 "the outside. Excellent.%s",
397 " Publishing server descriptor." :
"");
401 if (family == AF_INET6) {
412 "REACHABILITY_SUCCEEDED ORADDRESS=%s",
429 int cells_per_circuit = max_cells / num_circs;
432 log_notice(
LD_OR,
"Performing bandwidth self-test...done.");
436 int i = cells_per_circuit;
441 if (relay_send_command_from_edge(0,
TO_CIRCUIT(circ),
const char * fmt_addrport(const tor_addr_t *addr, uint16_t port)
const char * fmt_af_family(sa_family_t family)
static sa_family_t tor_addr_family(const tor_addr_t *a)
#define TOR_ADDRPORT_BUF_LEN
Header file for directory authority mode.
Authority certificate structure.
Header file for circuitbuild.c.
origin_circuit_t * circuit_get_next_by_purpose(origin_circuit_t *start, uint8_t purpose)
Header file for circuitlist.c.
#define CIRCUIT_STATE_OPEN
#define CIRCUIT_PURPOSE_TESTING
int circuit_enough_testing_circs(void)
origin_circuit_t * circuit_launch_by_extend_info(uint8_t purpose, extend_info_t *extend_info, int flags)
Header file for circuituse.c.
#define CIRCLAUNCH_NEED_CAPACITY
#define CIRCLAUNCH_IS_IPV6_SELFTEST
#define CIRCLAUNCH_IS_INTERNAL
const or_options_t * get_options(void)
Header file for config.c.
Header file for connection.c.
int control_event_server_status(int severity, const char *format,...)
Header file for control_events.c.
Path structures for origin circuits.
Header file for dirclient.c.
Header file for directory.c.
extend_info_t * extend_info_new(const char *nickname, const char *rsa_id_digest, const ed25519_public_key_t *ed_id, const curve25519_public_key_t *ntor_key, const tor_addr_t *addr, uint16_t port, const protover_summary_flags_t *pv, bool for_exit_use)
const tor_addr_port_t * extend_info_get_orport(const extend_info_t *ei, int family)
Header for core/or/extendinfo.c.
#define log_fn_ratelim(ratelim, severity, domain, args,...)
Header file for mainloop.c.
int net_is_disabled(void)
Master header file for Tor-specific functionality.
#define CELL_MAX_NETWORK_SIZE
#define TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT
Origin circuit structure.
void reschedule_descriptor_update_check(void)
Header for feature/relay/relay_periodic.c.
void mark_my_descriptor_if_omit_ipv6_changes(const char *reason, bool omit_ipv6)
void mark_my_descriptor_dirty(const char *reason)
const routerinfo_t * router_get_my_routerinfo(void)
Header file for router.c.
int router_get_orport(const routerinfo_t *router, tor_addr_port_t *ap_out, int family)
Header file for routerinfo.c.
Router descriptor structure.
Header file for routerlist.c.
int routerset_contains_router(const routerset_t *set, const routerinfo_t *ri, country_t country)
Header file for routerset.c.
static bool can_reach_or_port_ipv6
static extend_info_t * extend_info_from_router(const routerinfo_t *r, int family)
static int router_should_check_reachability(void)
static bool ready_to_publish(const or_options_t *options)
static bool have_informed_testing_or_port_ipv4
int router_orport_seems_reachable(const or_options_t *options, int family)
static bool have_orport_for_family(int family)
static bool have_informed_testing_or_port_ipv6
static bool can_reach_or_port_ipv4
void router_do_reachability_checks(void)
void router_orport_found_reachable(int family)
void router_perform_bandwidth_test(int num_circs, time_t now)
static int router_reachability_checks_disabled(const or_options_t *options)
static void inform_testing_reachability(const tor_addr_t *addr, uint16_t port)
void router_reset_reachability(void)
int router_dirport_seems_reachable(const or_options_t *options)
static void router_do_orport_reachability_checks(const routerinfo_t *me, int family, int orport_reachable)
Header file for selftest.c.
struct crypt_path_t * prev
dirinfo_type_t PublishServerDescriptor_
struct routerset_t * ExcludeNodes
struct curve25519_public_key_t * onion_curve25519_pkey
char identity_digest[DIGEST_LEN]
struct tor_cert_st * signing_key_cert
#define tor_assert_nonfatal_unreached()