stats: add comments about the required chunk structure in extra info files

These comments should prevent future instances of 30958.

And allow a larger file in practracker.

Follow up after 30958.
This commit is contained in:
teor 2019-06-24 21:20:34 +10:00
parent 2663bca392
commit c131b0763e
No known key found for this signature in database
GPG Key ID: 10FEAA0E7075672A
2 changed files with 11 additions and 1 deletions

View File

@ -225,7 +225,7 @@ problem function-size /src/feature/nodelist/routerlist.c:update_extrainfo_downlo
problem function-size /src/feature/relay/dns.c:dns_resolve_impl() 134
problem function-size /src/feature/relay/dns.c:configure_nameservers() 161
problem function-size /src/feature/relay/dns.c:evdns_callback() 109
problem file-size /src/feature/relay/router.c 3510
problem file-size /src/feature/relay/router.c 3522
problem include-count /src/feature/relay/router.c 56
problem function-size /src/feature/relay/router.c:init_keys() 252
problem function-size /src/feature/relay/router.c:get_my_declared_family() 114

View File

@ -3158,6 +3158,8 @@ extrainfo_dump_to_string_header_helper(
ed_cert_line = tor_strdup("");
}
/* This is the first chunk in the file. If the file is too big, other chunks
* are removed. So we must only add one chunk here. */
tor_asprintf(&pre, "extra-info %s %s\n%spublished %s\n",
extrainfo->nickname, identity,
ed_cert_line,
@ -3187,6 +3189,10 @@ extrainfo_dump_to_string_stats_helper(smartlist_t *chunks,
char *contents = NULL;
time_t now = time(NULL);
/* If the file is too big, these chunks are removed, starting with the last
* chunk. So each chunk must be a complete line, and the file must be valid
* after each chunk. */
/* Add information about the pluggable transports we support, even if we
* are not publishing statistics. This information is needed by BridgeDB
* to distribute bridges. */
@ -3269,6 +3275,8 @@ extrainfo_dump_to_string_ed_sig_helper(
char buf[ED25519_SIG_BASE64_LEN+1];
int rv = -1;
/* These are two of the three final chunks in the file. If the file is too
* big, other chunks are removed. So we must only add two chunks here. */
smartlist_add_strdup(chunks, "router-sig-ed25519 ");
crypto_digest_smartlist_prefix(sha256_digest, DIGEST256_LEN,
ED_DESC_SIGNATURE_PREFIX,
@ -3362,6 +3370,8 @@ extrainfo_dump_to_string(char **s_out, extrainfo_t *extrainfo,
goto err;
}
/* This is one of the three final chunks in the file. If the file is too big,
* other chunks are removed. So we must only add one chunk here. */
smartlist_add_strdup(chunks, "router-signature\n");
s = smartlist_join_strings(chunks, "", 0, NULL);