[or-cvs] don"t pick myself or my twins as hops when building circuits

Roger Dingledine arma at seul.org
Wed Apr 7 21:12:56 UTC 2004


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

Modified Files:
	circuit.c onion.c 
Log Message:
don't pick myself or my twins as hops when building circuits


Index: circuit.c
===================================================================
RCS file: /home/or/cvsroot/src/or/circuit.c,v
retrieving revision 1.194
retrieving revision 1.195
diff -u -d -r1.194 -r1.195
--- circuit.c	7 Apr 2004 20:59:38 -0000	1.194
+++ circuit.c	7 Apr 2004 21:12:54 -0000	1.195
@@ -1159,7 +1159,7 @@
     case CIRCUIT_PURPOSE_C_INTRODUCING:
       /* at Alice, connecting to intro point */
       /* Don't increment failure count, since Bob may have picked
-       * the inttroduction point badly */
+       * the introduction point maliciously */
       /* Alice will pick a new intro point when this one dies, if
        * the stream in question still cares. No need to act here. */
       break;
@@ -1174,11 +1174,11 @@
     case CIRCUIT_PURPOSE_S_CONNECT_REND:
       /* at Bob, connecting to rend point */
       /* Don't increment failure count, since Alice may have picked
-       * the rendezvous point badly */
+       * the rendezvous point maliciously */
       log_fn(LOG_INFO,"Couldn't connect to Alice's chosen rend point %s. Sucks to be Alice.", circ->build_state->chosen_exit);
       break;
     default:
-      /* Other cases are impossible, since this function is only caused with
+      /* Other cases are impossible, since this function is only called with
        * unbuilt circuits. */
       assert(0);
   }

Index: onion.c
===================================================================
RCS file: /home/or/cvsroot/src/or/onion.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -d -r1.148 -r1.149
--- onion.c	7 Apr 2004 20:11:28 -0000	1.148
+++ onion.c	7 Apr 2004 21:12:54 -0000	1.149
@@ -231,6 +231,14 @@
   n_supported = tor_malloc(sizeof(int)*smartlist_len(dir->routers));
   for (i = 0; i < smartlist_len(dir->routers); ++i) { /* iterate over routers */
     router = smartlist_get(dir->routers, i);
+    if(router_is_me(router)) {
+      n_supported[i] = -1;
+      log_fn(LOG_DEBUG,"Skipping node %s -- it's me.", router->nickname);
+      /* XXX there's probably a reverse predecessor attack here, but
+       * it's slow. should we take this out? -RD
+       */
+      continue;
+    }
     if(!router->is_running) {
       n_supported[i] = -1;
       log_fn(LOG_DEBUG,"Skipping node %s (index %d) -- directory says it's not running.",
@@ -474,6 +482,7 @@
     add_nickname_list_to_smartlist(sl,options.EntryNodes);
     /* XXX one day, consider picking chosen_exit knowing what's in EntryNodes */
     remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
+    remove_twins_from_smartlist(sl,router_get_my_routerinfo());
     smartlist_subtract(sl,excludednodes);
     choice = smartlist_choose(sl);
     smartlist_free(sl);
@@ -481,6 +490,7 @@
       sl = smartlist_create();
       router_add_running_routers_to_smartlist(sl);
       remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
+      remove_twins_from_smartlist(sl,router_get_my_routerinfo());
       smartlist_subtract(sl,excludednodes);
       choice = smartlist_choose(sl);
       smartlist_free(sl);
@@ -495,6 +505,7 @@
     sl = smartlist_create();
     router_add_running_routers_to_smartlist(sl);
     remove_twins_from_smartlist(sl,router_get_by_nickname(state->chosen_exit));
+    remove_twins_from_smartlist(sl,router_get_my_routerinfo());
     for (i = 0, cpath = *head_ptr; i < cur_len; ++i, cpath=cpath->next) {
       r = router_get_by_addr_port(cpath->addr, cpath->port);
       assert(r);



More information about the tor-commits mailing list