|
@@ -124,6 +124,8 @@ router_reload_networkstatus(void)
|
|
|
if (!networkstatus_list)
|
|
|
networkstatus_list = smartlist_create();
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
+
|
|
|
tor_snprintf(filename,sizeof(filename),"%s"PATH_SEPARATOR"cached-status",
|
|
|
get_options()->DataDirectory);
|
|
|
entries = tor_listdir(filename);
|
|
@@ -150,6 +152,7 @@ router_reload_networkstatus(void)
|
|
|
smartlist_free(entries);
|
|
|
networkstatus_list_clean(time(NULL));
|
|
|
routers_update_all_from_networkstatus();
|
|
|
+ routerlist_check_bug_417();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -198,6 +201,8 @@ router_append_to_journal(signed_descriptor_t *desc, uint8_t purpose)
|
|
|
const char *body = signed_descriptor_get_body(desc);
|
|
|
size_t len = desc->signed_descriptor_len;
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
+
|
|
|
if (purpose != ROUTER_PURPOSE_GENERAL) {
|
|
|
|
|
|
return 0;
|
|
@@ -219,6 +224,8 @@ router_append_to_journal(signed_descriptor_t *desc, uint8_t purpose)
|
|
|
|
|
|
tor_free(fname);
|
|
|
router_journal_len += len;
|
|
|
+
|
|
|
+ routerlist_check_bug_417();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -263,6 +270,8 @@ router_rebuild_store(int force)
|
|
|
if (!routerlist)
|
|
|
return 0;
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
+
|
|
|
|
|
|
routerlist_remove_old_routers();
|
|
|
|
|
@@ -360,6 +369,8 @@ router_rebuild_store(int force)
|
|
|
tor_free(fname);
|
|
|
SMARTLIST_FOREACH(chunk_list, sized_chunk_t *, c, tor_free(c));
|
|
|
smartlist_free(chunk_list);
|
|
|
+
|
|
|
+ routerlist_check_bug_417();
|
|
|
return r;
|
|
|
}
|
|
|
|
|
@@ -373,6 +384,8 @@ router_reload_router_list(void)
|
|
|
size_t fname_len = strlen(options->DataDirectory)+32;
|
|
|
char *fname = tor_malloc(fname_len), *contents = NULL;
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
+
|
|
|
if (!routerlist)
|
|
|
router_get_routerlist();
|
|
|
|
|
@@ -412,6 +425,8 @@ router_reload_router_list(void)
|
|
|
routerlist_remove_old_routers();
|
|
|
}
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1652,6 +1667,7 @@ static void
|
|
|
routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
|
|
|
{
|
|
|
routerinfo_t *ri_old;
|
|
|
+ routerlist_check_bug_417();
|
|
|
ri_old = digestmap_set(rl->identity_map, ri->cache_info.identity_digest, ri);
|
|
|
tor_assert(!ri_old);
|
|
|
digestmap_set(rl->desc_digest_map, ri->cache_info.signed_descriptor_digest,
|
|
@@ -1660,6 +1676,7 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
|
|
|
ri->routerlist_index = smartlist_len(rl->routers) - 1;
|
|
|
router_dir_info_changed();
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1669,11 +1686,12 @@ extrainfo_insert(routerlist_t *rl, extrainfo_t *ei)
|
|
|
routerinfo_t *ri = digestmap_get(rl->identity_map,
|
|
|
ei->cache_info.identity_digest);
|
|
|
extrainfo_t *ei_tmp;
|
|
|
+ routerlist_check_bug_417();
|
|
|
if (!ri || routerinfo_incompatible_with_extrainfo(ri,ei)) {
|
|
|
int found = 0;
|
|
|
if (ei->pending_sig || ei->bad_sig) {
|
|
|
extrainfo_free(ei);
|
|
|
- return;
|
|
|
+ goto done;
|
|
|
}
|
|
|
|
|
|
* matches. */
|
|
@@ -1689,7 +1707,7 @@ extrainfo_insert(routerlist_t *rl, extrainfo_t *ei)
|
|
|
});
|
|
|
if (!found) {
|
|
|
extrainfo_free(ei);
|
|
|
- return;
|
|
|
+ goto done;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1698,6 +1716,9 @@ extrainfo_insert(routerlist_t *rl, extrainfo_t *ei)
|
|
|
ei);
|
|
|
if (ei_tmp)
|
|
|
extrainfo_free(ei_tmp);
|
|
|
+
|
|
|
+ done:
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1706,6 +1727,7 @@ extrainfo_insert(routerlist_t *rl, extrainfo_t *ei)
|
|
|
static void
|
|
|
routerlist_insert_old(routerlist_t *rl, routerinfo_t *ri)
|
|
|
{
|
|
|
+ routerlist_check_bug_417();
|
|
|
if (get_options()->DirPort &&
|
|
|
ri->purpose == ROUTER_PURPOSE_GENERAL &&
|
|
|
!digestmap_get(rl->desc_digest_map,
|
|
@@ -1717,6 +1739,7 @@ routerlist_insert_old(routerlist_t *rl, routerinfo_t *ri)
|
|
|
routerinfo_free(ri);
|
|
|
}
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1732,6 +1755,7 @@ routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int idx, int make_old)
|
|
|
{
|
|
|
routerinfo_t *ri_tmp;
|
|
|
extrainfo_t *ei_tmp;
|
|
|
+ routerlist_check_bug_417();
|
|
|
idx = _routerlist_find_elt(rl->routers, ri, idx);
|
|
|
if (idx < 0)
|
|
|
return;
|
|
@@ -1764,6 +1788,7 @@ routerlist_remove(routerlist_t *rl, routerinfo_t *ri, int idx, int make_old)
|
|
|
extrainfo_free(ei_tmp);
|
|
|
}
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1772,6 +1797,7 @@ routerlist_remove_old(routerlist_t *rl, signed_descriptor_t *sd, int idx)
|
|
|
{
|
|
|
signed_descriptor_t *sd_tmp;
|
|
|
extrainfo_t *ei_tmp;
|
|
|
+ routerlist_check_bug_417();
|
|
|
idx = _routerlist_find_elt(rl->old_routers, sd, idx);
|
|
|
if (idx < 0)
|
|
|
return;
|
|
@@ -1787,6 +1813,7 @@ routerlist_remove_old(routerlist_t *rl, signed_descriptor_t *sd, int idx)
|
|
|
if (ei_tmp)
|
|
|
extrainfo_free(ei_tmp);
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1804,6 +1831,7 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
|
|
{
|
|
|
routerinfo_t *ri_tmp;
|
|
|
extrainfo_t *ei_tmp;
|
|
|
+ routerlist_check_bug_417();
|
|
|
tor_assert(ri_old != ri_new);
|
|
|
idx = _routerlist_find_elt(rl->routers, ri_old, idx);
|
|
|
router_dir_info_changed();
|
|
@@ -1849,6 +1877,7 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
|
|
|
routerinfo_free(ri_old);
|
|
|
}
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1957,6 +1986,7 @@ router_set_status(const char *digest, int up)
|
|
|
local_routerstatus_t *status;
|
|
|
tor_assert(digest);
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
SMARTLIST_FOREACH(trusted_dir_servers, trusted_dir_server_t *, d,
|
|
|
if (!memcmp(d->digest, digest, DIGEST_LEN))
|
|
|
d->is_running = up);
|
|
@@ -1976,6 +2006,7 @@ router_set_status(const char *digest, int up)
|
|
|
control_event_networkstatus_changed_single(status);
|
|
|
}
|
|
|
router_dir_info_changed();
|
|
|
+ routerlist_check_bug_417();
|
|
|
}
|
|
|
|
|
|
|
|
@@ -2012,6 +2043,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
|
|
|
int authdir_believes_valid = 0;
|
|
|
routerinfo_t *old_router;
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
tor_assert(msg);
|
|
|
|
|
|
if (!routerlist)
|
|
@@ -2401,6 +2433,7 @@ router_load_single_router(const char *s, uint8_t purpose, const char **msg)
|
|
|
tor_assert(msg);
|
|
|
*msg = NULL;
|
|
|
|
|
|
+ routerlist_check_bug_417();
|
|
|
if (!(ri = router_parse_entry_from_string(s, NULL, 1))) {
|
|
|
log_warn(LD_DIR, "Error parsing router descriptor; dropping.");
|
|
|
*msg = "Couldn't parse router descriptor.";
|
|
@@ -4713,6 +4746,39 @@ routerlist_assert_ok(routerlist_t *rl)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ * assertion if the symptoms for bug 417/404 seem to be present. */
|
|
|
+void
|
|
|
+routerlist_check_bug_417(void)
|
|
|
+{
|
|
|
+
|
|
|
+ routerlist_t *rl = router_get_routerlist();
|
|
|
+ routerinfo_t *ri_generated, *r2, *r;
|
|
|
+ int idx = -1;
|
|
|
+
|
|
|
+ ri_generated = router_get_my_routerinfo();
|
|
|
+
|
|
|
+ r = digestmap_get(rl->identity_map,
|
|
|
+ ri_generated->cache_info.identity_digest);
|
|
|
+ if (r) {
|
|
|
+ idx = r->routerlist_index;
|
|
|
+ tor_assert(idx >= 0);
|
|
|
+ tor_assert(idx < smartlist_len(rl->routers));
|
|
|
+ r2 = smartlist_get(rl->routers, idx);
|
|
|
+ tor_assert(r == r2);
|
|
|
+ } else {
|
|
|
+#if 0
|
|
|
+
|
|
|
+ SMARTLIST_FROEACH(rl->routers, routerinfo_t *, ri,
|
|
|
+ {
|
|
|
+ tor_assert(!router_is_me(ri));
|
|
|
+ });
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ tor_assert(ri_generated->routerlist_index == 0);
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
* and platform string for <b>router</b>,
|
|
|
* surrounded by quotes and using standard C escapes.
|