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

[or-cvs] Fix a bug found by Lasse Overlier: when we were making inte...



Update of /home2/or/cvsroot/tor/src/or
In directory moria:/home/arma/work/onion/cvs/tor/src/or

Modified Files:
	circuitbuild.c 
Log Message:
Fix a bug found by Lasse Overlier: when we were making internal circuits
(intended to be cannibalized later for rendezvous and introduction
circuits), we were picking them so that they had useful exit nodes. There
was no need for this, and it actually aids some statistical attacks.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- circuitbuild.c	24 Nov 2005 06:06:50 -0000	1.161
+++ circuitbuild.c	24 Nov 2005 06:43:39 -0000	1.162
@@ -1244,13 +1244,18 @@
  */
 static routerinfo_t *
 choose_good_exit_server(uint8_t purpose, routerlist_t *dir,
-                        int need_uptime, int need_capacity)
+                        int need_uptime, int need_capacity, int is_internal)
 {
   routerinfo_t *r;
   or_options_t *options = get_options();
   switch (purpose) {
     case CIRCUIT_PURPOSE_C_GENERAL:
-      return choose_good_exit_server_general(dir, need_uptime, need_capacity);
+      if (is_internal) /* pick it like a middle hop */
+        return router_choose_random_node(NULL, get_options()->ExcludeNodes,
+               NULL, need_uptime, need_capacity,
+               get_options()->_AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
+      else
+        return choose_good_exit_server_general(dir, need_uptime, need_capacity);
     case CIRCUIT_PURPOSE_C_ESTABLISH_REND:
       r = router_choose_random_node(options->RendNodes, options->RendExcludeNodes,
           NULL, need_uptime, need_capacity,
@@ -1283,8 +1288,8 @@
     exit = extend_info_dup(exit);
   } else { /* we have to decide one */
     routerinfo_t *router =
-           choose_good_exit_server(circ->purpose, rl,
-                                   state->need_uptime, state->need_capacity);
+           choose_good_exit_server(circ->purpose, rl, state->need_uptime,
+                                   state->need_capacity, state->is_internal);
     if (!router) {
       warn(LD_CIRC,"failed to choose an exit server");
       return -1;