diff --git a/src/or/dirserv.c b/src/or/dirserv.c
index 760497259d..7fe5bcab3d 100644
--- a/src/or/dirserv.c
+++ b/src/or/dirserv.c
@@ -1219,6 +1219,23 @@ should_generate_v2_networkstatus(void)
the_v2_networkstatus_is_dirty + DIR_REGEN_SLACK_TIME < time(NULL);
}
+/** Return 1 if router is not suitable for these parameters, else 0.
+ * If need_uptime is non-zero, we require a minimum uptime.
+ * If need_capacity is non-zero, we require a minimum advertised
+ * bandwidth.
+ */
+static int
+dirserv_thinks_router_is_unreliable(routerinfo_t *router,
+ int need_uptime, int need_capacity)
+{
+ if (need_uptime && router->uptime < ROUTER_REQUIRED_MIN_UPTIME)
+ return 1;
+ if (need_capacity &&
+ router->bandwidthcapacity < ROUTER_REQUIRED_MIN_BANDWIDTH)
+ return 1;
+ return 0;
+}
+
/** For authoritative directories only: replace the contents of
* the_v2_networkstatus with a newly generated network status
* object. */
@@ -1309,8 +1326,8 @@ generate_v2_networkstatus(void)
SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
int f_exit = router_is_general_exit(ri);
- int f_stable = !router_is_unreliable(ri, 1, 0);
- int f_fast = !router_is_unreliable(ri, 0, 1);
+ int f_stable = !dirserv_thinks_router_is_unreliable(ri, 1, 0);
+ int f_fast = !dirserv_thinks_router_is_unreliable(ri, 0, 1);
int f_running;
int f_authority = router_digest_is_trusted_dir(
ri->cache_info.identity_digest);
@@ -1324,6 +1341,8 @@ generate_v2_networkstatus(void)
char digest64[BASE64_DIGEST_LEN+1];
if (options->AuthoritativeDir) {
ri->is_running = dirserv_thinks_router_is_reachable(ri, now);
+ ri->is_fast = f_fast;
+ ri->is_stable = f_stable;
}
f_running = ri->is_running;
diff --git a/src/or/or.h b/src/or/or.h
index 7ea52148ca..7250265c8a 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -795,6 +795,8 @@ typedef struct {
*/
unsigned int is_named:1; /**< Do we believe the nickname that this OR gives
* us? */
+ unsigned int is_fast:1; /** Do we think this is a fast OR? */
+ unsigned int is_stable:1; /** Do we think this is a stable OR? */
unsigned int xx_is_recognized:1; /**< Temporary: do we think that this
* descriptor's digest is recognized?
*/
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 3fb8bbccf0..8ebe6c2b28 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -716,10 +716,9 @@ router_find_exact_exit_enclave(const char *address, uint16_t port)
int
router_is_unreliable(routerinfo_t *router, int need_uptime, int need_capacity)
{
- if (need_uptime && router->uptime < ROUTER_REQUIRED_MIN_UPTIME)
+ if (need_uptime && !router->is_stable)
return 1;
- if (need_capacity &&
- router->bandwidthcapacity < ROUTER_REQUIRED_MIN_BANDWIDTH)
+ if (need_capacity && !router->is_fast)
return 1;
return 0;
}
@@ -3017,6 +3016,8 @@ routers_update_status_from_networkstatus(smartlist_t *routers,
/* If we're an authdir, don't believe others. */
router->is_verified = rs->status.is_valid;
router->is_running = rs->status.is_running;
+ router->is_fast = rs->status.is_fast;
+ router->is_stable = rs->is_stable;
}
if (router->is_running && ds) {
ds->n_networkstatus_failures = 0;