]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix check_expired_networkstatus_callback() if condition
authorDavid Goulet <dgoulet@torproject.org>
Wed, 2 Aug 2017 17:20:59 +0000 (13:20 -0400)
committerDavid Goulet <dgoulet@torproject.org>
Wed, 2 Aug 2017 17:28:45 +0000 (13:28 -0400)
The condition was always true meaning that we would reconsider updating our
directory information every 2 minutes.

If valid_until is 6am today, then now - 24h == 1pm yesterday which means that
"valid_until < (now - 24h)" is false. But at 6:01am tomorrow, "valid_until <
(now - 24h)" becomes true which is that point that we shouldn't trust the
consensus anymore.

Fixes #23091

Signed-off-by: David Goulet <dgoulet@torproject.org>
changes/bug23091 [new file with mode: 0644]
src/or/main.c

diff --git a/changes/bug23091 b/changes/bug23091
new file mode 100644 (file)
index 0000000..7dfb7e4
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes (consensus expiry):
+    - Tor would reconsider updating its directory information every 2 minutes
+      instead of only doing it for a consensus that is more than 24 hours old
+      (badly expired). This specific check is done in the tor main loop
+      callback that validates if we have an expired consensus. Fixes bug
+      23091; bugfix on tor-0.2.0.19-alpha.
index dc2318496129bd60ca4647bedd45cf59b9e1b1de..670d67cda1493422e2a3229655c7629e64fbd3d6 100644 (file)
@@ -1713,7 +1713,7 @@ check_expired_networkstatus_callback(time_t now, const or_options_t *options)
    * networkstatus_get_reasonably_live_consensus(), but that value is way
    * way too high.  Arma: is the bridge issue there resolved yet? -NM */
 #define NS_EXPIRY_SLOP (24*60*60)
-  if (ns && ns->valid_until < now+NS_EXPIRY_SLOP &&
+  if (ns && ns->valid_until < (now - NS_EXPIRY_SLOP) &&
       router_have_minimum_dir_info()) {
     router_dir_info_changed();
   }