Procházet zdrojové kódy

Merge branch 'maint-0.2.2'

Roger Dingledine před 14 roky
rodič
revize
6b82a6e88d

+ 45 - 1
ChangeLog

@@ -1,5 +1,30 @@
-Changes in version 0.2.2.18-rc - 2010-11-1?
+Changes in version 0.2.2.18-alpha - 2010-11-16
   o Major bugfixes:
+    - Do even more to reject (and not just ignore) annotations on
+      router descriptors received anywhere but from the cache. Previously
+      we would ignore such annotations at first, but cache them to disk
+      anyway. Bugfix on 0.2.0.8-alpha. Found by piebeer.
+    - Do not log messages to the controller while shrinking buffer
+      freelists. Doing so would sometimes make the controller connection
+      try to allocate a buffer chunk, which would mess up the internals
+      of the freelist and cause an assertion failure. Fixes bug 1125;
+      fixed by Robert Ransom. Bugfix on 0.2.0.16-alpha.
+    - Learn our external IP address when we're a relay or bridge, even if
+      we set PublishServerDescriptor to 0. Bugfix on 0.2.0.3-alpha,
+      where we introduced bridge relays that don't need to publish to
+      be useful. Fixes bug 2050.
+    - Maintain separate TLS contexts and certificates for incoming and
+      outgoing connections in bridge relays. Previously we would use the
+      same TLS contexts and certs for incoming and outgoing connections.
+      Bugfix on 0.2.0.3-alpha; addresses bug 988.
+    - Maintain separate identity keys for incoming and outgoing TLS
+      contexts in bridge relays. Previously we would use the same
+      identity keys for incoming and outgoing TLS contexts. Bugfix on
+      0.2.0.3-alpha; addresses a bug described in ticket 988.
+    - Avoid an assertion failure when we as an authority receive a
+      duplicate upload of a router descriptor that we already have,
+      but which we previously considered an obsolete descriptor.
+      Fixes another case of bug 1776. Bugfix on 0.2.2.16-alpha.
     - Avoid a crash bug triggered by looking at a dangling pointer while
       setting the network status consensus. Found by Robert Ransom.
       Bugfix on 0.2.2.17-alpha. Fixes bug 2097.
@@ -22,6 +47,8 @@ Changes in version 0.2.2.18-rc - 2010-11-1?
       when logging them. Previously we would attribute them to a failure
       while generating a TLS context. Patch by Robert Ransom. Bugfix on
       0.1.0.4-rc; fixes bug 1994.
+    - Enforce multiplicity rules when parsing annotations. Bugfix on
+      0.2.0.8-alpha. Found by piebeer.
     - Fix warnings that newer versions of autoconf produced during
       ./autogen.sh. These warnings appear to be harmless in our case,
       but they were extremely verbose. Fixes bug 2020.
@@ -36,6 +63,13 @@ Changes in version 0.2.2.18-rc - 2010-11-1?
       on 0.2.2.17-alpha.
 
   o Minor features:
+    - Make hidden services work better in private Tor networks by not
+      requiring any uptime to join the hidden service descriptor
+      DHT. Implements ticket 2088.
+    - Rate-limit the "your application is giving Tor only an IP address"
+      warning. Addresses bug 2000; bugfix on 0.0.8pre2.
+    - When you set AllowSingleHopExits, print a warning to explain why
+      most clients are avoiding your relay.
     - Update to the November 1 2010 Maxmind GeoLite Country database.
 
   o Code simplifications and refactoring:
@@ -44,6 +78,16 @@ Changes in version 0.2.2.18-rc - 2010-11-1?
       necessary as long as relays using Tor 0.2.1.3-alpha through
       0.2.1.18-alpha were active. Since this isn't the case anymore,
       we unify our behaviour here. Resolves bug 2081.
+    - Some options used different conventions for uppercasing of acronyms
+      when comparing manpage and source. Fix those in favor of the
+      manpage, as it makes sense to capitalize acronyms.
+    - Remove the torrc.complete file. It hasn't been kept up to date
+      and users will have better luck checking out the manpage.
+    - Removed the obsolete "NoPublish" option; it has been flagged
+      as obsolete and has produced a warning since 0.1.1.18-rc.
+    - Remove everything related to building the expert bundle for OS X.
+      It has confused many users, doesn't work right on OS X 10.6,
+      and is hard to get rid of once installed. Resolves bug 1274.
 
 
 Changes in version 0.2.2.17-alpha - 2010-09-30

+ 0 - 4
changes/HTTP

@@ -1,4 +0,0 @@
-  o Code simplifications and refactoring:
-    - Some options used different conventions for uppercasing of acronyms
-      when comparing manpage and source. Fix those in favor of the
-      manpage, as it makes sense to capitalize acronyms.

+ 0 - 10
changes/annotations_fix

@@ -1,10 +0,0 @@
-  o Major bugfixes
-    - Do even more to reject (and not just ignore) annotations on
-      router descriptors received anywhere but from the cache.
-      Previously we would ignore such annotations at first, but cache
-      them to disk anyway.  Bugfix on 0.2.0.8-alpha. Found by piebeer.
-
-  o Minor bugfixes
-    - Enforce multiplicity rules when parsing annotations.  Bugfix on
-      0.2.0.8-alpha. Found by piebeer.
-

+ 0 - 8
changes/bug1125

@@ -1,8 +0,0 @@
-  o Major bugfixes
-    - Do not log messages to the controller while shrinking buffer
-      freelists.  Doing so would sometimes make the controller
-      connection try to allocate a buffer chunk, which would mess
-      up the internals of the freelist and cause an assertion
-      failure. Fixes bug 1125; fixed by Robert Ransom. Bugfix on
-      Tor 0.2.0.16-alpha.
-

+ 0 - 3
changes/bug2000

@@ -1,3 +0,0 @@
-  o Minor bugfixes:
-    - Rate-limit the "your application is giving Tor only an IP address"
-      warning. Fixes bug 2000; bugfix on 0.0.8pre2.

+ 0 - 5
changes/bug2050

@@ -1,5 +0,0 @@
-  o Major bugfixes:
-    - Learn our external IP address when we're a relay or bridge, even if
-      we set PublishServerDescriptor to 0. Bugfix on 0.2.0.3-alpha,
-      where we introduced bridge relays that don't need to publish to
-      be useful. Fixes bug 2050.

+ 0 - 3
changes/minuptimehs

@@ -1,3 +0,0 @@
-  o Minor features:
-    - Make hidden services work better in private networks by not requiring
-      any uptime to join the dht. Implements ticket 2088.

+ 0 - 3
changes/nonopublish

@@ -1,3 +0,0 @@
-  o Removed features
-    - Removed the obsolete "NoPublished" option; it has been flagged
-      as obsolete and has produced a warning since 0.1.1.18-rc.

+ 0 - 5
changes/remove_osx_expert

@@ -1,5 +0,0 @@
-  o Removed features:
-    - Remove everything related to building the expert bundle for OS X. It
-      has confused many users, doesn't work right on OS X 10.6, and is hard
-      to get rid of once installed. Resolves bug 1274.
-

+ 0 - 4
changes/torrc.complete

@@ -1,4 +0,0 @@
-  o Code simplifications and refactorings:
-    - Remove the torrc.complete file. It hasn't been kept up to date
-      and users will have better luck checking out the manpage.
-

+ 7 - 0
src/or/config.c

@@ -3673,6 +3673,13 @@ options_validate(or_options_t *old_options, or_options_t *options,
            "a non-default set of DirServers.");
   }
 
+  if (options->AllowSingleHopExits && !options->DirServers) {
+    COMPLAIN("You have set AllowSingleHopExits; now your relay will allow "
+             "others to make one-hop exits. However, since by default most "
+             "clients avoid relays that set this option, most clients will "
+             "ignore you.");
+  }
+
   /*XXXX022 checking for defaults manually like this is a bit fragile.*/
 
   /* Keep changes to hard-coded values synchronous to man page and default

+ 55 - 24
src/or/routerlist.c

@@ -2684,12 +2684,15 @@ signed_descriptor_free(signed_descriptor_t *sd)
   tor_free(sd);
 }
 
-/** Extract a signed_descriptor_t from a routerinfo, and free the routerinfo.
+/** Extract a signed_descriptor_t from a general routerinfo, and free the
+ * routerinfo.
  */
 static signed_descriptor_t *
 signed_descriptor_from_routerinfo(routerinfo_t *ri)
 {
-  signed_descriptor_t *sd = tor_malloc_zero(sizeof(signed_descriptor_t));
+  signed_descriptor_t *sd;
+  tor_assert(ri->purpose == ROUTER_PURPOSE_GENERAL);
+  sd = tor_malloc_zero(sizeof(signed_descriptor_t));
   memcpy(sd, &(ri->cache_info), sizeof(signed_descriptor_t));
   sd->routerlist_index = -1;
   ri->cache_info.signed_descriptor_body = NULL;
@@ -2780,6 +2783,7 @@ static void
 routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
 {
   routerinfo_t *ri_old;
+  signed_descriptor_t *sd_old;
   {
     const routerinfo_t *ri_generated = router_get_my_routerinfo();
     tor_assert(ri_generated != ri);
@@ -2788,8 +2792,16 @@ routerlist_insert(routerlist_t *rl, routerinfo_t *ri)
 
   ri_old = rimap_set(rl->identity_map, ri->cache_info.identity_digest, ri);
   tor_assert(!ri_old);
-  sdmap_set(rl->desc_digest_map, ri->cache_info.signed_descriptor_digest,
-            &(ri->cache_info));
+
+  sd_old = sdmap_set(rl->desc_digest_map,
+                     ri->cache_info.signed_descriptor_digest,
+                     &(ri->cache_info));
+  if (sd_old) {
+    rl->desc_store.bytes_dropped += sd_old->signed_descriptor_len;
+    sdmap_remove(rl->desc_by_eid_map, sd_old->extra_info_digest);
+    signed_descriptor_free(sd_old);
+  }
+
   if (!tor_digest_is_zero(ri->cache_info.extra_info_digest))
     sdmap_set(rl->desc_by_eid_map, ri->cache_info.extra_info_digest,
               &ri->cache_info);
@@ -3009,6 +3021,7 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
                    routerinfo_t *ri_new)
 {
   int idx;
+  int same_descriptors;
 
   routerinfo_t *ri_tmp;
   extrainfo_t *ei_tmp;
@@ -3055,8 +3068,15 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
               &ri_new->cache_info);
   }
 
+  same_descriptors = ! memcmp(ri_old->cache_info.signed_descriptor_digest,
+                              ri_new->cache_info.signed_descriptor_digest,
+                              DIGEST_LEN);
+
   if (should_cache_old_descriptors() &&
-      ri_old->purpose == ROUTER_PURPOSE_GENERAL) {
+      ri_old->purpose == ROUTER_PURPOSE_GENERAL &&
+      !same_descriptors) {
+    /* ri_old is going to become a signed_descriptor_t and go into
+     * old_routers */
     signed_descriptor_t *sd = signed_descriptor_from_routerinfo(ri_old);
     smartlist_add(rl->old_routers, sd);
     sd->routerlist_index = smartlist_len(rl->old_routers)-1;
@@ -3064,24 +3084,27 @@ routerlist_replace(routerlist_t *rl, routerinfo_t *ri_old,
     if (!tor_digest_is_zero(sd->extra_info_digest))
       sdmap_set(rl->desc_by_eid_map, sd->extra_info_digest, sd);
   } else {
-    if (memcmp(ri_old->cache_info.signed_descriptor_digest,
-               ri_new->cache_info.signed_descriptor_digest,
-               DIGEST_LEN)) {
-      /* digests don't match; digestmap_set didn't replace */
+    /* We're dropping ri_old. */
+    if (!same_descriptors) {
+      /* digests don't match; The sdmap_set above didn't replace */
       sdmap_remove(rl->desc_digest_map,
                    ri_old->cache_info.signed_descriptor_digest);
-    }
 
-    ei_tmp = eimap_remove(rl->extra_info_map,
-                          ri_old->cache_info.extra_info_digest);
-    if (ei_tmp) {
-      rl->extrainfo_store.bytes_dropped +=
-        ei_tmp->cache_info.signed_descriptor_len;
-      extrainfo_free(ei_tmp);
-    }
-    if (!tor_digest_is_zero(ri_old->cache_info.extra_info_digest)) {
-      sdmap_remove(rl->desc_by_eid_map,
-                   ri_old->cache_info.extra_info_digest);
+      if (memcmp(ri_old->cache_info.extra_info_digest,
+                 ri_new->cache_info.extra_info_digest, DIGEST_LEN)) {
+        ei_tmp = eimap_remove(rl->extra_info_map,
+                              ri_old->cache_info.extra_info_digest);
+        if (ei_tmp) {
+          rl->extrainfo_store.bytes_dropped +=
+            ei_tmp->cache_info.signed_descriptor_len;
+          extrainfo_free(ei_tmp);
+        }
+      }
+
+      if (!tor_digest_is_zero(ri_old->cache_info.extra_info_digest)) {
+        sdmap_remove(rl->desc_by_eid_map,
+                     ri_old->cache_info.extra_info_digest);
+      }
     }
     rl->desc_store.bytes_dropped += ri_old->cache_info.signed_descriptor_len;
     routerinfo_free(ri_old);
@@ -3233,10 +3256,18 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
     /* If we have this descriptor already and the new descriptor is a bridge
      * descriptor, replace it. If we had a bridge descriptor before and the
      * new one is not a bridge descriptor, don't replace it. */
-    tor_assert(old_router);
-    if (! (routerinfo_is_a_configured_bridge(router) &&
-            (router->purpose == ROUTER_PURPOSE_BRIDGE ||
-             old_router->purpose != ROUTER_PURPOSE_BRIDGE))) {
+
+    /* Only members of routerlist->identity_map can be bridges; we don't
+     * put bridges in old_routers. */
+    const int was_bridge = old_router &&
+      old_router->purpose == ROUTER_PURPOSE_BRIDGE;
+
+    if (routerinfo_is_a_configured_bridge(router) &&
+        router->purpose == ROUTER_PURPOSE_BRIDGE &&
+        !was_bridge) {
+      log_info(LD_DIR, "Replacing non-bridge descriptor with bridge "
+               "descriptor for router '%s'", router->nickname);
+    } else {
       log_info(LD_DIR,
                "Dropping descriptor that we already have for router '%s'",
                router->nickname);