28#include "core/or/channelpadding.h"
83#include <event2/event.h>
96# if defined(__COVERITY__) && !defined(__INCLUDE_LEVEL__)
100# define __INCLUDE_LEVEL__ 2
102#include <systemd/sd-daemon.h>
118 log_notice(
LD_GENERAL,
"Received reload signal (hup). Reloading config and "
119 "resetting internal state.");
130 log_err(
LD_CONFIG,
"Reading config failed--see warnings above. "
131 "For usage, try -h.");
133 }
else if (BUG(init_rv > 0)) {
148 log_notice(
LD_GENERAL,
"Not reloading config file: the controller told "
153 msg = tor_strdup(
"Unknown error");
154 log_warn(
LD_GENERAL,
"Unable to re-set previous options: %s", msg);
162 log_info(
LD_GENERAL,
"Error reloading fingerprints. "
163 "Continuing with old list.");
186 if (new_signing_key < 0 ||
188 log_warn(
LD_OR,
"Problem reloading Ed25519 keys; still using old keys.");
204 const int *sigptr = arg;
205 const int sig = *sigptr;
220 log_notice(
LD_GENERAL,
"Catching signal TERM, exiting cleanly.");
225 log_notice(
LD_GENERAL,
"Interrupt: exiting cleanly.");
230 sd_notify(0,
"STOPPING=1");
236 log_debug(
LD_GENERAL,
"Caught SIGPIPE. Ignoring.");
246 log_debug(
LD_GENERAL,
"Caught USR2, going to loglevel debug. "
247 "Send HUP to change back.");
252 sd_notify(0,
"RELOADING=1");
255 log_warn(
LD_CONFIG,
"Restart failed (config error?). Exiting.");
260 sd_notify(0,
"READY=1");
273 case SIGCLEARDNSCACHE:
288 log_notice(
LD_GENERAL,
"Going dormant because of controller request.");
300process_win32_console_ctrl(DWORD ctrl_type)
305 activate_signal(SIGINT);
329 time_t now = time(NULL);
331 size_t rbuf_cap, wbuf_cap, rbuf_len, wbuf_len;
338 "Conn %d (socket %d) is a %s, created %d secs ago",
341 (
int)(now - conn->timestamp_created));
344 "Conn %d: %d bytes waiting on inbuf (len %d, last read %d secs ago)",
346 (
int)connection_get_inbuf_len(conn),
348 (
int)(now - conn->timestamp_last_read_allowed));
350 "Conn %d: %d bytes waiting on outbuf "
351 "(len %d, last written %d secs ago)",i,
352 (
int)connection_get_outbuf_len(conn),
354 (
int)(now - conn->timestamp_last_write_allowed));
359 &wbuf_cap, &wbuf_len) == 0) {
361 "Conn %d: %d/%d bytes used on OpenSSL read buffer; "
362 "%d/%d bytes used on write buffer.",
363 i, (
int)rbuf_len, (
int)rbuf_cap, (
int)wbuf_len, (
int)wbuf_cap);
370 } SMARTLIST_FOREACH_END(conn);
376 "Cells processed: %"PRIu64
" padding\n"
377 " %"PRIu64
" create\n"
378 " %"PRIu64
" created\n"
380 " (%"PRIu64
" relayed)\n"
381 " (%"PRIu64
" delivered)\n"
382 " %"PRIu64
" destroy",
391 tor_log(severity,
LD_NET,
"Average packaged cell fullness: %2.3f%%",
395 tor_log(severity,
LD_NET,
"Average delivered cell fullness: %2.3f%%",
409 "Average bandwidth: %"PRIu64
"/%d = %d bytes/sec reading",
414 "Average bandwidth: %"PRIu64
"/%d = %d bytes/sec writing",
420 tor_log(severity,
LD_NET,
"--------------- Dumping memory information:");
442} signal_handlers[] = {
444 { SIGINT, UNIX_ONLY, NULL },
447 { SIGTERM, UNIX_ONLY, NULL },
450 { SIGPIPE, UNIX_ONLY, NULL },
453 { SIGUSR1, UNIX_ONLY, NULL },
456 { SIGUSR2, UNIX_ONLY, NULL },
459 { SIGHUP, UNIX_ONLY, NULL },
462 { SIGXFSZ, UNIX_ONLY, NULL },
465 { SIGCHLD, UNIX_ONLY, NULL },
468 { SIGNEWNYM, 0, NULL },
469 { SIGCLEARDNSCACHE, 0, NULL },
470 { SIGHEARTBEAT, 0, NULL },
471 { SIGACTIVE, 0, NULL },
472 { SIGDORMANT, 0, NULL },
484 for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
491 signal_handlers[i].signal_event =
497 log_warn(
LD_BUG,
"Error from libevent when adding "
498 "event for signal %d",
501 signal_handlers[i].signal_event =
512 if (enabled) SetConsoleCtrlHandler(process_win32_console_ctrl, TRUE);
518activate_signal(
int signal_num)
521 for (i = 0; signal_handlers[i].signal_value >= 0; ++i) {
523 event_active(signal_handlers[i].
signal_event, EV_SIGNAL, 1);
537 bool running_tor =
false;
564 parsed_cmdline_free(cmdline);
574 log_notice(
LD_GENERAL,
"Tor %s running on %s with Libevent %s, "
575 "%s %s, Zlib %s, Liblzma %s, Libzstd %s and %s %s as libc.",
591 log_notice(
LD_GENERAL,
"Tor can't help you if you use it wrong! "
592 "Learn how to be safe at "
593 "https://support.torproject.org/faq/staying-anonymous/");
595 if (strstr(version,
"alpha") || strstr(version,
"beta"))
596 log_notice(
LD_GENERAL,
"This version is not a stable Tor release. "
597 "Expect more bugs than usual.");
600 log_warn(
LD_GENERAL,
"This build of Tor has been compiled with one "
601 "or more options that might make it less reliable or secure! "
609 tracing_log_warning();
613 log_err(
LD_CONFIG,
"Reading config failed--see warnings above.");
615 }
else if (init_rv > 0) {
636 predicted_ports_init();
640 log_warn(
LD_GENERAL,
"You are running Tor as root. You don't need to, "
641 "and you probably shouldn't.");
666 char *fname = options_get_datadir_fname(options,
"lock");
667 int already_locked = 0;
671 if (err_if_locked && already_locked) {
673 log_warn(
LD_GENERAL,
"It looks like another Tor process is running "
674 "with the same data directory. Waiting 5 seconds to see "
683 log_err(
LD_GENERAL,
"No, it's still there. Exiting.");
719 if (filename &&
tor_unlink(filename) != 0 && errno != ENOENT) {
720 log_warn(
LD_FS,
"Couldn't unlink %s: %s",
721 filename, strerror(errno));
734 const char *nickname = options->
Nickname;
735 sandbox_disable_getaddrinfo_cache();
737 bool show_rsa = !strcmp(arg,
"") || !strcmp(arg,
"rsa");
738 bool show_ed25519 = !strcmp(arg,
"ed25519");
739 if (!show_rsa && !show_ed25519) {
741 "If you give a key type, you must specify 'rsa' or 'ed25519'. Exiting.");
747 "Clients don't have long-term identity keys. Exiting.");
752 log_err(
LD_GENERAL,
"Error initializing keys; exiting.");
755 if (!(k = get_server_identity_key())) {
756 log_err(
LD_GENERAL,
"Error: missing RSA identity key.");
760 log_err(
LD_BUG,
"Error computing RSA fingerprint");
763 if (!(edkey = get_master_identity_key())) {
764 log_err(
LD_GENERAL,
"Error: missing ed25519 identity key.");
768 printf(
"%s %s\n", nickname, rsa);
773 printf(
"%s %s\n", nickname, ed25519);
793 printf(
"16:%s\n",output);
806 if (!strcmp(arg,
"short")) {
807 how = OPTIONS_DUMP_MINIMAL;
808 }
else if (!strcmp(arg,
"non-builtin")) {
810 fprintf(stderr,
"'non-builtin' is deprecated; use 'short' instead.\n");
811 how = OPTIONS_DUMP_MINIMAL;
812 }
else if (!strcmp(arg,
"full")) {
813 how = OPTIONS_DUMP_ALL;
815 fprintf(stderr,
"No valid argument to --dump-config found!\n");
816 fprintf(stderr,
"Please select 'short' or 'full'.\n");
840 gethostname(hname,
sizeof(hname));
841 tor_add_addrinfo(hname);
845sandbox_init_filter(
void)
851 get_cachedir_fname(
"cached-status"));
854 sandbox_cfg_allow_open_filename(&cfg, tor_strdup(name))
856#define OPENDIR(dir) \
857 sandbox_cfg_allow_opendir_dirname(&cfg, tor_strdup(dir))
859#define OPEN_DATADIR(name) \
860 sandbox_cfg_allow_open_filename(&cfg, get_datadir_fname(name))
862#define OPEN_DATADIR2(name, name2) \
863 sandbox_cfg_allow_open_filename(&cfg, get_datadir_fname2((name), (name2)))
865#define OPEN_DATADIR_SUFFIX(name, suffix) do { \
866 OPEN_DATADIR(name); \
867 OPEN_DATADIR(name suffix); \
870#define OPEN_DATADIR2_SUFFIX(name, name2, suffix) do { \
871 OPEN_DATADIR2(name, name2); \
872 OPEN_DATADIR2(name, name2 suffix); \
877#define OPEN_KEY_DIRECTORY() \
878 OPEN(options->KeyDirectory)
879#define OPEN_CACHEDIR(name) \
880 sandbox_cfg_allow_open_filename(&cfg, get_cachedir_fname(name))
881#define OPEN_CACHEDIR_SUFFIX(name, suffix) do { \
882 OPEN_CACHEDIR(name); \
883 OPEN_CACHEDIR(name suffix); \
885#define OPEN_KEYDIR(name) \
886 sandbox_cfg_allow_open_filename(&cfg, get_keydir_fname(name))
887#define OPEN_KEYDIR_SUFFIX(name, suffix) do { \
889 OPEN_KEYDIR(name suffix); \
895 OPEN_KEY_DIRECTORY();
897 OPEN_CACHEDIR_SUFFIX(
"cached-certs",
".tmp");
898 OPEN_CACHEDIR_SUFFIX(
"cached-consensus",
".tmp");
899 OPEN_CACHEDIR_SUFFIX(
"unverified-consensus",
".tmp");
900 OPEN_CACHEDIR_SUFFIX(
"unverified-microdesc-consensus",
".tmp");
901 OPEN_CACHEDIR_SUFFIX(
"cached-microdesc-consensus",
".tmp");
902 OPEN_CACHEDIR_SUFFIX(
"cached-microdescs",
".tmp");
903 OPEN_CACHEDIR_SUFFIX(
"cached-microdescs.new",
".tmp");
904 OPEN_CACHEDIR_SUFFIX(
"cached-descriptors",
".tmp");
905 OPEN_CACHEDIR_SUFFIX(
"cached-descriptors.new",
".tmp");
906 OPEN_CACHEDIR(
"cached-descriptors.tmp.tmp");
907 OPEN_CACHEDIR_SUFFIX(
"cached-extrainfo",
".tmp");
908 OPEN_CACHEDIR_SUFFIX(
"cached-extrainfo.new",
".tmp");
909 OPEN_CACHEDIR(
"cached-extrainfo.tmp.tmp");
911 OPEN_DATADIR_SUFFIX(
"state",
".tmp");
912 OPEN_DATADIR_SUFFIX(
"sr-state",
".tmp");
913 OPEN_DATADIR_SUFFIX(
"unparseable-desc",
".tmp");
914 OPEN_DATADIR_SUFFIX(
"v3-status-votes",
".tmp");
915 OPEN_DATADIR(
"key-pinning-journal");
916 OPEN(
"/dev/srandom");
917 OPEN(
"/dev/urandom");
920 OPEN(
"/proc/meminfo");
923 OPEN_DATADIR_SUFFIX(
"networkstatus-bridges",
".tmp");
926 OPEN_DATADIR(
"approved-routers");
927 OPEN_DATADIR_SUFFIX(
"my-consensus-microdesc",
".tmp");
928 OPEN_DATADIR_SUFFIX(
"my-consensus-ns",
".tmp");
930 log_notice(
LD_GENERAL,
"Adding V3BandwidthsFile %s to sandboxing set.",
950 char *torrc_bck = NULL;
952 sandbox_cfg_allow_rename(&cfg, tor_strdup(
torrc_fname), torrc_bck);
953 char *torrc_tmp = NULL;
955 sandbox_cfg_allow_rename(&cfg, torrc_tmp, tor_strdup(
torrc_fname));
962 if (file_status(f) == FN_DIR) {
969#define RENAME_SUFFIX(name, suffix) \
970 sandbox_cfg_allow_rename(&cfg, \
971 get_datadir_fname(name suffix), \
972 get_datadir_fname(name))
974#define RENAME_SUFFIX2(prefix, name, suffix) \
975 sandbox_cfg_allow_rename(&cfg, \
976 get_datadir_fname2(prefix, name suffix), \
977 get_datadir_fname2(prefix, name))
979#define RENAME_CACHEDIR_SUFFIX(name, suffix) \
980 sandbox_cfg_allow_rename(&cfg, \
981 get_cachedir_fname(name suffix), \
982 get_cachedir_fname(name))
984#define RENAME_KEYDIR_SUFFIX(name, suffix) \
985 sandbox_cfg_allow_rename(&cfg, \
986 get_keydir_fname(name suffix), \
987 get_keydir_fname(name))
989 RENAME_CACHEDIR_SUFFIX(
"cached-certs",
".tmp");
990 RENAME_CACHEDIR_SUFFIX(
"cached-consensus",
".tmp");
991 RENAME_CACHEDIR_SUFFIX(
"unverified-consensus",
".tmp");
992 RENAME_CACHEDIR_SUFFIX(
"unverified-microdesc-consensus",
".tmp");
993 RENAME_CACHEDIR_SUFFIX(
"cached-microdesc-consensus",
".tmp");
994 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs",
".tmp");
995 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs",
".new");
996 RENAME_CACHEDIR_SUFFIX(
"cached-microdescs.new",
".tmp");
997 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors",
".tmp");
998 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors",
".new");
999 RENAME_CACHEDIR_SUFFIX(
"cached-descriptors.new",
".tmp");
1000 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo",
".tmp");
1001 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo",
".new");
1002 RENAME_CACHEDIR_SUFFIX(
"cached-extrainfo.new",
".tmp");
1004 RENAME_SUFFIX(
"state",
".tmp");
1005 RENAME_SUFFIX(
"sr-state",
".tmp");
1006 RENAME_SUFFIX(
"unparseable-desc",
".tmp");
1007 RENAME_SUFFIX(
"v3-status-votes",
".tmp");
1010 RENAME_SUFFIX(
"networkstatus-bridges",
".tmp");
1013 RENAME_SUFFIX(
"my-consensus-microdesc",
".tmp");
1014 RENAME_SUFFIX(
"my-consensus-ns",
".tmp");
1017#define STAT_DATADIR(name) \
1018 sandbox_cfg_allow_stat_filename(&cfg, get_datadir_fname(name))
1020#define STAT_CACHEDIR(name) \
1021 sandbox_cfg_allow_stat_filename(&cfg, get_cachedir_fname(name))
1023#define STAT_DATADIR2(name, name2) \
1024 sandbox_cfg_allow_stat_filename(&cfg, get_datadir_fname2((name), (name2)))
1026#define STAT_KEY_DIRECTORY() \
1027 sandbox_cfg_allow_stat_filename(&cfg, tor_strdup(options->KeyDirectory))
1030 STAT_DATADIR(
"lock");
1031 STAT_DATADIR(
"state");
1032 STAT_DATADIR(
"router-stability");
1034 STAT_CACHEDIR(
"cached-extrainfo.new");
1043 smartlist_free(files);
1051 char *tmp_name = NULL;
1053 sandbox_cfg_allow_rename(&cfg,
1054 tor_strdup(tmp_name), tor_strdup(file_name));
1063 smartlist_free(files);
1064 smartlist_free(dirs);
1078 if (!port->is_unix_addr)
1082 char *dirname = tor_strdup(port->unix_addr);
1087 sandbox_cfg_allow_chmod_filename(&cfg, tor_strdup(port->unix_addr));
1088 sandbox_cfg_allow_chown_filename(&cfg, tor_strdup(port->unix_addr));
1089 } SMARTLIST_FOREACH_END(port);
1099 OPEN_KEYDIR_SUFFIX(
"secret_id_key",
".tmp");
1100 OPEN_KEYDIR_SUFFIX(
"secret_onion_key",
".tmp");
1101 OPEN_KEYDIR_SUFFIX(
"secret_onion_key_ntor",
".tmp");
1102 OPEN_KEYDIR(
"secret_id_key.old");
1103 OPEN_KEYDIR(
"secret_onion_key.old");
1104 OPEN_KEYDIR(
"secret_onion_key_ntor.old");
1106 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key",
".tmp");
1107 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key_encrypted",
".tmp");
1108 OPEN_KEYDIR_SUFFIX(
"ed25519_master_id_public_key",
".tmp");
1109 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_secret_key",
".tmp");
1110 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_secret_key_encrypted",
".tmp");
1111 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_public_key",
".tmp");
1112 OPEN_KEYDIR_SUFFIX(
"ed25519_signing_cert",
".tmp");
1114 OPEN_DATADIR2_SUFFIX(
"stats",
"bridge-stats",
".tmp");
1115 OPEN_DATADIR2_SUFFIX(
"stats",
"dirreq-stats",
".tmp");
1117 OPEN_DATADIR2_SUFFIX(
"stats",
"entry-stats",
".tmp");
1118 OPEN_DATADIR2_SUFFIX(
"stats",
"exit-stats",
".tmp");
1119 OPEN_DATADIR2_SUFFIX(
"stats",
"buffer-stats",
".tmp");
1120 OPEN_DATADIR2_SUFFIX(
"stats",
"conn-stats",
".tmp");
1121 OPEN_DATADIR2_SUFFIX(
"stats",
"hidserv-stats",
".tmp");
1122 OPEN_DATADIR2_SUFFIX(
"stats",
"hidserv-v3-stats",
".tmp");
1124 OPEN_DATADIR(
"approved-routers");
1125 OPEN_DATADIR_SUFFIX(
"fingerprint",
".tmp");
1126 OPEN_DATADIR_SUFFIX(
"fingerprint-ed25519",
".tmp");
1127 OPEN_DATADIR_SUFFIX(
"hashed-fingerprint",
".tmp");
1128 OPEN_DATADIR_SUFFIX(
"router-stability",
".tmp");
1130 OPEN(
"/etc/resolv.conf");
1132 RENAME_SUFFIX(
"fingerprint",
".tmp");
1133 RENAME_SUFFIX(
"fingerprint-ed25519",
".tmp");
1134 RENAME_KEYDIR_SUFFIX(
"secret_onion_key_ntor",
".tmp");
1136 RENAME_KEYDIR_SUFFIX(
"secret_id_key",
".tmp");
1137 RENAME_KEYDIR_SUFFIX(
"secret_id_key.old",
".tmp");
1138 RENAME_KEYDIR_SUFFIX(
"secret_onion_key",
".tmp");
1139 RENAME_KEYDIR_SUFFIX(
"secret_onion_key.old",
".tmp");
1141 RENAME_SUFFIX2(
"stats",
"bridge-stats",
".tmp");
1142 RENAME_SUFFIX2(
"stats",
"dirreq-stats",
".tmp");
1143 RENAME_SUFFIX2(
"stats",
"entry-stats",
".tmp");
1144 RENAME_SUFFIX2(
"stats",
"exit-stats",
".tmp");
1145 RENAME_SUFFIX2(
"stats",
"buffer-stats",
".tmp");
1146 RENAME_SUFFIX2(
"stats",
"conn-stats",
".tmp");
1147 RENAME_SUFFIX2(
"stats",
"hidserv-stats",
".tmp");
1148 RENAME_SUFFIX2(
"stats",
"hidserv-v3-stats",
".tmp");
1149 RENAME_SUFFIX(
"hashed-fingerprint",
".tmp");
1150 RENAME_SUFFIX(
"router-stability",
".tmp");
1152 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key",
".tmp");
1153 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_secret_key_encrypted",
".tmp");
1154 RENAME_KEYDIR_SUFFIX(
"ed25519_master_id_public_key",
".tmp");
1155 RENAME_KEYDIR_SUFFIX(
"ed25519_signing_secret_key",
".tmp");
1156 RENAME_KEYDIR_SUFFIX(
"ed25519_signing_cert",
".tmp");
1158 sandbox_cfg_allow_rename(&cfg,
1159 get_keydir_fname(
"secret_onion_key"),
1160 get_keydir_fname(
"secret_onion_key.old"));
1161 sandbox_cfg_allow_rename(&cfg,
1162 get_keydir_fname(
"secret_onion_key_ntor"),
1163 get_keydir_fname(
"secret_onion_key_ntor.old"));
1165 STAT_KEY_DIRECTORY();
1166 OPEN_DATADIR(
"stats");
1167 STAT_DATADIR(
"stats");
1168 STAT_DATADIR2(
"stats",
"dirreq-stats");
1179run_tor_main_loop(
void)
1189 log_err(
LD_OR,
"Error initializing keys; exiting");
1202 char *fname = get_datadir_fname(
"key-pinning-journal");
1205 log_err(
LD_DIR,
"Error loading key-pinning journal: %s",strerror(errno));
1209 log_err(
LD_DIR,
"Error opening key-pinning journal: %s",strerror(errno));
1223 char *fname = get_datadir_fname(
"key-pinning-entries");
1230 "Couldn't load all cached v3 certificates. Starting anyway.");
1242 const time_t now = time(NULL);
1261 log_warn(
LD_GENERAL,
"Couldn't set up any working nameservers. "
1262 "Network not up yet? Will try again soon.");
1264 log_err(
LD_GENERAL,
"Error initializing dns subsystem; exiting. To "
1265 "retry instead, set the ServerDNSAllowBrokenResolvConf option.");
1271 const int r = sd_notify(0,
"READY=1");
1273 log_warn(
LD_GENERAL,
"Unable to send readiness to systemd: %s",
1276 log_notice(
LD_GENERAL,
"Signaled readiness to systemd");
1278 log_info(
LD_GENERAL,
"Systemd NOTIFY_SOCKET not present.");
1319#ifdef EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
1328 char **argv = tor_calloc(argc,
sizeof(
char*));
1329 memcpy(argv, tor_cfg->
argv, tor_cfg->
argc*
sizeof(
char*));
1335 result = nt_service_parse_options(argc, argv, &done);
1342 int init_rv =
tor_init(argc, argv);
1345 result = (init_rv < 0) ? -1 : 0;
1353#ifdef ENABLE_FRAGILE_HARDENING
1354 log_warn(
LD_CONFIG,
"Sandbox is enabled but this Tor was built using "
1355 "fragile compiler hardening. The sandbox may be unable to filter "
1356 "requests to open files and directories and its overall "
1357 "effectiveness will be reduced.");
1364 log_err(
LD_BUG,
"Failed to create syscall sandbox filter");
1368 tor_make_getaddrinfo_cache_active();
1371#ifdef HAVE_EVUTIL_SECURE_RNG_SET_URANDOM_DEVICE_FILE
1372 evutil_secure_rng_set_urandom_device_file(
1379 nt_service_set_state(SERVICE_RUNNING);
1380 result = run_tor_main_loop();
1398 printf(
"Configuration was valid\n");
1407 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.
const char * tor_libevent_get_version_str(void)
struct event_base * tor_libevent_get_base(void)
Header for compat_libevent.c.
const char * tor_compress_version_str(compress_method_t method)
int tor_compress_supports_method(compress_method_t method)
void tor_compress_log_init_warnings(void)
const char * get_torrc_fname(int defaults_fname)
const smartlist_t * get_configured_ports(void)
int options_init_from_torrc(int argc, char **argv)
static char * torrc_defaults_fname
void init_protocol_warning_severity_level(void)
char * options_dump(const or_options_t *options, int how_to_dump)
static char * torrc_fname
const or_options_t * get_options(void)
int set_options(or_options_t *new_val, char **msg)
tor_cmdline_mode_t command
parsed_cmdline_t * config_parse_commandline(int argc, char **argv, int ignore_errors)
Header file for config.c.
#define CONFIG_BACKUP_PATTERN
void congestion_control_new_consensus_params(const networkstatus_t *ns)
Public APIs for congestion control.
void flow_control_new_consensus_params(const networkstatus_t *ns)
APIs for stream flow control on congestion controlled circuits.
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_init(void)
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_version_string(void)
const char * crypto_get_library_name(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_version_str(void)
const char * tor_libc_get_name(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)
smartlist_t * get_connection_array(void)
void tor_shutdown_event_loop_and_exit(int exitcode)
void tor_init_connection_lists(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_malloc_(size_t size)
void * tor_realloc_(void *ptr, 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 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)
sandbox_cfg_t * sandbox_cfg_new(void)
int sandbox_init(sandbox_cfg_t *cfg)
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