]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Don't exit on dirauths for some config transitions
authorSebastian Hahn <sebastian@torproject.org>
Tue, 8 Nov 2011 11:44:12 +0000 (12:44 +0100)
committerSebastian Hahn <sebastian@torproject.org>
Tue, 8 Nov 2011 11:44:12 +0000 (12:44 +0100)
changes/bug4438 [new file with mode: 0644]
src/or/router.c

diff --git a/changes/bug4438 b/changes/bug4438
new file mode 100644 (file)
index 0000000..f6d0c49
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes:
+    - Fix a dirauth-only exit on sighup that could happen during some
+      configuration state transitions. We now don't treat it as a fatal
+      error when the new descriptor we just generated in init_keys
+      isn't accepted. Fixes bug 4438; bugfix on FIXME.
+
index c9f141b7f0e01e48d5695a47cc2630042d4eadd0..6199e9e3cc9f665f3a03b457b8d7037eb7bd20ab 100644 (file)
@@ -646,15 +646,26 @@ init_keys(void)
       return -1;
     }
     if (mydesc) {
+      was_router_added_t added;
       ri = router_parse_entry_from_string(mydesc, NULL, 1, 0, NULL);
       if (!ri) {
         log_err(LD_GENERAL,"Generated a routerinfo we couldn't parse.");
         return -1;
       }
-      if (!WRA_WAS_ADDED(dirserv_add_descriptor(ri, &m, "self"))) {
-        log_err(LD_GENERAL,"Unable to add own descriptor to directory: %s",
-                m?m:"<unknown error>");
-        return -1;
+      added = dirserv_add_descriptor(ri, &m, "self");
+      if (!WRA_WAS_ADDED(added)) {
+        if (WRA_WAS_REJECTED(added)) {
+          log_err(LD_GENERAL, "Unable to add own descriptor to directory: %s",
+                  m?m:"<unknown error>");
+          return -1;
+        } else {
+          /* If the descriptor wasn't rejected, that's ok. This can happen
+           * when some config options are toggled that affect workers, but
+           * we don't really need new keys yet so the descriptor doesn't
+           * change and the old one is still fresh. */
+          log_info(LD_GENERAL, "Couldn't add own descriptor to directory: %s",
+                   m?m:"unknown error>");
+        }
       }
     }
   }