22 #define BOOTSTRAP_MSG_LEN 1024
34 { BOOTSTRAP_STATUS_UNDEF,
"undef",
"Undefined" },
35 { BOOTSTRAP_STATUS_STARTING,
"starting",
"Starting" },
39 { BOOTSTRAP_STATUS_CONN_PT,
"conn_pt",
"Connecting to pluggable transport" },
40 { BOOTSTRAP_STATUS_CONN_DONE_PT,
"conn_done_pt",
41 "Connected to pluggable transport" },
42 { BOOTSTRAP_STATUS_CONN_PROXY,
"conn_proxy",
"Connecting to proxy" },
43 { BOOTSTRAP_STATUS_CONN_DONE_PROXY,
"conn_done_proxy",
44 "Connected to proxy" },
45 { BOOTSTRAP_STATUS_CONN,
"conn",
"Connecting to a relay" },
46 { BOOTSTRAP_STATUS_CONN_DONE,
"conn_done",
"Connected to a relay" },
47 { BOOTSTRAP_STATUS_HANDSHAKE,
"handshake",
48 "Handshaking with a relay" },
49 { BOOTSTRAP_STATUS_HANDSHAKE_DONE,
"handshake_done",
50 "Handshake with a relay done" },
54 { BOOTSTRAP_STATUS_ONEHOP_CREATE,
"onehop_create",
55 "Establishing an encrypted directory connection" },
56 { BOOTSTRAP_STATUS_REQUESTING_STATUS,
"requesting_status",
57 "Asking for networkstatus consensus" },
58 { BOOTSTRAP_STATUS_LOADING_STATUS,
"loading_status",
59 "Loading networkstatus consensus" },
60 { BOOTSTRAP_STATUS_LOADING_KEYS,
"loading_keys",
61 "Loading authority key certs" },
62 { BOOTSTRAP_STATUS_REQUESTING_DESCRIPTORS,
"requesting_descriptors",
63 "Asking for relay descriptors" },
64 { BOOTSTRAP_STATUS_LOADING_DESCRIPTORS,
"loading_descriptors",
65 "Loading relay descriptors" },
66 { BOOTSTRAP_STATUS_ENOUGH_DIRINFO,
"enough_dirinfo",
67 "Loaded enough directory info to build circuits" },
71 { BOOTSTRAP_STATUS_AP_CONN_PT,
"ap_conn_pt",
72 "Connecting to pluggable transport to build circuits" },
73 { BOOTSTRAP_STATUS_AP_CONN_DONE_PT,
"ap_conn_done_pt",
74 "Connected to pluggable transport to build circuits" },
75 { BOOTSTRAP_STATUS_AP_CONN_PROXY,
"ap_conn_proxy",
76 "Connecting to proxy to build circuits" },
77 { BOOTSTRAP_STATUS_AP_CONN_DONE_PROXY,
"ap_conn_done_proxy",
78 "Connected to proxy to build circuits" },
79 { BOOTSTRAP_STATUS_AP_CONN,
"ap_conn",
80 "Connecting to a relay to build circuits" },
81 { BOOTSTRAP_STATUS_AP_CONN_DONE,
"ap_conn_done",
82 "Connected to a relay to build circuits" },
83 { BOOTSTRAP_STATUS_AP_HANDSHAKE,
"ap_handshake",
84 "Finishing handshake with a relay to build circuits" },
85 { BOOTSTRAP_STATUS_AP_HANDSHAKE_DONE,
"ap_handshake_done",
86 "Handshake finished with a relay to build circuits" },
90 { BOOTSTRAP_STATUS_CIRCUIT_CREATE,
"circuit_create",
91 "Establishing a Tor circuit" },
92 { BOOTSTRAP_STATUS_DONE,
"done",
"Done" },
94 #define N_BOOT_TO_STR (sizeof(boot_to_str_tab)/sizeof(boot_to_str_tab[0]))
100 const char **summary)
102 for (
size_t i = 0; i < N_BOOT_TO_STR; i++) {
110 *tag = *summary =
"unknown";
140 #define BOOTSTRAP_PROBLEM_THRESHOLD 10
146 #define BOOTSTRAP_PCT_INCREMENT 5
156 const char *tag, *summary;
164 "Bootstrapped %d%% (%s): %s", status, tag, summary);
166 "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\"",
167 status, tag, summary);
175 control_get_bootstrap_percent(
void)
272 const char *tag =
"", *summary =
"";
274 const char *recommendation =
"ignore";
276 char *or_id = NULL, *hostaddr = NULL;
300 recommendation =
"warn";
307 or_id = tor_strdup(
"?");
313 hostaddr = tor_strdup(
"?");
316 LD_CONTROL,
"Problem bootstrapping. Stuck at %d%% (%s): %s. (%s; %s; "
317 "count %d; recommendation %s; host %s at %s)",
318 status, tag, summary, warn, reason,
325 "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
326 "COUNT=%d RECOMMENDATION=%s HOSTID=\"%s\" HOSTADDR=\"%s\"",
368 if (reason == END_OR_CONN_REASON_NO_ROUTE)
const char * hex_str(const char *from, size_t fromlen)
const or_options_t * get_options(void)
Header file for config.c.
int any_other_active_or_conns(const or_connection_t *this_conn)
Header file for connection.c.
void connection_or_report_broken_states(int severity, int domain)
const or_connection_t * CONST_TO_OR_CONN(const connection_t *c)
Header file for connection_or.c.
Base connection structure.
static int bootstrap_percent
void control_event_bootstrap_reset(void)
#define BOOTSTRAP_MSG_LEN
char * control_event_boot_last_msg(void)
static int bootstrap_phase
static void control_event_bootstrap_core(int loglevel, bootstrap_status_t status, int progress)
static char last_sent_bootstrap_message[BOOTSTRAP_MSG_LEN]
void control_event_bootstrap_problem(const char *warn, const char *reason, const connection_t *conn, int dowarn)
void control_event_boot_dir(bootstrap_status_t status, int progress)
static const struct @14 boot_to_str_tab[]
#define BOOTSTRAP_PROBLEM_THRESHOLD
void control_event_bootstrap(bootstrap_status_t status, int progress)
#define BOOTSTRAP_PCT_INCREMENT
void control_event_boot_first_orconn(void)
static int bootstrap_first_orconn
static int bootstrap_status_to_string(bootstrap_status_t s, const char **tag, const char **summary)
static int bootstrap_dir_phase
static int notice_bootstrap_percent
void control_event_bootstrap_prob_or(const char *warn, int reason, or_connection_t *or_conn)
static int bootstrap_problems
static int bootstrap_dir_progress
int control_event_client_status(int severity, const char *format,...)
Header file for control_events.c.
int we_are_hibernating(void)
Header file for hibernate.c.
void tor_log(int severity, log_domain_mask_t domain, const char *format,...)
#define log_fn(severity, domain, args,...)
Headers for util_malloc.c.
Master header file for Tor-specific functionality.
int tor_asprintf(char **strp, const char *fmt,...)
int tor_snprintf(char *str, size_t size, const char *format,...)
const char * orconn_end_reason_to_control_string(int r)
Header file for reasons.c.
unsigned int potentially_used_for_bootstrapping
char identity_digest[DIGEST_LEN]
unsigned int have_noted_bootstrap_problem
#define MOCK_IMPL(rv, funcname, arglist)