11 #define DIRCLIENT_PRIVATE
69 #define MAX_DIR_DL_SIZE ((1<<24)-1)
73 #define ALLOW_DIRECTORY_TIME_SKEW (30*60)
85 int was_descriptor_digests);
92 static void connection_dir_close_consensus_fetches(
102 return "server descriptor upload";
104 return "server vote upload";
106 return "consensus signature upload";
108 return "server descriptor fetch";
110 return "extra-info fetch";
112 return "consensus network-status fetch";
114 return "authority cert fetch";
116 return "status vote fetch";
118 return "consensus signature fetch";
120 return "hidden-service descriptor fetch";
122 return "hidden-service descriptor upload";
124 return "microdescriptor fetch";
127 log_warn(
LD_BUG,
"Called with unknown purpose %d", purpose);
136 switch (dir_purpose) {
157 if (resource && !strcmp(resource,
"microdesc"))
164 log_warn(
LD_BUG,
"Unexpected purpose %d", (
int)dir_purpose);
179 if (node && node->ri) {
200 const smartlist_t *servers = router_get_trusted_dir_servers();
204 d->has_accepted_serverdesc) {
232 size_t payload_len,
size_t extrainfo_len)
236 const smartlist_t *dirservers = router_get_trusted_dir_servers();
246 size_t upload_len = payload_len;
248 if ((type & ds->type) == 0)
260 log_warn(
LD_DIR,
"Wanted to contact authority '%s' for %s, but "
261 "it's in our ExcludedNodes list and StrictNodes is set. "
270 ds->has_accepted_serverdesc = 0;
273 upload_len += extrainfo_len;
274 log_info(
LD_DIR,
"Uploading an extrainfo too (length %d)",
275 (
int) extrainfo_len);
280 FIREWALL_DIR_CONNECTION,
296 directory_request_free(req);
297 } SMARTLIST_FOREACH_END(ds);
300 log_warn(
LD_DIR,
"Publishing server descriptor to directory authorities "
301 "of type '%s', but no authorities of that type listed!", s);
332 circuit_guard_state_t **guard_state_out)
338 log_warn(
LD_BUG,
"Called when we have UseBridges set.");
349 log_info(
LD_DIR,
"No router found for %s; falling back to "
365 const char *resource)
367 time_t if_modified_since = 0;
369 int or_diff_from_is_set = 0;
374 const int DEFAULT_IF_MODIFIED_SINCE_DELAY = 180;
375 const int32_t DEFAULT_TRY_DIFF_FOR_CONSENSUS_NEWER = 72;
376 const int32_t MIN_TRY_DIFF_FOR_CONSENSUS_NEWER = 0;
377 const int32_t MAX_TRY_DIFF_FOR_CONSENSUS_NEWER = 8192;
378 const char TRY_DIFF_FOR_CONSENSUS_NEWER_NAME[] =
379 "try-diff-for-consensus-newer-than";
385 int32_t max_age_for_diff = 3600 *
387 TRY_DIFF_FOR_CONSENSUS_NEWER_NAME,
388 DEFAULT_TRY_DIFF_FOR_CONSENSUS_NEWER,
389 MIN_TRY_DIFF_FOR_CONSENSUS_NEWER,
390 MAX_TRY_DIFF_FOR_CONSENSUS_NEWER);
401 time_t ims_delay = DEFAULT_IF_MODIFIED_SINCE_DELAY;
402 if (v->fresh_until > v->valid_after
403 && ims_delay > (v->fresh_until - v->valid_after)/2) {
404 ims_delay = (v->fresh_until - v->valid_after)/2;
406 if_modified_since = v->valid_after + ims_delay;
407 if (v->valid_after >=
approx_time() - max_age_for_diff) {
408 memcpy(or_diff_from, v->digest_sha3_as_signed,
DIGEST256_LEN);
409 or_diff_from_is_set = 1;
419 if_modified_since = cd->
published + DEFAULT_IF_MODIFIED_SINCE_DELAY;
422 or_diff_from_is_set = 1;
427 if (if_modified_since > 0)
429 if (or_diff_from_is_set) {
432 (
const char*)or_diff_from,
sizeof(or_diff_from));
445 uint8_t router_purpose,
446 const char *resource,
453 || want_authority == DL_WANT_AUTHORITY);
454 int require_authority = 0;
459 if (type == NO_DIRINFO)
465 circuit_guard_state_t *guard_state = NULL;
475 if (node && node->ri) {
493 directory_request_free(req);
498 log_notice(
LD_DIR,
"Ignoring directory request, since no bridge "
499 "nodes are available yet.");
520 log_debug(
LD_DIR,
"Deferring serverdesc fetch: all authorities "
525 if (rs == NULL && require_authority) {
526 log_info(
LD_DIR,
"No authorities were available for %s: will try "
563 directory_request_free(req);
566 "While fetching directory info, "
567 "no running dirservers known. Will try again later. "
568 "(purpose %d)", dir_purpose);
581 uint8_t router_purpose,
582 const char *resource)
599 directory_request_free(req);
600 } SMARTLIST_FOREACH_END(ds);
618 directory_choose_address_routerstatus(
const routerstatus_t *status,
628 int have_or = 0, have_dir = 0;
645 use_dir_ap->port = 0;
653 use_or_ap->port = status->ipv4_orport;
663 have_or = tor_addr_port_is_valid_ap(use_or_ap, 0);
671 && !dirclient_must_use_begindir(options))) {
674 have_dir = tor_addr_port_is_valid_ap(use_dir_ap, 0);
679 if (!have_or && !have_dir) {
680 static int logged_backtrace = 0;
682 log_info(
LD_BUG,
"Rejected all OR and Dir addresses from %s when "
683 "launching an outgoing directory connection to: IPv4 %s OR %d "
685 fmt_addr(&status->ipv4_addr), status->ipv4_orport,
686 status->ipv4_dirport, ipv6_str, status->ipv6_orport,
687 status->ipv4_dirport);
689 if (!logged_backtrace) {
691 logged_backtrace = 1;
715 log_info(
LD_DIR,
"Giving up on serverdesc/extrainfo fetch from "
716 "directory server at %s; retrying",
725 log_info(
LD_DIR,
"Giving up on certificate fetch from directory server "
730 log_info(
LD_DIR,
"Giving up downloading detached signatures from %s",
733 log_info(
LD_DIR,
"Giving up downloading votes from %s",
736 log_info(
LD_DIR,
"Giving up on downloading microdescriptors from "
737 "directory server at %s; will retry",
753 log_warn(
LD_BUG,
"Malformed fingerprint in list: %s",
799 if (smartlist_len(which)) {
803 smartlist_free(which);
810 const char *fp_pfx =
"fp/";
811 const char *fpsk_pfx =
"fp-sk/";
827 failed, NULL, DSR_HEX);
832 } SMARTLIST_FOREACH_END(cp);
836 strlen(fpsk_pfx), failed);
840 } SMARTLIST_FOREACH_END(cp);
843 "Don't know what to do with failure for cert fetch %s",
847 smartlist_free(failed);
868 const tor_addr_t *or_addr = &req->or_addr_port.addr;
870 const int or_port = req->or_addr_port.port;
871 const int dir_port = req->dir_addr_port.port;
880 *reason =
"(using begindir - directory with no DirPort)";
885 *reason =
"directory with unknown ORPort";
890 *reason =
"DirPort connection";
896 FIREWALL_OR_CONNECTION, 0, 0)) {
897 *reason =
"ORPort not reachable";
903 if (!dirclient_must_use_begindir(options)) {
904 *reason =
"in relay mode";
910 *reason =
"(using begindir)";
928 result->or_addr_port.port = 0;
930 result->dir_addr_port.port = 0;
931 result->dir_purpose = dir_purpose;
944 config_free_lines(req->additional_headers);
956 memcpy(&req->or_addr_port, p,
sizeof(*p));
967 memcpy(&req->dir_addr_port, p,
sizeof(*p));
987 uint8_t router_purpose)
993 req->router_purpose = router_purpose;
1005 req->indirection = indirection;
1016 const char *resource)
1018 req->resource = resource;
1027 const char *payload,
1032 req->payload = payload;
1033 req->payload_len = payload_len;
1041 time_t if_modified_since)
1043 req->if_modified_since = if_modified_since;
1072 req->hs_ident = ident;
1086 req->hs_ident = ident;
1093 circuit_guard_state_t *state)
1095 req->guard_state = state;
1106 return (req->or_addr_port.port ||
1107 req->dir_addr_port.port ||
1120 req->routerstatus = status;
1133 if (BUG(status == NULL))
1138 const int anonymized_connection =
dirind_is_anon(req->indirection);
1148 if (!node && anonymized_connection) {
1149 log_info(
LD_DIR,
"Not sending anonymized request to directory '%s'; we "
1150 "don't have its router descriptor.",
1157 log_warn(
LD_DIR,
"Wanted to contact directory mirror %s for %s, but "
1158 "it's in our ExcludedNodes list and StrictNodes is set. "
1159 "Skipping. This choice might make your Tor not work.",
1174 if (directory_choose_address_routerstatus(status,
1175 req->indirection, &use_or_ap,
1185 status->identity_digest);
1201 tor_assert_nonfatal(v4);
1225 if (request->routerstatus) {
1226 tor_assert_nonfatal(
1235 const char *digest = request->digest;
1236 const uint8_t dir_purpose = request->dir_purpose;
1237 const uint8_t router_purpose = request->router_purpose;
1239 const char *resource = request->resource;
1241 circuit_guard_state_t *guard_state = request->guard_state;
1243 tor_assert(or_addr_port->port || dir_addr_port->port);
1248 int socket_error = 0;
1249 const char *begindir_reason = NULL;
1252 const int use_begindir =
1265 tor_addr_copy(&addr, &(use_begindir ? or_addr_port : dir_addr_port)->addr);
1266 uint16_t port = (use_begindir ? or_addr_port : dir_addr_port)->port;
1268 log_debug(
LD_DIR,
"anonymized %d, use_begindir %d.",
1269 anonymized_connection, use_begindir);
1275 hs_service_non_anonymous_mode_enabled(options));
1280 if (!use_begindir && dirclient_must_use_begindir(options)) {
1281 log_warn(
LD_BUG,
"Client could not use begindir connection: %s",
1282 begindir_reason ? begindir_reason :
"(NULL)");
1288 if (!anonymized_connection && !use_begindir && !options->
HTTPProxy &&
1290 log_warn(
LD_DIR,
"Cannot connect to a directory server through a "
1297 static int logged_backtrace = 0;
1299 "Cannot make an outgoing %sconnection without a remote %sPort.",
1300 use_begindir ?
"begindir " :
"",
1301 use_begindir ?
"OR" :
"Dir");
1302 if (!logged_backtrace) {
1304 logged_backtrace = 1;
1313 conn->base_.
port = port;
1317 conn->base_.
purpose = dir_purpose;
1331 if (!anonymized_connection && !use_begindir) {
1340 if (BUG(guard_state)) {
1347 port, &socket_error)) {
1349 connection_mark_for_close(
TO_CONN(conn));
1375 if (anonymized_connection && use_begindir)
1377 else if (anonymized_connection && !use_begindir)
1382 if (BUG(anonymized_connection && guard_state)) {
1397 use_begindir, !anonymized_connection);
1399 log_warn(
LD_NET,
"Making tunnel to dirserver failed.");
1400 connection_mark_for_close(
TO_CONN(conn));
1404 if (connection_add(
TO_CONN(conn)) < 0) {
1405 log_warn(
LD_NET,
"Unable to add connection for link to dirserver.");
1406 connection_mark_for_close(
TO_CONN(conn));
1427 const char *s1 = *a, *s2 = *b;
1428 return strcmp(s1, s2);
1431 #define CONDITIONAL_CONSENSUS_FPR_LEN 3
1446 const char *hyphen, *flavor;
1447 if (resource==NULL || strcmp(resource,
"ns")==0) {
1456 char *authority_id_list;
1465 hex = tor_malloc(2*CONDITIONAL_CONSENSUS_FPR_LEN+1);
1467 ds->v3_identity_digest, CONDITIONAL_CONSENSUS_FPR_LEN);
1469 } SMARTLIST_FOREACH_END(ds);
1474 tor_asprintf(&url,
"/tor/status-vote/current/consensus%s%s/%s.z",
1475 hyphen, flavor, authority_id_list);
1478 smartlist_free(authority_digests);
1494 if (decorate && source[0] !=
'[') {
1497 strlcpy(destination, source, len);
1511 const int purpose = req->dir_purpose;
1512 const char *resource = req->resource;
1513 const char *payload = req->payload;
1514 const size_t payload_len = req->payload_len;
1515 const time_t if_modified_since = req->if_modified_since;
1516 const int anonymized_connection =
dirind_is_anon(req->indirection);
1518 char proxystring[256];
1519 char hoststring[128];
1522 char decorated_address[128];
1525 char *accept_encoding;
1528 size_t request_len, total_request_len = 0;
1529 const char *httpcommand = NULL;
1539 if (strchr(conn->base_.
address,
':')) {
1541 sizeof(decorated_address), 1);
1543 strlcpy(decorated_address, conn->base_.
address,
sizeof(decorated_address));
1547 if (conn->base_.
port == 80) {
1548 strlcpy(hoststring, decorated_address,
sizeof(hoststring));
1551 decorated_address, conn->base_.
port);
1555 if (if_modified_since) {
1556 char b[RFC1123_TIME_LEN+1];
1563 char *base64_authenticator=NULL;
1566 tor_snprintf(proxystring,
sizeof(proxystring),
"http://%s", hoststring);
1567 if (authenticator) {
1569 if (!base64_authenticator)
1570 log_warn(
LD_BUG,
"Encoding http authenticator failed");
1572 if (base64_authenticator) {
1574 "Proxy-Authorization: Basic %s\r\n",
1575 base64_authenticator);
1582 if (! anonymized_connection) {
1593 for (h = req->additional_headers; h; h = h->next) {
1602 httpcommand =
"GET";
1604 log_info(
LD_DIR,
"Downloading consensus from %s using %s",
1610 httpcommand =
"GET";
1616 httpcommand =
"GET";
1617 tor_asprintf(&url,
"/tor/status-vote/next/%s.z", resource);
1622 httpcommand =
"GET";
1623 url = tor_strdup(
"/tor/status-vote/next/consensus-signatures.z");
1627 httpcommand =
"GET";
1632 httpcommand =
"GET";
1637 httpcommand =
"GET";
1644 httpcommand =
"POST";
1645 url = tor_strdup(
"/tor/");
1647 why =
"for no reason at all";
1655 httpcommand =
"POST";
1656 url = tor_strdup(
"/tor/post/vote");
1661 httpcommand =
"POST";
1662 url = tor_strdup(
"/tor/post/consensus-signature");
1668 httpcommand =
"GET";
1674 httpcommand =
"POST";
1683 if (direct && (strlen(proxystring) + strlen(url) >= 4096)) {
1685 "Squid does not like URLs longer than 4095 bytes, and this "
1686 "one is %d bytes long: %s%s",
1687 (
int)(strlen(proxystring) + strlen(url)), proxystring, url);
1690 tor_snprintf(request,
sizeof(request),
"%s %s", httpcommand, proxystring);
1692 request_len = strlen(request);
1693 total_request_len += request_len;
1694 connection_buf_add(request, request_len,
TO_CONN(conn));
1696 url_len = strlen(url);
1697 total_request_len += url_len;
1698 connection_buf_add(url, url_len,
TO_CONN(conn));
1701 if (!strcmp(httpcommand,
"POST") || payload) {
1703 payload ? (
unsigned long)payload_len : 0);
1708 tor_snprintf(request,
sizeof(request),
" HTTP/1.0\r\nHost: %s\r\n%s\r\n",
1709 hoststring, header);
1713 request_len = strlen(request);
1714 total_request_len += request_len;
1715 connection_buf_add(request, request_len,
TO_CONN(conn));
1719 connection_buf_add(payload, payload_len,
TO_CONN(conn));
1720 total_request_len += payload_len;
1724 smartlist_free(headers);
1727 "Sent request to directory server %s "
1728 "(purpose: %d, request size: %"TOR_PRIuSZ
", "
1729 "payload size: %"TOR_PRIuSZ
")",
1732 (total_request_len),
1733 (payload ? payload_len : 0));
1754 for (i=0;i<32;++i) {
1755 if (!TOR_ISPRINT(body[i]) && !TOR_ISSPACE(body[i]))
1772 int descriptor_digests,
1777 char time_buf[ISO_TIME_LEN+1];
1784 "@downloaded-at %s\n"
1786 "%s%s%s", time_buf,
escaped(source),
1787 !general ?
"@purpose " :
"",
1789 !general ?
"\n" :
"")<0)
1793 descriptor_digests, buf);
1794 if (added && general)
1801 const response_handler_args_t *);
1803 const response_handler_args_t *);
1805 const response_handler_args_t *);
1807 const response_handler_args_t *);
1809 const response_handler_args_t *);
1811 const response_handler_args_t *);
1813 const response_handler_args_t *);
1815 const response_handler_args_t *);
1818 dir_client_decompress_response_body(
char **bodyp,
size_t *bodylenp,
1821 int anonymized_connection)
1824 const char *body = *bodyp;
1825 size_t body_len = *bodylenp;
1832 if (plausible && compression == NO_METHOD) {
1837 char *new_body = NULL;
1839 const char *description1, *description2;
1840 int want_to_try_both = 0;
1846 if (BUG(description1 == NULL))
1849 if (guessed == UNKNOWN_METHOD && !plausible)
1850 description2 =
"confusing binary junk";
1855 want_to_try_both = (compression == UNKNOWN_METHOD ||
1856 guessed != compression);
1857 if (want_to_try_both) {
1858 severity = LOG_PROTOCOL_WARN;
1862 "HTTP body from %s was labeled as %s, "
1863 "%s it seems to be %s.%s",
1866 guessed != compression?
"but":
"and",
1868 (compression>0 && guessed>0 && want_to_try_both)?
1869 " Trying both.":
"");
1875 if (anonymized_connection &&
1884 !allow_partial, LOG_PROTOCOL_WARN);
1894 if (anonymized_connection &&
1902 compression != guessed) {
1909 if (!plausible && !new_body) {
1911 "Unable to decompress HTTP body (tried %s%s%s, on %s).",
1913 tried_both?
" and ":
"",
1914 tried_both?description2:
"",
1926 *bodylenp = new_len;
1952 for (
int bootstrapped = 0; bootstrapped < 2; ++bootstrapped) {
1954 for (
int i=0; i < DIR_PURPOSE_MAX_; ++i) {
1955 uint64_t n =
total_dl[i][bootstrapped];
1958 if (options->SafeLogging_ != SAFELOG_SCRUB_NONE &&
1965 if (smartlist_len(lines) > 0) {
1967 log_notice(
LD_NET,
"While %sbootstrapping, fetched this many bytes: %s",
1968 bootstrapped?
"not ":
"", log_line);
1973 smartlist_free(lines);
1990 char *headers = NULL;
1991 char *reason = NULL;
1992 size_t body_len = 0;
1994 time_t date_header = 0;
2002 size_t received_bytes;
2003 const int anonymized_connection =
2008 received_bytes = connection_get_inbuf_len(
TO_CONN(conn));
2010 log_debug(
LD_DIR,
"Downloaded %"TOR_PRIuSZ
" bytes on connection of purpose "
2011 "%s; bootstrap %d%%",
2014 control_get_bootstrap_percent());
2016 bool bootstrapped = control_get_bootstrap_percent() == 100;
2026 "'fetch' response too large (%s). Closing.",
2031 "'fetch' response not all here, but we're at eof. Closing.");
2037 &compression, &reason) < 0) {
2038 log_warn(
LD_HTTP,
"Unparseable headers (%s). Closing.",
2043 if (!reason) reason = tor_strdup(
"[no reason given]");
2046 "Received response on %s: %d %s "
2047 "(purpose: %d, response size: %"TOR_PRIuSZ
2048 #ifdef MEASUREMENTS_21206
2049 ", data cells received: %d, data cells sent: %d"
2051 ", compression: %d)",
2056 #ifdef MEASUREMENTS_21206
2057 conn->data_cells_received, conn->data_cells_sent,
2080 log_debug(
LD_DIR,
"Malformed X-Your-Address-Is header %s. Ignoring.",
2089 if (date_header > 0) {
2099 "directory",
"DIRSERV");
2102 log_debug(
LD_HTTP,
"Time on received directory is within tolerance; "
2103 "we are %ld seconds skewed. (That's okay.)", apparent_skew);
2108 if (status_code == 503) {
2112 log_info(
LD_DIR,
"Received http status code %d (%s) from server "
2113 "%s. I'll try again soon.",
2126 if (dir_client_decompress_response_body(&body, &body_len,
2127 conn, compression, anonymized_connection) < 0) {
2132 response_handler_args_t args;
2133 memset(&args, 0,
sizeof(args));
2134 args.status_code = status_code;
2135 args.reason = reason;
2137 args.body_len = body_len;
2138 args.headers = headers;
2140 switch (conn->base_.
purpose) {
2195 const response_handler_args_t *args)
2198 const int status_code = args->status_code;
2199 const char *body = args->body;
2200 const size_t body_len = args->body_len;
2201 const char *reason = args->reason;
2204 const char *consensus;
2205 char *new_consensus = NULL;
2206 const char *sourcename;
2210 if (status_code != 200) {
2213 "Received http status code %d (%s) from server "
2214 "%s while fetching consensus directory.",
2224 const char *consensus_body = NULL;
2225 size_t consensus_body_len;
2228 consensus_body = cd->
dir;
2229 consensus_body_len = cd->
dir_len;
2232 if (mapped_consensus) {
2233 consensus_body = mapped_consensus->
data;
2234 consensus_body_len = mapped_consensus->
size;
2237 if (!consensus_body) {
2238 log_warn(
LD_DIR,
"Received a consensus diff, but we can't find "
2239 "any %s-flavored consensus in our current cache.",flavname);
2240 tor_munmap_file(mapped_consensus);
2248 tor_munmap_file(mapped_consensus);
2249 if (new_consensus == NULL) {
2250 log_warn(
LD_DIR,
"Could not apply consensus diff received from server "
2257 log_info(
LD_DIR,
"Applied consensus diff (size %d) from server "
2258 "%s, resulting in a new consensus document (size %d).",
2260 (
int)strlen(new_consensus));
2261 consensus = new_consensus;
2262 sourcename =
"generated based on a diff";
2264 log_info(
LD_DIR,
"Received consensus directory (body size %d) from server "
2267 sourcename =
"downloaded";
2275 "Unable to load %s consensus directory %s from "
2276 "server %s. I'll try again soon.",
2277 flavname, sourcename,
2285 connection_dir_close_consensus_fetches(conn, flavname);
2296 log_info(
LD_DIR,
"Successfully loaded consensus.");
2308 const response_handler_args_t *args)
2311 const int status_code = args->status_code;
2312 const char *reason = args->reason;
2313 const char *body = args->body;
2314 const size_t body_len = args->body_len;
2316 if (status_code != 200) {
2318 "Received http status code %d (%s) from server "
2319 "%s while fetching \"/tor/keys/%s\".",
2326 log_info(
LD_DIR,
"Received authority certificates (body size %d) from "
2336 src_code = TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_DIGEST;
2338 src_code = TRUSTED_DIRS_CERTS_SRC_DL_BY_ID_SK_DIGEST;
2341 if (src_code != -1) {
2344 log_warn(
LD_DIR,
"Unable to parse fetched certificates");
2351 log_info(
LD_DIR,
"Successfully loaded certificates from fetch.");
2355 "Couldn't figure out what to do with fetched certificates for "
2356 "unknown resource %s",
2369 const response_handler_args_t *args)
2372 const int status_code = args->status_code;
2373 const char *reason = args->reason;
2374 const char *body = args->body;
2375 const size_t body_len = args->body_len;
2379 log_notice(
LD_DIR,
"Got votes (body size %d) from server %s",
2381 if (status_code != 200) {
2383 "Received http status code %d (%s) from server "
2384 "%s while fetching \"/tor/status-vote/next/%s.z\".",
2392 log_warn(
LD_DIR,
"Error adding retrieved vote: %s", msg);
2394 log_info(
LD_DIR,
"Added vote(s) successfully [msg: %s]", msg);
2406 const response_handler_args_t *args)
2409 const int status_code = args->status_code;
2410 const char *reason = args->reason;
2411 const char *body = args->body;
2412 const size_t body_len = args->body_len;
2414 const char *msg = NULL;
2415 log_info(
LD_DIR,
"Got detached signatures (body size %d) from server %s",
2418 if (status_code != 200) {
2420 "Received http status code %d (%s) from server %s while fetching "
2421 "\"/tor/status-vote/next/consensus-signatures.z\".",
2427 log_warn(
LD_DIR,
"Problem adding detached signatures from %s: %s",
2441 const response_handler_args_t *args)
2445 const int status_code = args->status_code;
2446 const char *reason = args->reason;
2447 const char *body = args->body;
2448 const size_t body_len = args->body_len;
2452 int n_asked_for = 0;
2455 log_info(
LD_DIR,
"Received %s (body size %d) from server %s",
2456 was_ei ?
"extra server info" :
"server info",
2463 (descriptor_digests ? 2 : 3),
2465 n_asked_for = smartlist_len(which);
2467 if (status_code != 200) {
2468 int dir_okay = status_code == 404 ||
2469 (status_code == 400 && !strcmp(reason,
"Servers unavailable.")) ||
2476 "Received http status code %d (%s) from server %s "
2477 "while fetching \"/tor/server/%s\". I'll try again soon.",
2486 was_ei, descriptor_digests);
2488 smartlist_free(which);
2490 return dir_okay ? 0 : -1;
2507 descriptor_digests);
2520 log_info(
LD_DIR,
"Received %d/%d %s requested from %s",
2521 n_asked_for-smartlist_len(which), n_asked_for,
2522 was_ei ?
"extra-info documents" :
"router descriptors",
2524 if (smartlist_len(which)) {
2527 was_ei, descriptor_digests);
2530 smartlist_free(which);
2542 const response_handler_args_t *args)
2545 const int status_code = args->status_code;
2546 const char *reason = args->reason;
2547 const char *body = args->body;
2548 const size_t body_len = args->body_len;
2551 log_info(
LD_DIR,
"Received answer to microdescriptor request (status %d, "
2552 "body size %d) from server %s",
2553 status_code, (
int)body_len,
2561 DSR_DIGEST256|DSR_BASE64);
2562 if (status_code != 200) {
2563 log_info(
LD_DIR,
"Received status code %d (%s) from server "
2564 "%s while fetching \"/tor/micro/%s\". I'll try again "
2571 smartlist_free(which);
2579 if (smartlist_len(which)) {
2583 if (mds && smartlist_len(mds)) {
2589 smartlist_free(which);
2590 smartlist_free(mds);
2602 const response_handler_args_t *args)
2605 const int status_code = args->status_code;
2606 const char *reason = args->reason;
2607 const char *headers = args->headers;
2609 switch (status_code) {
2614 "X-Descriptor-Not-New: ");
2616 if (!strcmp(rejected_hdr,
"Yes")) {
2618 "Authority '%s' declined our descriptor (not new)",
2630 log_info(
LD_GENERAL,
"eof (status 200) after uploading server "
2631 "descriptor: finished.");
2633 LOG_NOTICE,
"ACCEPTED_SERVER_DESCRIPTOR DIRAUTH=%s:%d",
2642 log_warn(
LD_GENERAL,
"http status 400 (%s) response from "
2643 "dirserver %s. Please correct.",
2646 "BAD_SERVER_DESCRIPTOR DIRAUTH=%s:%d REASON=\"%s\"",
2651 "HTTP status %d (%s) was unexpected while uploading "
2652 "descriptor to server %s'. Possibly the server is "
2670 const response_handler_args_t *args)
2673 const int status_code = args->status_code;
2674 const char *reason = args->reason;
2676 switch (status_code) {
2678 log_notice(
LD_DIR,
"Uploaded my vote to dirserver %s",
2683 log_warn(
LD_DIR,
"http status 400 (%s) response after uploading "
2684 "vote to dirserver %s. Please correct.",
2689 "HTTP status %d (%s) was unexpected while uploading "
2690 "vote to server %s.",
2706 const response_handler_args_t *args)
2709 const int status_code = args->status_code;
2710 const char *reason = args->reason;
2712 switch (status_code) {
2714 log_notice(
LD_DIR,
"Uploaded signature(s) to dirserver %s",
2719 log_warn(
LD_DIR,
"http status 400 (%s) response after uploading "
2720 "signatures to dirserver %s. Please correct.",
2725 "HTTP status %d (%s) was unexpected while uploading "
2726 "signatures to server %s.",
2743 const response_handler_args_t *args)
2745 const int status_code = args->status_code;
2746 const char *reason = args->reason;
2747 const char *body = args->body;
2748 const size_t body_len = args->body_len;
2752 log_info(
LD_REND,
"Received v3 hsdesc (body size %d, status %d (%s))",
2753 (
int)body_len, status_code,
escaped(reason));
2765 const response_handler_args_t *args)
2767 const int status_code = args->status_code;
2768 const char *reason = args->reason;
2773 log_info(
LD_REND,
"Uploaded hidden service descriptor (status %d "
2775 status_code,
escaped(reason));
2779 switch (status_code) {
2781 log_info(
LD_REND,
"Uploading hidden service descriptor: "
2782 "finished with status 200 (%s)",
escaped(reason));
2787 "Uploading hidden service descriptor: http "
2788 "status 400 (%s) response from dirserver "
2789 "%s. Malformed hidden service descriptor?",
2795 log_warn(
LD_REND,
"Uploading hidden service descriptor: http "
2796 "status %d (%s) response unexpected (server "
2814 log_info(
LD_HTTP,
"conn reached eof, not reading. [state=%d] Closing.",
2817 connection_mark_for_close(
TO_CONN(conn));
2824 connection_mark_for_close(
TO_CONN(conn));
2837 dir_conn->hs_ident &&
2867 char *header = NULL;
2878 smartlist_free(methods);
2899 if (method == allowed_method)
2912 "Received a %s HTTP response, which is not "
2913 "allowed for anonymous directory requests.",
2931 const char *resource)
2937 if (d == except_this_one)
2939 log_info(
LD_DIR,
"Closing consensus fetch (to %s) since one "
2941 connection_mark_for_close(
TO_CONN(d));
2942 } SMARTLIST_FOREACH_END(d);
2943 smartlist_free(conns_to_close);
2953 int was_extrainfo,
int was_descriptor_digests)
2956 time_t now = time(NULL);
2958 if (!was_descriptor_digests) {
2968 log_warn(
LD_BUG,
"Malformed fingerprint in list: %s",
escaped(cp));
2971 if (was_extrainfo) {
2982 } SMARTLIST_FOREACH_END(cp);
2995 int status_code,
const char *dir_id)
3001 time_t now = time(NULL);
3015 dls = &rs->dl_status;
3020 log_info(
LD_DIR,
"Failed to download md %s from %s",
3025 } SMARTLIST_FOREACH_END(d);
void tor_addr_copy(tor_addr_t *dest, const tor_addr_t *src)
int tor_addr_parse(tor_addr_t *addr, const char *src)
void tor_addr_make_null(tor_addr_t *a, sa_family_t family)
char * tor_addr_to_str_dup(const tor_addr_t *addr)
int tor_addr_is_null(const tor_addr_t *addr)
void tor_addr_port_copy(tor_addr_port_t *dest, const tor_addr_port_t *source)
static sa_family_t tor_addr_family(const tor_addr_t *a)
void authority_cert_dl_failed(const char *id_digest, const char *signing_key_digest, int status)
int trusted_dirs_load_certs_from_string(const char *contents, int source, int flush, const char *source_dir)
Header file for authcert.c.
Header file for directory authority mode.
const char * hex_str(const char *from, size_t fromlen)
int base16_decode(char *dest, size_t destlen, const char *src, size_t srclen)
void base16_encode(char *dest, size_t destlen, const char *src, size_t srclen)
void retry_bridge_descriptor_fetch_directly(const char *digest)
Header file for circuitbuild.c.
Cached large directory object structure.
int tor_compress_supports_method(compress_method_t method)
const char * compression_method_get_name(compress_method_t method)
const char * compression_method_get_human_name(compress_method_t method)
compress_method_t detect_compression_method(const char *in, size_t in_len)
int tor_uncompress(char **out, size_t *out_len, const char *in, size_t in_len, compress_method_t method, int complete_only, int protocol_warn_level)
const or_options_t * get_options(void)
Header file for config.c.
void config_line_prepend(config_line_t **lst, const char *key, const char *val)
void clock_skew_warning(const connection_t *conn, long apparent_skew, int trusted, log_domain_mask_t domain, const char *received, const char *source)
int connection_fetch_from_buf_http(connection_t *conn, char **headers_out, size_t max_headerlen, char **body_out, size_t *body_used, size_t max_bodylen, int force_complete)
dir_connection_t * dir_connection_new(int socket_family)
void connection_close_immediate(connection_t *conn)
const char * connection_describe(const connection_t *conn)
smartlist_t * connection_dir_list_by_purpose_and_resource(int purpose, const char *resource)
const char * connection_describe_peer(const connection_t *conn)
char * alloc_http_authenticator(const char *authenticator)
int connection_connect(connection_t *conn, const char *address, const tor_addr_t *addr, uint16_t port, int *socket_error)
Header file for connection.c.
entry_connection_t * connection_ap_make_link(connection_t *partner, char *address, uint16_t port, const char *digest, int session_group, int isolation_flags, int use_begindir, int want_onehop)
Header file for connection_edge.c.
char * consensus_diff_apply(const char *consensus, size_t consensus_len, const char *diff, size_t diff_len)
int looks_like_a_consensus_diff(const char *document, size_t len)
void control_event_boot_dir(bootstrap_status_t status, int progress)
int control_event_server_status(int severity, const char *format,...)
Header file for control_events.c.
#define BASE64_DIGEST256_LEN
#define HEX_DIGEST256_LEN
int ed25519_public_key_is_zero(const ed25519_public_key_t *pubkey)
Common functions for cryptographic routines.
Compile-time assertions: CTASSERT(expression).
const char * routerstatus_describe(const routerstatus_t *rs)
Header file for describe.c.
Client/server directory connection structure.
Trusted/fallback directory server structure.
STATIC void warn_disallowed_anonymous_compression_method(compress_method_t method)
void directory_request_set_resource(directory_request_t *req, const char *resource)
void directory_request_set_or_addr_port(directory_request_t *req, const tor_addr_port_t *p)
static void connection_dir_download_cert_failed(dir_connection_t *conn, int status_code)
void directory_get_from_all_authorities(uint8_t dir_purpose, uint8_t router_purpose, const char *resource)
static int handle_response_upload_hsdesc(dir_connection_t *, const response_handler_args_t *)
static void connection_dir_download_routerdesc_failed(dir_connection_t *conn)
void directory_request_set_if_modified_since(directory_request_t *req, time_t if_modified_since)
#define ALLOW_DIRECTORY_TIME_SKEW
static void dir_microdesc_download_failed(smartlist_t *failed, int status_code, const char *dir_id)
void connection_dir_client_request_failed(dir_connection_t *conn)
static void connection_dir_retry_bridges(smartlist_t *descs)
static compress_method_t client_meth_allowed_anonymous_compression[]
static int directory_command_should_use_begindir(const or_options_t *options, const directory_request_t *req, const char **reason)
STATIC int handle_response_fetch_consensus(dir_connection_t *conn, const response_handler_args_t *args)
static void connection_dir_bridge_routerdesc_failed(dir_connection_t *conn)
STATIC int should_use_directory_guards(const or_options_t *options)
void directory_request_set_dir_addr_port(directory_request_t *req, const tor_addr_port_t *p)
void connection_dir_client_refetch_hsdesc_if_needed(dir_connection_t *dir_conn)
static int handle_response_fetch_certificate(dir_connection_t *, const response_handler_args_t *)
void directory_request_set_guard_state(directory_request_t *req, circuit_guard_state_t *state)
void dirclient_dump_total_dls(void)
STATIC int allowed_anonymous_connection_compression_method(compress_method_t method)
void directory_request_set_indirection(directory_request_t *req, dir_indirection_t indirection)
void directory_request_free_(directory_request_t *req)
static int handle_response_upload_vote(dir_connection_t *, const response_handler_args_t *)
void directory_request_set_routerstatus(directory_request_t *req, const routerstatus_t *status)
directory_request_t * directory_request_new(uint8_t dir_purpose)
static int connection_dir_client_reached_eof(dir_connection_t *conn)
STATIC char * accept_encoding_header(void)
STATIC const char * dir_conn_purpose_to_string(int purpose)
static const routerstatus_t * directory_pick_generic_dirserver(dirinfo_type_t type, int pds_flags, uint8_t dir_purpose, circuit_guard_state_t **guard_state_out)
static int handle_response_fetch_desc(dir_connection_t *, const response_handler_args_t *)
static int load_downloaded_routers(const char *body, smartlist_t *which, int descriptor_digests, int router_purpose, const char *source)
void directory_request_set_router_purpose(directory_request_t *req, uint8_t router_purpose)
static int handle_response_fetch_status_vote(dir_connection_t *, const response_handler_args_t *)
static int body_is_plausible(const char *body, size_t body_len, int purpose)
static compress_method_t client_meth_pref[]
static void dir_consensus_request_set_additional_headers(directory_request_t *req, const char *resource)
static int handle_response_fetch_detached_signatures(dir_connection_t *, const response_handler_args_t *)
void directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose, const char *resource, int pds_flags, download_want_authority_t want_authority)
static void copy_ipv6_address(char *destination, const char *source, size_t len, int decorate)
void directory_request_set_directory_id_digest(directory_request_t *req, const char *digest)
void directory_post_to_dirservers(uint8_t dir_purpose, uint8_t router_purpose, dirinfo_type_t type, const char *payload, size_t payload_len, size_t extrainfo_len)
static int handle_response_upload_signatures(dir_connection_t *, const response_handler_args_t *)
static int handle_response_upload_dir(dir_connection_t *, const response_handler_args_t *)
STATIC int handle_response_fetch_hsdesc_v3(dir_connection_t *conn, const response_handler_args_t *args)
void directory_initiate_request(directory_request_t *request)
static int directory_request_set_dir_from_routerstatus(directory_request_t *req)
static int directory_request_dir_contact_info_specified(const directory_request_t *req)
void directory_request_set_payload(directory_request_t *req, const char *payload, size_t payload_len)
int connection_dir_reached_eof(dir_connection_t *conn)
static void directory_send_command(dir_connection_t *conn, const int direct, const directory_request_t *req)
static char * directory_get_consensus_url(const char *resource)
STATIC dirinfo_type_t dir_fetch_type(int dir_purpose, int router_purpose, const char *resource)
static int dirind_is_anon(dir_indirection_t ind)
void directory_request_fetch_set_hs_ident(directory_request_t *req, const hs_ident_dir_conn_t *ident)
STATIC int handle_response_fetch_microdesc(dir_connection_t *conn, const response_handler_args_t *args)
int router_supports_extrainfo(const char *identity_digest, int is_authority)
int directories_have_accepted_server_descriptor(void)
static uint64_t total_dl[DIR_PURPOSE_MAX_][2]
static void dir_routerdesc_download_failed(smartlist_t *failed, int status_code, int router_purpose, int was_extrainfo, int was_descriptor_digests)
void directory_request_add_header(directory_request_t *req, const char *key, const char *val)
static int compare_strs_(const void **a, const void **b)
void directory_request_upload_set_hs_ident(directory_request_t *req, const hs_ident_dir_conn_t *ident)
Header file for dirclient.c.
struct directory_request_t directory_request_t
int dirclient_fetches_from_authorities(const or_options_t *options)
Header for feature/dirclient/dirclient_modes.c.
int purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose, const char *resource)
char * authdir_type_to_string(dirinfo_type_t auth)
int dir_split_resource_into_fingerprint_pairs(const char *res, smartlist_t *pairs_out)
int parse_http_response(const char *headers, int *code, time_t *date, compress_method_t *compression, char **reason)
char * http_get_header(const char *headers, const char *which)
int dir_split_resource_into_fingerprints(const char *resource, smartlist_t *fp_out, int *compressed_out, int flags)
Header file for directory.c.
#define DIR_PURPOSE_FETCH_EXTRAINFO
#define DIR_PURPOSE_FETCH_CERTIFICATE
#define DIR_PURPOSE_UPLOAD_HSDESC
#define DIR_PURPOSE_FETCH_MICRODESC
#define DIR_CONN_STATE_CONNECTING
#define DIR_CONN_STATE_CLIENT_FINISHED
#define DIR_CONN_STATE_CLIENT_READING
#define DIR_PURPOSE_UPLOAD_VOTE
#define DIR_PURPOSE_FETCH_DETACHED_SIGNATURES
#define DIR_PURPOSE_IS_UPLOAD(p)
#define DIR_PURPOSE_FETCH_CONSENSUS
#define DIR_PURPOSE_SERVER
#define DIR_PURPOSE_FETCH_SERVERDESC
#define DIR_PURPOSE_UPLOAD_SIGNATURES
#define DIR_CONN_STATE_CLIENT_SENDING
#define DIR_PURPOSE_FETCH_STATUS_VOTE
#define DIR_PURPOSE_HAS_FETCHED_HSDESC
#define DIR_PURPOSE_UPLOAD_DIR
#define DIR_PURPOSE_FETCH_HSDESC
dir_server_t * router_get_trusteddirserver_by_digest(const char *digest)
const tor_addr_port_t * trusted_dir_server_get_dirport_exact(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
auth_dirport_usage_t auth_dirport_usage_for_purpose(int purpose)
const tor_addr_port_t * trusted_dir_server_get_dirport(const dir_server_t *ds, auth_dirport_usage_t usage, int addr_family)
dir_server_t * router_get_fallback_dirserver_by_digest(const char *digest)
Header file for dirlist.c.
cached_dir_t * dirserv_get_consensus(const char *flavor_name)
Header file for dirserv.c.
int dirvote_add_signatures(const char *detached_signatures_body, const char *source, const char **msg)
pending_vote_t * dirvote_add_vote(const char *vote_body, time_t time_posted, const char *where_from, const char **msg_out, int *status_out)
Header file for dirvote.c.
time_t download_status_increment_failure(download_status_t *dls, int status_code, const char *item, int server, time_t now)
Header file for dlstatus.c.
Entry connection structure.
void entry_guard_failed(circuit_guard_state_t **guard_state_p)
void entry_guard_cancel(circuit_guard_state_t **guard_state_p)
int entry_list_is_constrained(const or_options_t *options)
guard_usable_t entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
const node_t * guards_choose_dirguard(uint8_t dir_purpose, circuit_guard_state_t **guard_state_out)
Header file for circuitbuild.c.
const char * escaped(const char *s)
Header file for fp_pair.c.
Header file for hs_cache.c.
int hs_client_refetch_hsdesc(const ed25519_public_key_t *identity_pk)
void hs_client_dir_fetch_done(dir_connection_t *dir_conn, const char *reason, const char *body, const int status_code)
Header file containing client data for the HS subsystem.
void hs_control_desc_event_uploaded(const hs_ident_dir_conn_t *ident, const char *hsdir_id_digest)
void hs_control_desc_event_failed(const hs_ident_dir_conn_t *ident, const char *hsdir_id_digest, const char *reason)
Header file containing control port event related code.
hs_ident_dir_conn_t * hs_ident_dir_conn_dup(const hs_ident_dir_conn_t *src)
void tor_log(int severity, log_domain_mask_t domain, const char *format,...)
#define log_fn(severity, domain, args,...)
void connection_watch_events(connection_t *conn, watchable_events_t events)
void directory_all_unreachable(time_t now)
void connection_start_reading(connection_t *conn)
void directory_info_has_arrived(time_t now, int from_cache, int suppress_logs)
Header file for mainloop.c.
void microdesc_note_outdated_dirserver(const char *relay_digest)
smartlist_t * microdescs_add_to_cache(microdesc_cache_t *cache, const char *s, const char *eos, saved_location_t where, int no_save, time_t listed_at, smartlist_t *requested_digests256)
microdesc_cache_t * get_microdesc_cache(void)
void update_microdescs_from_networkstatus(time_t now)
Header file for microdesc.c.
networkstatus_t * networkstatus_get_latest_consensus_by_flavor(consensus_flavor_t f)
void routers_update_all_from_networkstatus(time_t now, int dir_version)
int networkstatus_parse_flavor_name(const char *flavname)
int networkstatus_set_current_consensus(const char *consensus, size_t consensus_len, const char *flavor, unsigned flags, const char *source_dir)
download_status_t * router_get_dl_status_by_descriptor_digest(const char *d)
void update_certificate_downloads(time_t now)
tor_mmap_t * networkstatus_map_cached_consensus(const char *flavorname)
int32_t networkstatus_get_param(const networkstatus_t *ns, const char *param_name, int32_t default_val, int32_t min_val, int32_t max_val)
routerstatus_t * router_get_mutable_consensus_status_by_id(const char *digest)
routerstatus_t * router_get_mutable_consensus_status_by_descriptor_digest(networkstatus_t *consensus, const char *digest)
void networkstatus_consensus_download_failed(int status_code, const char *flavname)
Header file for networkstatus.c.
Networkstatus consensus/vote structure.
const routerstatus_t * router_pick_fallback_dirserver(dirinfo_type_t type, int flags)
const routerstatus_t * router_pick_directory_server(dirinfo_type_t type, int flags)
const routerstatus_t * router_pick_trusteddirserver(dirinfo_type_t type, int flags)
Header file for node_select.c.
#define PDS_NO_EXISTING_SERVERDESC_FETCH
#define PDS_NO_EXISTING_MICRODESC_FETCH
#define PDS_IGNORE_FASCISTFIREWALL
Node information structure.
const node_t * node_get_by_id(const char *identity_digest)
int count_loading_descriptors_progress(void)
void router_set_status(const char *digest, int up)
Header file for nodelist.c.
Master header file for Tor-specific functionality.
#define SESSION_GROUP_DIRCONN
download_want_authority_t
int reachable_addr_allows_addr(const tor_addr_t *addr, uint16_t port, firewall_connection_t fw_connection, int pref_only, int pref_ipv6)
void reachable_addr_choose_from_node(const node_t *node, firewall_connection_t fw_connection, int pref_only, tor_addr_port_t *ap)
void reachable_addr_choose_from_rs(const routerstatus_t *rs, firewall_connection_t fw_connection, int pref_only, tor_addr_port_t *ap)
int reachable_addr_allows_dir_server(const dir_server_t *ds, firewall_connection_t fw_connection, int pref_only)
Header file for policies.c.
void rep_hist_note_used_port(time_t now, uint16_t port)
void rep_hist_note_used_internal(time_t now, int need_uptime, int need_capacity)
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,...)
void relay_address_new_suggestion(const tor_addr_t *suggested_addr, const tor_addr_t *peer_addr, const char *identity_digest)
Header file for relay_find_addr.c.
Header file for rendcommon.c.
const char * router_get_descriptor_gen_reason(void)
int router_digest_is_me(const char *digest)
const char * router_purpose_to_string(uint8_t p)
Header file for routerinfo.c.
Router descriptor structure.
#define ROUTER_PURPOSE_GENERAL
#define ROUTER_PURPOSE_BRIDGE
void router_load_extrainfo_from_string(const char *s, const char *eos, saved_location_t saved_location, smartlist_t *requested_fingerprints, int descriptor_digests)
int router_load_routers_from_string(const char *s, const char *eos, saved_location_t saved_location, smartlist_t *requested_fingerprints, int descriptor_digests, const char *prepend_annotations)
signed_descriptor_t * router_get_by_extrainfo_digest(const char *digest)
Header file for routerlist.c.
int public_server_mode(const or_options_t *options)
Header file for routermode.c.
int routerset_contains_routerstatus(const routerset_t *set, const routerstatus_t *rs, country_t country)
Header file for routerset.c.
Header file for selftest.c.
void sr_act_post_consensus(const networkstatus_t *consensus)
This file contains ABI/API of the shared random protocol defined in proposal #250....
void smartlist_add_asprintf(struct smartlist_t *sl, const char *pattern,...)
char * smartlist_join_strings(smartlist_t *sl, const char *join, int terminate, size_t *len_out)
void smartlist_sort(smartlist_t *sl, int(*compare)(const void **a, const void **b))
smartlist_t * smartlist_new(void)
void smartlist_add(smartlist_t *sl, void *element)
#define SMARTLIST_FOREACH_BEGIN(sl, type, var)
#define SMARTLIST_FOREACH(sl, type, var, cmd)
uint8_t digest_sha3_as_signed[DIGEST256_LEN]
time_t timestamp_last_write_allowed
unsigned int dirconn_direct
char identity_digest[DIGEST_LEN]
char * requested_resource
struct circuit_guard_state_t * guard_state
routerstatus_t fake_status
unsigned int has_accepted_serverdesc
ed25519_public_key_t identity_pk
dirinfo_type_t PublishServerDescriptor_
int FetchServerDescriptors
int FetchDirInfoExtraEarly
char * HTTPProxyAuthenticator
int FetchUselessDescriptors
struct routerset_t * ExcludeNodes
unsigned int caches_extra_info
char identity_digest[DIGEST_LEN]
download_status_t ei_dl_status
#define MOCK_IMPL(rv, funcname, arglist)
void format_rfc1123_time(char *buf, time_t t)
void format_iso_time(char *buf, time_t t)
#define tor_assert_nonfatal_unreached()
int strcmpstart(const char *s1, const char *s2)
int fast_mem_is_zero(const char *mem, size_t len)
int tor_digest_is_zero(const char *digest)
#define ED25519_BASE64_LEN