]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
In router_is_active, don't require non-zero bandwidthcapacity
authorJim Newsome <jnewsome@torproject.org>
Thu, 7 Mar 2024 18:32:02 +0000 (12:32 -0600)
committerJim Newsome <jnewsome@torproject.org>
Thu, 7 Mar 2024 18:39:40 +0000 (12:39 -0600)
This check was originally added in 962765a3, with the intent of
preventing relays with 0 measured bandwidth from being listed in the
consensus (part of fixing #13000).

Currently, that decision and other relevant places effectively use
`dirserv_get_credible_bandwidth_kb`, which prefers bwauth-measured
bandwidth over the self-reported `bandwidthcapacity`, making this check
mostly redundant.

i.e. this change should only affect behavior when the relay has uploaded
a descriptor with `bandwidthcapacity=0` *and* we have a non-zero
measured bandwidth, in which case we'll still trust the measured
bandwidth. This is what we want when bootstrapping a network (e.g. for
testing), since it allows us to initialize bandwidths using a bandwidth
authority file.

A relay can still cause `router_is_active` to return false by setting
the hibernate flag.

Also see discussion in #40917.

Fixes #40917.

src/feature/dirauth/voteflags.c

index 71ee03e265a362fcc3c49419f65c6456db84255b..2fbac47b300305a6023d525423b0582ea55ed35c 100644 (file)
@@ -112,8 +112,7 @@ dirserv_thinks_router_is_unreliable(time_t now,
 }
 
 /** Return 1 if <b>ri</b>'s descriptor is "active" -- running, valid,
- * not hibernating, having observed bw greater 0, and not too old. Else
- * return 0.
+ * not hibernating, and not too old. Else return 0.
  */
 static int
 router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
@@ -125,20 +124,6 @@ router_is_active(const routerinfo_t *ri, const node_t *node, time_t now)
   if (!node->is_running || !node->is_valid || ri->is_hibernating) {
     return 0;
   }
-  /* Only require bandwidth capacity in non-test networks, or
-   * if TestingTorNetwork, and TestingMinExitFlagThreshold is non-zero */
-  if (!ri->bandwidthcapacity) {
-    if (get_options()->TestingTorNetwork) {
-      if (dirauth_get_options()->TestingMinExitFlagThreshold > 0) {
-        /* If we're in a TestingTorNetwork, and TestingMinExitFlagThreshold is,
-         * then require bandwidthcapacity */
-        return 0;
-      }
-    } else {
-      /* If we're not in a TestingTorNetwork, then require bandwidthcapacity */
-      return 0;
-    }
-  }
   return 1;
 }