[tor-commits] [tor/release-0.4.5] Don't log supported-protover warnings if consensus is older than Tor.

asn at torproject.org asn at torproject.org
Fri Feb 12 11:51:37 UTC 2021


commit 56f1cab9c12349538c5526de92d6e64fecb81184
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Feb 8 11:52:53 2021 -0500

    Don't log supported-protover warnings if consensus is older than Tor.
    
    Previously we would warn in this case... but there's really no
    justification for doing so, and it can only cause confusion.
    
    Fixes bug #40281; bugfix on 0.4.0.1-alpha.
---
 changes/bug40281                     | 6 ++++++
 src/feature/nodelist/networkstatus.c | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/changes/bug40281 b/changes/bug40281
new file mode 100644
index 0000000000..0708039f04
--- /dev/null
+++ b/changes/bug40281
@@ -0,0 +1,6 @@
+  o Minor bugfixes (logging):
+    - Avoid a spurious log message about missing subprotocol versions, when
+      the consensus that we're reading from is older than the current
+      release. .  Previously we had made this message nonfatal in this case,
+      but in practice, it is never relevant when the consensus is older than
+      the current release.  Fixes bug 40281; bugfix on 0.4.0.1-alpha.
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index e07d58c91c..8e47fafd3c 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -2713,6 +2713,13 @@ networkstatus_check_required_protocols(const networkstatus_t *ns,
   const bool consensus_postdates_this_release =
     ns->valid_after >= tor_get_approx_release_date();
 
+  if (! consensus_postdates_this_release) {
+    // We can't meaningfully warn about this case: This consensus is from
+    // before we were released, so whatever is says about required or
+    // recommended versions may no longer be true.
+    return 0;
+  }
+
   tor_assert(warning_out);
 
   if (client_mode) {
@@ -2730,7 +2737,7 @@ networkstatus_check_required_protocols(const networkstatus_t *ns,
                  "%s on the Tor network. The missing protocols are: %s",
                  func, missing);
     tor_free(missing);
-    return consensus_postdates_this_release ? 1 : 0;
+    return 1;
   }
 
   if (! protover_all_supported(recommended, &missing)) {





More information about the tor-commits mailing list