28 #include "core/or/channelpadding.h"
81 #include <event2/event.h>
94 # if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
98 # define __INCLUDE_LEVEL__ 2
100 #include <systemd/sd-daemon.h>
106 void rust_log_welcome_string(
void);
122 log_notice(
LD_GENERAL,
"Received reload signal (hup). Reloading config and "
123 "resetting internal state.");
134 log_err(
LD_CONFIG,
"Reading config failed--see warnings above. "
135 "For usage, try -h.");
137 }
else if (BUG(init_rv > 0)) {
152 log_notice(
LD_GENERAL,
"Not reloading config file: the controller told "
157 msg = tor_strdup(
"Unknown error");
158 log_warn(
LD_GENERAL,
"Unable to re-set previous options: %s", msg);
166 log_info(
LD_GENERAL,
"Error reloading fingerprints. "
167 "Continuing with old list.");
190 if (new_signing_key < 0 ||
192 log_warn(
LD_OR,
"Problem reloading Ed25519 keys; still using old keys.");
208 const int *sigptr = arg;
209 const int sig = *sigptr;
224 log_notice(
LD_GENERAL,
"Catching signal TERM, exiting cleanly.");
229 log_notice(
LD_GENERAL,
"Interrupt: exiting cleanly.");
234 sd_notify(0,
"STOPPING=1");
240 log_debug(
LD_GENERAL,
"Caught SIGPIPE. Ignoring.");
250 log_debug(
LD_GENERAL,
"Caught USR2, going to loglevel debug. "
251 "Send HUP to change back.");
256 sd_notify(0,
"RELOADING=1");
259 log_warn(
LD_CONFIG,
"Restart failed (config error?). Exiting.");
264 sd_notify(0,
"READY=1");
277 case SIGCLEARDNSCACHE:
292 log_notice(
LD_GENERAL,
"Going dormant because of controller request.");
304 process_win32_console_ctrl(DWORD ctrl_type)
309 activate_signal(SIGINT);
333 time_t now = time(NULL);
335 size_t rbuf_cap, wbuf_cap, rbuf_len, wbuf_len;
342 "Conn %d (socket %d) is a %s, created %d secs ago",
345 (
int)(now - conn->timestamp_created));
348 "Conn %d: %d bytes waiting on inbuf (len %d, last read %d secs ago)",
350 (
int)connection_get_inbuf_len(conn),
352 (
int)(now - conn->timestamp_last_read_allowed));
354 "Conn %d: %d bytes waiting on outbuf "
355 "(len %d, last written %d secs ago)",i,
356 (
int)connection_get_outbuf_len(conn),
358 (
int)(now - conn->timestamp_last_write_allowed));
363 &wbuf_cap, &wbuf_len) == 0) {
365 "Conn %d: %d/%d bytes used on OpenSSL read buffer; "
366 "%d/%d bytes used on write buffer.",
367 i, (
int)rbuf_len, (
int)rbuf_cap, (
int)wbuf_len, (
int)wbuf_cap);
374 } SMARTLIST_FOREACH_END(conn);
380 "Cells processed: %"PRIu64
" padding\n"
381 " %"PRIu64
" create\n"
382 " %"PRIu64
" created\n"
384 " (%"PRIu64
" relayed)\n"
385 " (%"PRIu64
" delivered)\n"
386 " %"PRIu64
" destroy",
395 tor_log(severity,
LD_NET,
"Average packaged cell fullness: %2.3f%%",
399 tor_log(severity,
LD_NET,
"Average delivered cell fullness: %2.3f%%",
413 "Average bandwidth: %"PRIu64
"/%d = %d bytes/sec reading",
418 "Average bandwidth: %"PRIu64
"/%d = %d bytes/sec writing",
424 tor_log(severity,
LD_NET,
"--------------- Dumping memory information:");
446 } signal_handlers[] = {
448 { SIGINT, UNIX_ONLY, NULL },
451 { SIGTERM, UNIX_ONLY, NULL },
454 { SIGPIPE, UNIX_ONLY, NULL },
457 { SIGUSR1, UNIX_ONLY, NULL },
460 { SIGUSR2, UNIX_ONLY, NULL },
463 { SIGHUP, UNIX_ONLY, NULL },
466 { SIGXFSZ, UNIX_ONLY, NULL },
469 { SIGCHLD, UNIX_ONLY, NULL },
472 { SIGNEWNYM, 0, NULL },
473 { SIGCLEARDNSCACHE, 0, NULL },
474 { SIGHEARTBEAT, 0, NULL },
475 { SIGACTIVE, 0, NULL },
476 { SIGDORMANT, 0, NULL },
488 for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
495 signal_handlers[i].signal_event =
501 log_warn(
LD_BUG,
"Error from libevent when adding "
502 "event for signal %d",
505 signal_handlers[i].signal_event =
516 if (enabled) SetConsoleCtrlHandler(process_win32_console_ctrl, TRUE);
522 activate_signal(
int signal_num)
525 for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
527 event_active(signal_handlers[i].
signal_event, EV_SIGNAL, 1);
541 bool running_tor =
false;
568 parsed_cmdline_free(cmdline);
578 log_notice(
LD_GENERAL,
"Tor %s running on %s with Libevent %s, "
579 "%s %s, Zlib %s, Liblzma %s, Libzstd %s and %s %s as libc.",
595 log_notice(
LD_GENERAL,
"Tor can't help you if you use it wrong! "
596 "Learn how to be safe at "
597 "https://www.torproject.org/download/download#warning");
599 if (strstr(version,
"alpha") || strstr(version,
"beta"))
600 log_notice(
LD_GENERAL,
"This version is not a stable Tor release. "
601 "Expect more bugs than usual.");
604 log_warn(
LD_GENERAL,
"This build of Tor has been compiled with one "
605 "or more options that might make it less reliable or secure! "
613 rust_log_welcome_string();
617 tracing_log_warning();
621 log_err(
LD_CONFIG,
"Reading config failed--see warnings above.");
623 }
else if (init_rv > 0) {
642 predicted_ports_init();
646 log_warn(
LD_GENERAL,
"You are running Tor as root. You don't need to, "
647 "and you probably shouldn't.");
672 char *fname = options_get_datadir_fname(options,
"lock");
673 int already_locked = 0;
677 if (err_if_locked && already_locked) {
679 log_warn(
LD_GENERAL,
"It looks like another Tor process is running "
680 "with the same data directory. Waiting 5 seconds to see "
689 log_err(
LD_GENERAL,
"No, it's still there. Exiting.");
725 if (filename &&
tor_unlink(filename) != 0 && errno != ENOENT) {
726 log_warn(
LD_FS,
"Couldn't unlink %s: %s",
727 filename, strerror(errno));
740 const char *nickname = options->
Nickname;
741 sandbox_disable_getaddrinfo_cache();
743 bool show_rsa = !strcmp(arg,
"") || !strcmp(arg,
"rsa");
744 bool show_ed25519 = !strcmp(arg,
"ed25519");
745 if (!show_rsa && !show_ed25519) {
747 "If you give a key type, you must specify 'rsa' or 'ed25519'. Exiting.");
753 "Clients don't have long-term identity keys. Exiting.");
758 log_err(
LD_GENERAL,
"Error initializing keys; exiting.");
761 if (!(k = get_server_identity_key())) {
762 log_err(
LD_GENERAL,
"Error: missing RSA identity key.");
766 log_err(
LD_BUG,
"Error computing RSA fingerprint");
769 if (!(edkey = get_master_identity_key())) {
770 log_err(
LD_GENERAL,
"Error: missing ed25519 identity key.");
774 printf(
"%s %s\n", nickname, rsa);
779 printf(
"%s %s\n", nickname, ed25519);
799 printf(
"16:%s\n",output);
812 if (!strcmp(arg,
"short")) {
813 how = OPTIONS_DUMP_MINIMAL;
814 }
else if (!strcmp(arg,
"non-builtin")) {
816 fprintf(stderr,
"'non-builtin' is deprecated; use 'short' instead.\n");
817 how = OPTIONS_DUMP_MINIMAL;
818 }
else if (!strcmp(arg,
"full")) {
819 how = OPTIONS_DUMP_ALL;
821 fprintf(stderr,
"No valid argument to --dump-config found!\n");
822 fprintf(stderr,
"Please select 'short' or 'full'.\n");
846 gethostname(hname,
sizeof(hname));
847 tor_add_addrinfo(hname);
851 sandbox_init_filter(
void)
857 get_cachedir_fname(
"cached-status"));
860 sandbox_cfg_allow_open_filename(&cfg, tor_strdup(name))
862 #define OPENDIR(dir) \
863 sandbox_cfg_allow_opendir_dirname(&cfg, tor_strdup(dir))
865 #define OPEN_DATADIR(name) \
866 sandbox_cfg_allow_open_filename(&cfg, get_datadir_fname(name))
868 #define OPEN_DATADIR2(name, name2) \
869 sandbox_cfg_allow_open_filename(&cfg, get_datadir_fname2((name), (name2)))
871 #define OPEN_DATADIR_SUFFIX(name, suffix) do { \
872 OPEN_DATADIR(name); \
873 OPEN_DATADIR(name suffix); \
876 #define OPEN_DATADIR2_SUFFIX(name, name2, suffix) do { \
877 OPEN_DATADIR2(name, name2); \
878 OPEN_DATADIR2(name, name2 suffix); \
883 #define OPEN_KEY_DIRECTORY() \
884 OPEN(options->KeyDirectory)
885 #define OPEN_CACHEDIR(name) \
886 sandbox_cfg_allow_open_filename(&cfg, get_cachedir_fname(name))
887 #define OPEN_CACHEDIR_SUFFIX(name, suffix) do { \
888 OPEN_CACHEDIR(name); \
889 OPEN_CACHEDIR(name suffix); \
891 #define OPEN_KEYDIR(name) \
892 sandbox_cfg_allow_open_filename(&cfg, get_keydir_fname(name))
893 #define OPEN_KEYDIR_SUFFIX(name, suffix) do { \
895 OPEN_KEYDIR(name suffix); \
901 OPEN_KEY_DIRECTORY();
903 OPEN_CACHEDIR_SUFFIX(
"cached-certs",
".tmp");
904 OPEN_CACHEDIR_SUFFIX(
"cached-consensus",
".tmp");
905 OPEN_CACHEDIR_SUFFIX(
"unverified-consensus",
".tmp");
906 OPEN_CACHEDIR_SUFFIX(
"unverified-microdesc-consensus",
".tmp");
907 OPEN_CACHEDIR_SUFFIX(
"cached-microdesc-consensus",
".tmp");
908 OPEN_CACHEDIR_SUFFIX(
"cached-microdescs",
".tmp");
909 OPEN_CACHEDIR_SUFFIX(
"cached-microdescs.new",
".tmp");
910 OPEN_CACHEDIR_SUFFIX(
"cached-descriptors",
".tmp");
911 OPEN_CACHEDIR_SUFFIX(
"cached-descriptors.new",
".tmp");
912 OPEN_CACHEDIR(
"cached-descriptors.tmp.tmp");
913 OPEN_CACHEDIR_SUFFIX(
"cached-extrainfo",
".tmp");
914 OPEN_CACHEDIR_SUFFIX(
"cached-extrainfo.new",
".tmp");
915 OPEN_CACHEDIR(
"cached-extrainfo.tmp.tmp");
917 OPEN_DATADIR_SUFFIX(
"state",
".tmp");
918 OPEN_DATADIR_SUFFIX(
"sr-state",
".tmp");
919 OPEN_DATADIR_SUFFIX(
"unparseable-desc",
".tmp");
920 OPEN_DATADIR_SUFFIX(
"v3-status-votes",
".tmp");
921 OPEN_DATADIR(
"key-pinning-journal");
922 OPEN(
"/dev/srandom");
923 OPEN(
"/dev/urandom");
926 OPEN(
"/proc/meminfo");
929 OPEN_DATADIR_SUFFIX(
"networkstatus-bridges",
".tmp");
932 OPEN_DATADIR(
"approved-routers");
948 char *torrc_bck = NULL;
950 sandbox_cfg_allow_rename(&cfg, tor_strdup(
torrc_fname), torrc_bck);
951 char *torrc_tmp = NULL;
953 sandbox_cfg_allow_rename(&cfg, torrc_tmp, tor_strdup(
torrc_fname));
960 if (file_status(f) == FN_DIR) {
967 #define RENAME_SUFFIX(name, suffix) \
968 sandbox_cfg_allow_rename(&cfg, \
969 get_datadir_fname(name suffix), \
970 get_datadir_fname(name))
972 #define RENAME_SUFFIX2(prefix, name, suffix) \
973 sandbox_cfg_allow_rename(&cfg, \
974 get_datadir_fname2(prefix, name suffix), \
975 get_datadir_fname2(prefix, name))
977 #define RENAME_CACHEDIR_SUFFIX(name, suffix) \
978 sandbox_cfg_allow_rename(&cfg, \
979 get_cachedir_fname(name suffix), \
980 get_cachedir_fname(name))
982 #define RENAME_KEYDIR_SUFFIX(name, suffix) \
983 sandbox_cfg_allow_rename(&cfg, \
984 get_keydir_fname(name suffix), \
985 get_keydir_fname(name))
987 RENAME_CACHEDIR_SUFFIX(
"cached-certs",
".tmp");
988 RENAME_CACHEDIR_SUFFIX(
"cached-consensus",
".tmp");
989 RENAME_CACHEDIR_SUFFIX(
"unverified-consensus",
".tmp");
990 RENAME_CACHEDIR_SUFFIX(
"unverified-microdesc-consensus",
".tmp");
991 RENAME_CACHEDIR_SUFFIX(
"cached-microdesc-consensus",
".tmp");
992 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs",
".tmp");
993 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs",
".new");
994 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs.new",
".tmp");
995 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors",
".tmp");
996 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors",
".new");
997 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors.new",
".tmp");
998 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo",
".tmp");
999 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo",
".new");
1000 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo.new",
".tmp");
1002 RENAME_SUFFIX(
"state",
".tmp");
1003 RENAME_SUFFIX(
"sr-state",
".tmp");
1004 RENAME_SUFFIX(
"unparseable-desc",
".tmp");
1005 RENAME_SUFFIX(
"v3-status-votes",
".tmp");
1008 RENAME_SUFFIX(
"networkstatus-bridges",
".tmp");
1010 #define STAT_DATADIR(name) \
1011 sandbox_cfg_allow_stat_filename(&cfg, get_datadir_fname(name))
1013 #define STAT_CACHEDIR(name) \
1014 sandbox_cfg_allow_stat_filename(&cfg, get_cachedir_fname(name))
1016 #define STAT_DATADIR2(name, name2) \
1017 sandbox_cfg_allow_stat_filename(&cfg, get_datadir_fname2((name), (name2)))
1019 #define STAT_KEY_DIRECTORY() \
1020 sandbox_cfg_allow_stat_filename(&cfg, tor_strdup(options->KeyDirectory))
1023 STAT_DATADIR(
"lock");
1024 STAT_DATADIR(
"state");
1025 STAT_DATADIR(
"router-stability");
1027 STAT_CACHEDIR(
"cached-extrainfo.new");
1036 smartlist_free(files);
1044 char *tmp_name = NULL;
1046 sandbox_cfg_allow_rename(&cfg,
1047 tor_strdup(tmp_name), tor_strdup(file_name));
1056 smartlist_free(files);
1057 smartlist_free(dirs);
1071 if (!port->is_unix_addr)
1075 char *dirname = tor_strdup(port->unix_addr);
1080 sandbox_cfg_allow_chmod_filename(&cfg, tor_strdup(port->unix_addr));
1081 sandbox_cfg_allow_chown_filename(&cfg, tor_strdup(port->unix_addr));
1082 } SMARTLIST_FOREACH_END(port);
1092 OPEN_KEYDIR_SUFFIX(
"secret_id_key",
".tmp");
1093 OPEN_KEYDIR_SUFFIX(
"secret_onion_key",
".tmp");
1094 OPEN_KEYDIR_SUFFIX(
"secret_onion_key_ntor",
".tmp");
1095 OPEN_KEYDIR(
"secret_id_key.old");
1096 OPEN_KEYDIR(
"secret_onion_key.old");
1097 OPEN_KEYDIR(
"secret_onion_key_ntor.old");
1099 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key",
".tmp");
1100 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key_encrypted",
".tmp");
1101 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_public_key",
".tmp");
1102 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_secret_key",
".tmp");
1103 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_secret_key_encrypted",
".tmp");
1104 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_public_key",
".tmp");
1105 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_cert",
".tmp");
1107 OPEN_DATADIR2_SUFFIX(
"stats",
"bridge-stats",
".tmp");
1108 OPEN_DATADIR2_SUFFIX(
"stats",
"dirreq-stats",
".tmp");
1110 OPEN_DATADIR2_SUFFIX(
"stats",
"entry-stats",
".tmp");
1111 OPEN_DATADIR2_SUFFIX(
"stats",
"exit-stats",
".tmp");
1112 OPEN_DATADIR2_SUFFIX(
"stats",
"buffer-stats",
".tmp");
1113 OPEN_DATADIR2_SUFFIX(
"stats",
"conn-stats",
".tmp");
1114 OPEN_DATADIR2_SUFFIX(
"stats",
"hidserv-stats",
".tmp");
1115 OPEN_DATADIR2_SUFFIX(
"stats",
"hidserv-v3-stats",
".tmp");
1117 OPEN_DATADIR(
"approved-routers");
1118 OPEN_DATADIR_SUFFIX(
"fingerprint",
".tmp");
1119 OPEN_DATADIR_SUFFIX(
"fingerprint-ed25519",
".tmp");
1120 OPEN_DATADIR_SUFFIX(
"hashed-fingerprint",
".tmp");
1121 OPEN_DATADIR_SUFFIX(
"router-stability",
".tmp");
1123 OPEN(
"/etc/resolv.conf");
1125 RENAME_SUFFIX(
"fingerprint",
".tmp");
1126 RENAME_SUFFIX(
"fingerprint-ed25519",
".tmp");
1127 RENAME_KEYDIR_SUFFIX(
"secret_onion_key_ntor",
".tmp");
1129 RENAME_KEYDIR_SUFFIX(
"secret_id_key",
".tmp");
1130 RENAME_KEYDIR_SUFFIX(
"secret_id_key.old",
".tmp");
1131 RENAME_KEYDIR_SUFFIX(
"secret_onion_key",
".tmp");
1132 RENAME_KEYDIR_SUFFIX(
"secret_onion_key.old",
".tmp");
1134 RENAME_SUFFIX2(
"stats",
"bridge-stats",
".tmp");
1135 RENAME_SUFFIX2(
"stats",
"dirreq-stats",
".tmp");
1136 RENAME_SUFFIX2(
"stats",
"entry-stats",
".tmp");
1137 RENAME_SUFFIX2(
"stats",
"exit-stats",
".tmp");
1138 RENAME_SUFFIX2(
"stats",
"buffer-stats",
".tmp");
1139 RENAME_SUFFIX2(
"stats",
"conn-stats",
".tmp");
1140 RENAME_SUFFIX2(
"stats",
"hidserv-stats",
".tmp");
1141 RENAME_SUFFIX2(
"stats",
"hidserv-v3-stats",
".tmp");
1142 RENAME_SUFFIX(
"hashed-fingerprint",
".tmp");
1143 RENAME_SUFFIX(
"router-stability",
".tmp");
1145 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key",
".tmp");
1146 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key_encrypted",
".tmp");
1147 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_public_key",
".tmp");
1148 RENAME_KEYDIR_SUFFIX(
"ed25519_signing_secret_key",
".tmp");
1149 RENAME_KEYDIR_SUFFIX(
"ed25519_signing_cert",
".tmp");
1151 sandbox_cfg_allow_rename(&cfg,
1152 get_keydir_fname(
"secret_onion_key"),
1153 get_keydir_fname(
"secret_onion_key.old"));
1154 sandbox_cfg_allow_rename(&cfg,
1155 get_keydir_fname(
"secret_onion_key_ntor"),
1156 get_keydir_fname(
"secret_onion_key_ntor.old"));
1158 STAT_KEY_DIRECTORY();
1159 OPEN_DATADIR(
"stats");
1160 STAT_DATADIR(
"stats");
1161 STAT_DATADIR2(
"stats",
"dirreq-stats");
1172 run_tor_main_loop(
void)
1182 log_err(
LD_OR,
"Error initializing keys; exiting");
1195 char *fname = get_datadir_fname(
"key-pinning-journal");
1198 log_err(
LD_DIR,
"Error loading key-pinning journal: %s",strerror(errno));
1202 log_err(
LD_DIR,
"Error opening key-pinning journal: %s",strerror(errno));
1216 char *fname = get_datadir_fname(
"key-pinning-entries");
1223 "Couldn't load all cached v3 certificates. Starting anyway.");
1235 const time_t now = time(NULL);
1254 log_warn(
LD_GENERAL,
"Couldn't set up any working nameservers. "
1255 "Network not up yet? Will try again soon.");
1257 log_err(
LD_GENERAL,
"Error initializing dns subsystem; exiting. To "
1258 "retry instead, set the ServerDNSAllowBrokenResolvConf option.");
1264 const int r = sd_notify(0,
"READY=1");
1266 log_warn(
LD_GENERAL,
"Unable to send readiness to systemd: %s",
1269 log_notice(
LD_GENERAL,
"Signaled readiness to systemd");
1271 log_info(
LD_GENERAL,
"Systemd NOTIFY_SOCKET not present.");
1312 #ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
1321 char **argv = tor_calloc(argc,
sizeof(
char*));
1322 memcpy(argv, tor_cfg->
argv, tor_cfg->
argc*
sizeof(
char*));
1328 result = nt_service_parse_options(argc, argv, &done);
1335 int init_rv =
tor_init(argc, argv);
1338 result = (init_rv < 0) ? -1 : 0;
1350 log_err(
LD_BUG,
"Failed to create syscall sandbox filter");
1354 tor_make_getaddrinfo_cache_active();
1357 #ifdef HAVE_EVUTIL_SECURE_RNG_SET_URANDOM_DEVICE_FILE
1358 evutil_secure_rng_set_urandom_device_file(
1365 nt_service_set_state(SERVICE_RUNNING);
1366 result = run_tor_main_loop();
1384 printf(
"Configuration was valid\n");
1393 log_warn(
LD_BUG,
"Illegal command number %d: internal error.",
void addressmap_init(void)
void addressmap_clear_transient(void)
int trusted_dirs_reload_certs(void)
Header file for authcert.c.
int authdir_mode(const or_options_t *options)
Header file for directory authority mode.
void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen)
size_t buf_allocation(const buf_t *buf)
Header file for buffers.c.
Header for feature/stats/bwhist.c.
void channel_dumpstats(int severity)
void channel_listener_dumpstats(int severity)
Header file for channel.c.
void channelpadding_new_consensus_params(const networkstatus_t *ns)
uint64_t stats_n_padding_cells_processed
void circuit_mark_all_dirty_circs_as_unusable(void)
void circuit_dump_by_conn(connection_t *conn, int severity)
Header file for circuitlist.c.
void circpad_machines_init(void)
void circpad_new_consensus_params(const networkstatus_t *ns)
Header file for circuitpadding.c.
uint64_t stats_n_created_cells_processed
uint64_t stats_n_destroy_cells_processed
uint64_t stats_n_relay_cells_processed
uint64_t stats_n_create_cells_processed
Header file for command.c.
struct event_base * tor_libevent_get_base(void)
const char * tor_libevent_get_version_str(void)
Header for compat_libevent.c.
int tor_compress_supports_method(compress_method_t method)
void tor_compress_log_init_warnings(void)
const char * tor_compress_version_str(compress_method_t method)
const smartlist_t * get_configured_ports(void)
parsed_cmdline_t * config_parse_commandline(int argc, char **argv, int ignore_errors)
int options_init_from_torrc(int argc, char **argv)
const or_options_t * get_options(void)
static char * torrc_defaults_fname
void init_protocol_warning_severity_level(void)
static char * torrc_fname
char * options_dump(const or_options_t *options, int how_to_dump)
const char * get_torrc_fname(int defaults_fname)
int set_options(or_options_t *new_val, char **msg)
tor_cmdline_mode_t command
Header file for config.c.
#define CONFIG_BACKUP_PATTERN
int connection_is_listener(connection_t *conn)
void connection_dump_buffer_mem_stats(int severity)
void connection_bucket_init(void)
const char * connection_describe(const connection_t *conn)
Header file for connection.c.
or_connection_t * TO_OR_CONN(connection_t *c)
Header file for connection_or.c.
void consdiffmgr_enable_background_compression(void)
int consdiffmgr_register_with_sandbox(struct sandbox_cfg_elem_t **cfg)
Header for consdiffmgr.c.
Header file for control.c.
char * get_controller_cookie_file_name(void)
Header file for control_auth.c.
void control_event_bootstrap(bootstrap_status_t status, int progress)
int control_event_signal(uintptr_t signal_num)
Header file for control_events.c.
void cpuworker_log_onionskin_overhead(int severity, int onionskin_type, const char *onionskin_type_name)
void cpuworkers_rotate_keyinfo(void)
Header file for cpuworker.c.
const char * crypto_get_library_name(void)
const char * crypto_get_library_version_string(void)
Headers for crypto_init.c.
void crypto_rand(char *to, size_t n)
Common functions for using (pseudo-)random number generators.
int crypto_pk_get_fingerprint(crypto_pk_t *pk, char *fp_out, int add_space)
void secret_to_key_rfc2440(char *key_out, size_t key_out_len, const char *secret, size_t secret_len, const char *s2k_specifier)
#define S2K_RFC2440_SPECIFIER_LEN
void router_reset_status_download_failures(void)
void dump_dns_mem_usage(int severity)
char * get_ext_or_auth_cookie_file_name(void)
int tor_unlink(const char *pathname)
int accounting_record_bandwidth_usage(time_t now, or_state_t *state)
int accounting_is_enabled(const or_options_t *options)
void hibernate_begin_shutdown(void)
Header file for hibernate.c.
Header file containing denial of service defenses for the HS subsystem for all versions.
void hs_service_lists_fnames_for_sandbox(smartlist_t *file_list, smartlist_t *dir_list)
void hs_service_dump_stats(int severity)
Header file containing service data for the HS subsystem.
int keypin_load_journal(const char *fname)
int keypin_open_journal(const char *fname)
const char * tor_libc_get_name(void)
const char * tor_libc_get_version_str(void)
Header for lib/osinfo/libc.c.
tor_lockfile_t * tor_lockfile_lock(const char *filename, int blocking, int *locked_out)
void tor_lockfile_unlock(tor_lockfile_t *lockfile)
void tor_log(int severity, log_domain_mask_t domain, const char *format,...)
void switch_logs_debug(void)
int get_min_log_level(void)
void log_set_application_name(const char *name)
void tor_log_get_logfile_names(smartlist_t *out)
static tor_lockfile_t * lockfile
int tor_run_main(const tor_main_configuration_t *tor_cfg)
static int do_dump_config(void)
static int do_list_fingerprint(void)
struct event * signal_event
void release_lockfile(void)
static void do_hash_password(void)
int tor_init(int argc, char *argv[])
int try_locking(const or_options_t *options, int err_if_locked)
static void process_signal(int sig)
static void dumpstats(int severity)
static void dumpmemusage(int severity)
static void signal_callback(evutil_socket_t fd, short events, void *arg)
void tor_remove_file(const char *filename)
void handle_signals(void)
void pubsub_install(void)
void pubsub_connect(void)
uint64_t get_bytes_read(void)
void update_current_time(time_t now)
void do_signewnym(time_t now)
void initialize_mainloop_events(void)
void schedule_rescan_periodic_events(void)
void tor_shutdown_event_loop_and_exit(int exitcode)
void tor_init_connection_lists(void)
smartlist_t * get_connection_array(void)
void directory_info_has_arrived(time_t now, int from_cache, int suppress_logs)
uint64_t get_bytes_written(void)
time_t time_of_process_start
Header file for mainloop.c.
int tor_mainloop_connect_pubsub(struct pubsub_builder_t *builder)
void tor_mainloop_connect_pubsub_events(void)
int tor_mainloop_set_delivery_strategy(const char *msg_channel_name, deliv_strategy_t strategy)
Header for mainloop_pubsub.c.
void tor_free_(void *mem)
void * tor_realloc_(void *ptr, size_t size)
void * tor_malloc_(size_t size)
int net_is_disabled(void)
void set_network_participation(bool participation)
void reset_user_activity(time_t now)
void note_user_activity(time_t now)
void update_networkstatus_downloads(time_t now)
int router_reload_consensus_networkstatus(void)
Header file for networkstatus.c.
Header file for ntmain.c.
Master header file for Tor-specific functionality.
#define RELAY_PAYLOAD_SIZE
int get_parent_directory(char *fname)
Listener port configuration structure.
Header file for predict_ports.c.
int tor_asprintf(char **strp, const char *fmt,...)
int tor_snprintf(char *str, size_t size, const char *format,...)
int dirserv_load_fingerprint_file(void)
Header file for process_descs.c.
pubsub_builder_t * pubsub_builder_new(void)
Header used for constructing the OO publish-subscribe facility.
struct pubsub_builder_t pubsub_builder_t
quiet_level_t quiet_level
void add_default_log_for_quiet_level(quiet_level_t quiet)
Declare the quiet_level enumeration and global.
uint64_t stats_n_data_cells_received
void dump_cell_pool_usage(int severity)
uint64_t stats_n_relay_cells_relayed
uint64_t stats_n_data_cells_packaged
uint64_t stats_n_data_bytes_received
uint64_t stats_n_relay_cells_delivered
uint64_t stats_n_data_bytes_packaged
uint64_t rephist_total_alloc
void rep_hist_dump_stats(time_t now, int severity)
uint32_t rephist_total_num
Header file for rephist.c.
const char risky_option_list[]
Header for risky_options.c.
void router_reset_warnings(void)
int client_identity_key_is_set(void)
int load_ed_keys(const or_options_t *options, time_t now)
int log_cert_expiration(void)
int generate_ed_link_cert(const or_options_t *options, time_t now, int force)
void dump_routerlist_mem_usage(int severity)
int router_reload_router_list(void)
void routerlist_reset_warnings(void)
void router_reset_descriptor_download_failures(void)
Header file for routerlist.c.
int dir_server_mode(const or_options_t *options)
int server_mode(const or_options_t *options)
Header file for routermode.c.
void routerparse_init(void)
Header file for routerparse.c.
int sandbox_cfg_allow_open_filename(sandbox_cfg_t **cfg, char *file)
int sandbox_cfg_allow_stat_filename(sandbox_cfg_t **cfg, char *file)
int sandbox_init(sandbox_cfg_t *cfg)
sandbox_cfg_t * sandbox_cfg_new(void)
int sandbox_cfg_allow_openat_filename(sandbox_cfg_t **cfg, char *file)
Header file for sandbox.c.
struct sandbox_cfg_elem_t sandbox_cfg_t
#define sandbox_intern_string(s)
int sr_init(int save_to_disk)
This file contains ABI/API of the shared random protocol defined in proposal #250....
void tor_free_all(int postfork)
Header file for shutdown.c.
smartlist_t * smartlist_new(void)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
or_state_t * get_or_state(void)
int log_heartbeat(time_t now)
int DisableSignalHandlers
char * ServerDNSResolvConfFile
struct smartlist_t * FilesOpenedByIncludes
int BridgeAuthoritativeDir
quiet_level_t quiet_level
tor_cmdline_mode_t command
int subsystems_add_pubsub(pubsub_builder_t *builder)
int subsystems_init(void)
void timers_initialize(void)
Public C API for the Tor network service.
Internal declarations for in-process Tor API.
int tor_tls_get_buffer_sizes(tor_tls_t *tls, size_t *rbuf_capacity, size_t *rbuf_bytes, size_t *wbuf_capacity, size_t *wbuf_bytes)
const char * get_version(void)
const char * get_uname(void)
void notify_pending_waitpid_callbacks(void)
#define ED25519_BASE64_LEN