Vote on the StaleDesc flag from prop293

The StaleDesc flag tells relays that they need to upload a new
descriptor soon, or they will drop out of the consensus.
This commit is contained in:
Nick Mathewson 2018-11-25 10:05:13 -05:00
parent 3741f9e524
commit 36f808c936
6 changed files with 15 additions and 2 deletions

View File

@ -4620,7 +4620,8 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
v3_out->known_flags = smartlist_new(); v3_out->known_flags = smartlist_new();
smartlist_split_string(v3_out->known_flags, smartlist_split_string(v3_out->known_flags,
"Authority Exit Fast Guard Stable V2Dir Valid HSDir", "Authority Exit Fast Guard Stable V2Dir Valid HSDir "
"StaleDesc",
0, SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0); 0, SPLIT_SKIP_SPACE|SPLIT_IGNORE_BLANK, 0);
if (vote_on_reachability) if (vote_on_reachability)
smartlist_add_strdup(v3_out->known_flags, "Running"); smartlist_add_strdup(v3_out->known_flags, "Running");

View File

@ -593,6 +593,10 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
rs->or_port = ri->or_port; rs->or_port = ri->or_port;
rs->dir_port = ri->dir_port; rs->dir_port = ri->dir_port;
rs->is_v2_dir = ri->supports_tunnelled_dir_requests; rs->is_v2_dir = ri->supports_tunnelled_dir_requests;
rs->is_staledesc =
(ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now;
if (options->AuthDirHasIPv6Connectivity == 1 && if (options->AuthDirHasIPv6Connectivity == 1 &&
!tor_addr_is_null(&ri->ipv6_addr) && !tor_addr_is_null(&ri->ipv6_addr) &&
node->last_reachable6 >= now - REACHABLE_TIMEOUT) { node->last_reachable6 >= now - REACHABLE_TIMEOUT) {

View File

@ -25,6 +25,9 @@ void set_routerstatus_from_routerinfo(routerstatus_t *rs,
void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil); void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil);
#ifdef VOTEFLAGS_PRIVATE #ifdef VOTEFLAGS_PRIVATE
/** Any descriptor older than this age causes the authorities to set the
* StaleDesc flag. */
#define DESC_IS_STALE_INTERVAL (18*60*60)
STATIC void dirserv_set_routerstatus_testing(routerstatus_t *rs); STATIC void dirserv_set_routerstatus_testing(routerstatus_t *rs);
#endif #endif

View File

@ -434,6 +434,8 @@ routerstatus_parse_entry_from_string(memarea_t *area,
rs->is_hs_dir = 1; rs->is_hs_dir = 1;
} else if (!strcmp(tok->args[i], "V2Dir")) { } else if (!strcmp(tok->args[i], "V2Dir")) {
rs->is_v2_dir = 1; rs->is_v2_dir = 1;
} else if (!strcmp(tok->args[i], "StaleDesc")) {
rs->is_staledesc = 1;
} }
} }
/* These are implied true by having been included in a consensus made /* These are implied true by having been included in a consensus made

View File

@ -135,7 +135,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
goto done; goto done;
smartlist_add_asprintf(chunks, smartlist_add_asprintf(chunks,
"s%s%s%s%s%s%s%s%s%s%s\n", "s%s%s%s%s%s%s%s%s%s%s%s\n",
/* These must stay in alphabetical order. */ /* These must stay in alphabetical order. */
rs->is_authority?" Authority":"", rs->is_authority?" Authority":"",
rs->is_bad_exit?" BadExit":"", rs->is_bad_exit?" BadExit":"",
@ -145,6 +145,7 @@ routerstatus_format_entry(const routerstatus_t *rs, const char *version,
rs->is_hs_dir?" HSDir":"", rs->is_hs_dir?" HSDir":"",
rs->is_flagged_running?" Running":"", rs->is_flagged_running?" Running":"",
rs->is_stable?" Stable":"", rs->is_stable?" Stable":"",
rs->is_staledesc?" StaleDesc":"",
rs->is_v2_dir?" V2Dir":"", rs->is_v2_dir?" V2Dir":"",
rs->is_valid?" Valid":""); rs->is_valid?" Valid":"");

View File

@ -47,6 +47,8 @@ struct routerstatus_t {
unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort unsigned int is_v2_dir:1; /** True iff this router publishes an open DirPort
* or it claims to accept tunnelled dir requests. * or it claims to accept tunnelled dir requests.
*/ */
unsigned int is_staledesc:1; /** True iff the authorities think this router
* should upload a new descriptor soon. */
unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */ unsigned int has_bandwidth:1; /**< The vote/consensus had bw info */
unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */ unsigned int has_exitsummary:1; /**< The vote/consensus had exit summaries */