Browse Source

r13634@catbus: nickm | 2007-07-06 14:20:50 -0400
Fix a crash bug (*the* crash bug?) on authorities. Backport candidate.


svn:r10752

Nick Mathewson 18 years ago
parent
commit
e6ba07f8f5
2 changed files with 8 additions and 4 deletions
  1. 4 0
      ChangeLog
  2. 4 4
      src/or/routerlist.c

+ 4 - 0
ChangeLog

@@ -31,6 +31,10 @@ Changes in version 0.2.0.3-alpha - 2007-??-??
     - STREAM NEW events are generated for DNSPort requests and for tunneled
       directory connections. (Patch from Robert Hogan.)
 
+  o Major bugfixes (directory):
+    - Fix a crash bug in directory authorities when we re-number the
+      routerlist while inserting a new router. [Bugfix on 0.1.2.x]
+
   o Minor bugfixes (directory):
     - Fix another crash bug related to extra-info caching.  (Bug found by
       Peter Palfrader.) [Bugfix on 0.2.0.2-alpha]

+ 4 - 4
src/or/routerlist.c

@@ -2423,6 +2423,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
   old_router = rimap_get(routerlist->identity_map,
                          router->cache_info.identity_digest);
   if (old_router) {
+    int have_min_info = router_have_minimum_dir_info(); /* can mess with pos,
+                                                         * so call it now.*/
     int pos = old_router->routerlist_index;
     tor_assert(0 <= pos && pos < smartlist_len(routerlist->routers));
     tor_assert(smartlist_get(routerlist->routers, pos) == old_router);
@@ -2452,10 +2454,8 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
         router->num_unreachable_notifications =
           old_router->num_unreachable_notifications;
       }
-      if (authdir && !from_cache && !from_fetch &&
-          router_have_minimum_dir_info() &&
-          dirserv_thinks_router_is_blatantly_unreachable(router,
-                                                         time(NULL))) {
+      if (authdir && !from_cache && !from_fetch && have_min_info &&
+          dirserv_thinks_router_is_blatantly_unreachable(router, time(NULL))) {
         if (router->num_unreachable_notifications >= 3) {
           unreachable = 1;
           log_notice(LD_DIR, "Notifying server '%s' that it's unreachable. "