Merge remote-tracking branch 'public/bug8151'

This commit is contained in:
Nick Mathewson 2013-02-05 00:33:04 -05:00
commit 2dcad03eba
4 changed files with 35 additions and 0 deletions

5
changes/bug8151 Normal file
View File

@ -0,0 +1,5 @@
o Minor features (directory authority):
- Include inside each vote a statement of the performance
thresholds that made the authority vote for its flags. Implements
ticket 8151.

View File

@ -2059,6 +2059,30 @@ dirserv_compute_performance_thresholds(routerlist_t *rl,
tor_free(wfus);
}
/** Give a statement of our current performance thresholds for inclusion
* in a vote document. */
char *
dirserv_get_flag_thresholds_line(void)
{
char *result=NULL;
tor_asprintf(&result,
"stable-uptime=%lu stable-mtbf=%lu "
"fast-speed=%lu "
"guard-wfu=%.03f%% guard-tk=%lu "
"guard-bw-inc-exits=%lu guard-bw-exc-exits=%lu "
"enough-mtbf=%d",
(unsigned long)stable_uptime,
(unsigned long)stable_mtbf,
(unsigned long)fast_bandwidth,
guard_wfu*100,
(unsigned long)guard_tk,
(unsigned long)guard_bandwidth_including_exits,
(unsigned long)guard_bandwidth_excluding_exits,
enough_mtbf_info ? 1 : 0);
return result;
}
/** Given a platform string as in a routerinfo_t (possibly null), return a
* newly allocated version string for a networkstatus document, or NULL if the
* platform doesn't give a Tor version. */

View File

@ -70,6 +70,7 @@ int list_server_status_v1(smartlist_t *routers, char **router_status_out,
int for_controller);
int dirserv_dump_directory_to_string(char **dir_out,
crypto_pk_t *private_key);
char *dirserv_get_flag_thresholds_line(void);
int directory_fetches_from_authorities(const or_options_t *options);
int directory_fetches_dir_info_early(const or_options_t *options);

View File

@ -134,6 +134,8 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
char fu[ISO_TIME_LEN+1];
char vu[ISO_TIME_LEN+1];
char *flags = smartlist_join_strings(v3_ns->known_flags, " ", 0, NULL);
/* XXXX Abstraction violation: should be pulling a field out of v3_ns.*/
char *flag_thresholds = dirserv_get_flag_thresholds_line();
char *params;
authority_cert_t *cert = v3_ns->cert;
char *methods =
@ -160,6 +162,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
"voting-delay %d %d\n"
"%s" /* versions */
"known-flags %s\n"
"flag-thresholds %s\n"
"params %s\n"
"dir-source %s %s %s %s %d %d\n"
"contact %s\n",
@ -169,6 +172,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
v3_ns->vote_seconds, v3_ns->dist_seconds,
version_lines,
flags,
flag_thresholds,
params,
voter->nickname, fingerprint, voter->address,
fmt_addr32(addr), voter->dir_port, voter->or_port,
@ -181,6 +185,7 @@ format_networkstatus_vote(crypto_pk_t *private_signing_key,
tor_free(params);
tor_free(flags);
tor_free(flag_thresholds);
tor_free(methods);
outp = status + strlen(status);
endp = status + len;