[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15459: Enable cannibalization of circuits for introduction circuits (in tor/branches/tor-0_2_0-patches: . src/or)



Author: kloesing
Date: 2008-06-24 16:39:47 -0400 (Tue, 24 Jun 2008)
New Revision: 15459

Modified:
   tor/branches/tor-0_2_0-patches/ChangeLog
   tor/branches/tor-0_2_0-patches/src/or/circuitlist.c
   tor/branches/tor-0_2_0-patches/src/or/rendservice.c
Log:
Enable cannibalization of circuits for introduction circuits (backport r14166) and actually use introduction circuits that originate from cannibalization afterwards (backports r15332/r15335).

Modified: tor/branches/tor-0_2_0-patches/ChangeLog
===================================================================
--- tor/branches/tor-0_2_0-patches/ChangeLog	2008-06-24 20:07:45 UTC (rev 15458)
+++ tor/branches/tor-0_2_0-patches/ChangeLog	2008-06-24 20:39:47 UTC (rev 15459)
@@ -14,6 +14,9 @@
     - Fix a macro/CPP interactions that was confusing some compilers:
       some GCCs don't like #if/#endif pairs inside macro arguments.
       Fix for bug 707.
+    - Enable cannibalization of circuits for introduction circuits and
+      actually use introduction circuits that originate from
+      cannibalization afterwards.
 
 
 Changes in version 0.2.0.28-rc - 2008-06-13
@@ -30,7 +33,7 @@
     - While setting up a hidden service, some valid introduction circuits
       were overlooked and abandoned. This might be the reason for
       the long delay in making a hidden service available. Bugfix on
-      0.2.0.13-alpha.
+      0.2.0.14-alpha.
 
   o Minor features:
     - Update to the "June 9 2008" ip-to-country file.

Modified: tor/branches/tor-0_2_0-patches/src/or/circuitlist.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/circuitlist.c	2008-06-24 20:07:45 UTC (rev 15458)
+++ tor/branches/tor-0_2_0-patches/src/or/circuitlist.c	2008-06-24 20:39:47 UTC (rev 15459)
@@ -814,9 +814,9 @@
 
   circuit_t *_circ;
   origin_circuit_t *best=NULL;
-  int need_uptime = flags & CIRCLAUNCH_NEED_UPTIME;
-  int need_capacity = flags & CIRCLAUNCH_NEED_CAPACITY;
-  int internal = flags & CIRCLAUNCH_IS_INTERNAL;
+  int need_uptime = (flags & CIRCLAUNCH_NEED_UPTIME) != 0;
+  int need_capacity = (flags & CIRCLAUNCH_NEED_CAPACITY) != 0;
+  int internal = (flags & CIRCLAUNCH_IS_INTERNAL) != 0;
 
   log_debug(LD_CIRC,
             "Hunting for a circ to cannibalize: purpose %d, uptime %d, "

Modified: tor/branches/tor-0_2_0-patches/src/or/rendservice.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/rendservice.c	2008-06-24 20:07:45 UTC (rev 15458)
+++ tor/branches/tor-0_2_0-patches/src/or/rendservice.c	2008-06-24 20:39:47 UTC (rev 15459)
@@ -797,6 +797,22 @@
              escaped_safe_str(intro->extend_info->nickname));
     return -1;
   }
+
+  if (memcmp(intro->extend_info->identity_digest,
+      launched->build_state->chosen_exit->identity_digest, DIGEST_LEN)) {
+    char cann[HEX_DIGEST_LEN+1], orig[HEX_DIGEST_LEN+1];
+    base16_encode(cann, sizeof(cann),
+                  launched->build_state->chosen_exit->identity_digest,
+                  DIGEST_LEN);
+    base16_encode(orig, sizeof(orig),
+                  intro->extend_info->identity_digest, DIGEST_LEN);
+    log_info(LD_REND, "The intro circuit we just cannibalized ends at $%s, "
+                      "but we requested an intro circuit to $%s. Updating "
+                      "our service.", cann, orig);
+    extend_info_free(intro->extend_info);
+    intro->extend_info = extend_info_dup(launched->build_state->chosen_exit);
+  }
+
   strlcpy(launched->rend_query, service->service_id,
           sizeof(launched->rend_query));
   memcpy(launched->rend_pk_digest, service->pk_digest, DIGEST_LEN);