summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-01-23 08:55:31 -0500
committerNick Mathewson <nickm@torproject.org>2015-01-23 08:55:31 -0500
commitb677ccd3aba80f4b66f16e6e1c0e3c68b49106c5 (patch)
treea0c975bae9f4dacde438e1f57db9f4a145f93cd7
parentd8517fe8435dbe9e4593d04fa8ec4db464513892 (diff)
parent90db39448db254d87228e4b7b34c61a4dce6a634 (diff)
downloadtor-b677ccd3aba80f4b66f16e6e1c0e3c68b49106c5.tar.gz
tor-b677ccd3aba80f4b66f16e6e1c0e3c68b49106c5.zip
Merge remote-tracking branch 'public/ticket13762'
-rw-r--r--changes/ticket137625
-rw-r--r--src/or/routerlist.c10
-rw-r--r--src/or/routerlist.h2
-rw-r--r--src/test/test_dir.c3
4 files changed, 14 insertions, 6 deletions
diff --git a/changes/ticket13762 b/changes/ticket13762
new file mode 100644
index 0000000000..7b1976f654
--- /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 d3734238eb..b5e58a4623 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -2753,7 +2753,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;
@@ -2775,11 +2775,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;
}
@@ -3325,7 +3327,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 d7e15db87e..0d22543a27 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 c6594f8359..a8c6c6fad4 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;
}