[tor-commits] [tor/master] Downgrade warnings about extrainfo incompatibility when reading cache

nickm at torproject.org nickm at torproject.org
Fri Jan 23 13:55:59 UTC 2015


commit 90db39448db254d87228e4b7b34c61a4dce6a634
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Jan 7 13:11:06 2015 -0500

    Downgrade warnings about extrainfo incompatibility when reading cache
    
    Fixes  13762.
---
 changes/ticket13762 |    5 +++++
 src/or/routerlist.c |   10 ++++++----
 src/or/routerlist.h |    2 +-
 src/test/test_dir.c |    3 ++-
 4 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/changes/ticket13762 b/changes/ticket13762
new file mode 100644
index 0000000..7b1976f
--- /dev/null
+++ b/changes/ticket13762
@@ -0,0 +1,5 @@
+  o Minor features:
+    - Suppress "router info incompatible with extra info" message when
+      reading extrainfo documents from cache. (This message got loud
+      around 0.2.6.2-alpha, when we fixed bug 9812.) Closes ticket
+      13762.
\ No newline at end of file
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 6cb052c..aab0aab 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2752,7 +2752,7 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
  * corresponding router in rl-\>routers or rl-\>old_routers.  Return the status
  * of inserting <b>ei</b>.  Free <b>ei</b> if it isn't inserted. */
 MOCK_IMPL(STATIC was_router_added_t,
-extrainfo_insert,(routerlist_t *rl, extrainfo_t *ei))
+extrainfo_insert,(routerlist_t *rl, extrainfo_t *ei, int warn_if_incompatible))
 {
   was_router_added_t r;
   const char *compatibility_error_msg;
@@ -2774,11 +2774,13 @@ extrainfo_insert,(routerlist_t *rl, extrainfo_t *ei))
   }
   if (routerinfo_incompatible_with_extrainfo(ri, ei, sd,
                                              &compatibility_error_msg)) {
+    const int severity = warn_if_incompatible ? LOG_WARN : LOG_INFO;
     r = (ri->cache_info.extrainfo_is_bogus) ?
       ROUTER_BAD_EI : ROUTER_NOT_IN_CONSENSUS;
 
-    log_warn(LD_DIR,"router info incompatible with extra info (reason: %s)",
-             compatibility_error_msg);
+    log_fn(severity,LD_DIR,
+           "router info incompatible with extra info (reason: %s)",
+           compatibility_error_msg);
 
     goto done;
   }
@@ -3324,7 +3326,7 @@ router_add_extrainfo_to_routerlist(extrainfo_t *ei, const char **msg,
   if (msg) *msg = NULL;
   /*XXXX023 Do something with msg */
 
-  inserted = extrainfo_insert(router_get_routerlist(), ei);
+  inserted = extrainfo_insert(router_get_routerlist(), ei, !from_cache);
 
   if (WRA_WAS_ADDED(inserted) && !from_cache)
     signed_desc_append_to_journal(&ei->cache_info,
diff --git a/src/or/routerlist.h b/src/or/routerlist.h
index d7e15db..0d22543 100644
--- a/src/or/routerlist.h
+++ b/src/or/routerlist.h
@@ -227,7 +227,7 @@ STATIC void scale_array_elements_to_u64(u64_dbl_t *entries, int n_entries,
 MOCK_DECL(int, router_descriptor_is_older_than, (const routerinfo_t *router,
                                                  int seconds));
 MOCK_DECL(STATIC was_router_added_t, extrainfo_insert,
-          (routerlist_t *rl, extrainfo_t *ei));
+          (routerlist_t *rl, extrainfo_t *ei, int warn_if_incompatible));
 
 #endif
 
diff --git a/src/test/test_dir.c b/src/test/test_dir.c
index c6594f8..a8c6c6f 100644
--- a/src/test/test_dir.c
+++ b/src/test/test_dir.c
@@ -714,9 +714,10 @@ mock_get_by_ei_desc_digest(const char *d)
 
 static smartlist_t *mock_ei_insert_list = NULL;
 static was_router_added_t
-mock_ei_insert(routerlist_t *rl, extrainfo_t *ei)
+mock_ei_insert(routerlist_t *rl, extrainfo_t *ei, int warn_if_incompatible)
 {
   (void) rl;
+  (void) warn_if_incompatible;
   smartlist_add(mock_ei_insert_list, ei);
   return ROUTER_ADDED_SUCCESSFULLY;
 }





More information about the tor-commits mailing list