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.");
214 tor_assert_nonfatal(router_or_conn_should_skip_reachable_address_check(
232 crypto_pk_free(rsa_pubkey);
247 int orport_reachable)
257 log_info(
LD_CIRC,
"Testing %s of my %s ORPort: %s.",
258 !orport_reachable ?
"reachability" :
"bandwidth",
259 family_name, fmt_addrport_ap(ap));
261 if (!orport_reachable) {
272 extend_info_free(ei);
288 int orport_reachable_v4 =
290 int orport_reachable_v6 =
299 if (!orport_reachable_v4 || need_testing) {
302 if (!orport_reachable_v6 || need_testing) {
319 bool *have_informed_ptr;
326 if (*have_informed_ptr) {
333 strlcpy(addr_buf,
fmt_addrport(addr, port),
sizeof(addr_buf));
338 "CHECKING_REACHABILITY ORADDRESS=%s",
341 log_notice(
LD_OR,
"Now checking whether %s ORPort %s is reachable... "
342 "(this may take up to %d minutes -- look for log "
343 "messages indicating success)",
347 *have_informed_ptr =
true;
358 router_all_orports_seem_reachable(options);
368 const char *reachable_reason =
"ORPort found reachable";
370 if (family == AF_INET) {
372 }
else if (family == AF_INET6) {
378 if (!*can_reach_ptr && me) {
383 char *address = tor_strdup(fmt_addrport_ap(&ap));
385 *can_reach_ptr =
true;
387 log_notice(
LD_OR,
"Self-testing indicates your ORPort %s is reachable from "
388 "the outside. Excellent.%s",
391 " Publishing server descriptor." :
"");
395 if (family == AF_INET6) {
406 "REACHABILITY_SUCCEEDED ORADDRESS=%s",
423 int cells_per_circuit = max_cells / num_circs;
426 log_notice(
LD_OR,
"Performing bandwidth self-test...done.");
430 int i = cells_per_circuit;
435 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.
const tor_addr_port_t * extend_info_get_orport(const extend_info_t *ei, int family)
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)
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)
const routerinfo_t * router_get_my_routerinfo(void)
void mark_my_descriptor_dirty(const char *reason)
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 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)
static extend_info_t * extend_info_from_router(const routerinfo_t *r, int family)
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()