aboutsummaryrefslogtreecommitdiff
path: root/src/feature/dirauth
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-11-25 10:05:13 -0500
committerNick Mathewson <nickm@torproject.org>2018-11-25 10:05:13 -0500
commit36f808c9364bb2e6781e555697eac977d754e905 (patch)
treee95fc5c5093b1391bd0ca179ffdee492497b385a /src/feature/dirauth
parent3741f9e524a2d3bd7239ca865d6169fd1e3dddb5 (diff)
downloadtor-36f808c9364bb2e6781e555697eac977d754e905.tar.gz
tor-36f808c9364bb2e6781e555697eac977d754e905.zip
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.
Diffstat (limited to 'src/feature/dirauth')
-rw-r--r--src/feature/dirauth/dirvote.c3
-rw-r--r--src/feature/dirauth/voteflags.c4
-rw-r--r--src/feature/dirauth/voteflags.h3
3 files changed, 9 insertions, 1 deletions
diff --git a/src/feature/dirauth/dirvote.c b/src/feature/dirauth/dirvote.c
index 066a9e6e8a..aa4242f678 100644
--- a/src/feature/dirauth/dirvote.c
+++ b/src/feature/dirauth/dirvote.c
@@ -4620,7 +4620,8 @@ dirserv_generate_networkstatus_vote_obj(crypto_pk_t *private_key,
v3_out->known_flags = smartlist_new();
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);
if (vote_on_reachability)
smartlist_add_strdup(v3_out->known_flags, "Running");
diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c
index 4a24dcb50d..5adf21ad11 100644
--- a/src/feature/dirauth/voteflags.c
+++ b/src/feature/dirauth/voteflags.c
@@ -593,6 +593,10 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
rs->or_port = ri->or_port;
rs->dir_port = ri->dir_port;
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 &&
!tor_addr_is_null(&ri->ipv6_addr) &&
node->last_reachable6 >= now - REACHABLE_TIMEOUT) {
diff --git a/src/feature/dirauth/voteflags.h b/src/feature/dirauth/voteflags.h
index 2f0e061ea4..743a666cc8 100644
--- a/src/feature/dirauth/voteflags.h
+++ b/src/feature/dirauth/voteflags.h
@@ -25,6 +25,9 @@ void set_routerstatus_from_routerinfo(routerstatus_t *rs,
void dirserv_compute_performance_thresholds(digestmap_t *omit_as_sybil);
#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);
#endif