Browse Source

don't pick administrative-friends when picking your path
(just a skeleton for now)


svn:r2349

Roger Dingledine 21 years ago
parent
commit
959199340a
4 changed files with 23 additions and 5 deletions
  1. 13 4
      src/or/circuitbuild.c
  2. 2 1
      src/or/config.c
  3. 1 0
      src/or/or.h
  4. 7 0
      src/or/routerlist.c

+ 13 - 4
src/or/circuitbuild.c

@@ -1074,14 +1074,19 @@ static routerinfo_t *choose_good_middle_server(cpath_build_state_t *state,
 
   log_fn(LOG_DEBUG, "Contemplating intermediate hop: random choice.");
   excluded = smartlist_create();
-  if((r = router_get_by_digest(state->chosen_exit_digest)))
+  if((r = router_get_by_digest(state->chosen_exit_digest))) {
     smartlist_add(excluded, r);
-  if((r = routerlist_find_my_routerinfo()))
+    routerlist_add_friends(excluded, r);
+  }
+  if((r = routerlist_find_my_routerinfo())) {
     smartlist_add(excluded, r);
+    routerlist_add_friends(excluded, r);
+  }
   for (i = 0, cpath = head; i < cur_len; ++i, cpath=cpath->next) {
     r = router_get_by_digest(cpath->identity_digest);
     tor_assert(r);
     smartlist_add(excluded, r);
+    routerlist_add_friends(excluded, r);
   }
   choice = router_choose_random_node("", options.ExcludeNodes, excluded,
            0, 1, options._AllowUnverified & ALLOW_UNVERIFIED_MIDDLE, 0);
@@ -1095,10 +1100,14 @@ static routerinfo_t *choose_good_entry_server(cpath_build_state_t *state)
   smartlist_t *excluded = smartlist_create();
   char buf[16];
 
-  if((r = router_get_by_digest(state->chosen_exit_digest)))
+  if((r = router_get_by_digest(state->chosen_exit_digest))) {
     smartlist_add(excluded, r);
-  if((r = routerlist_find_my_routerinfo()))
+    routerlist_add_friends(excluded, r);
+  }
+  if((r = routerlist_find_my_routerinfo())) {
     smartlist_add(excluded, r);
+    routerlist_add_friends(excluded, r);
+  }
   if(options.FascistFirewall) {
     /* exclude all ORs that listen on the wrong port */
     routerlist_t *rl;

+ 2 - 1
src/or/config.c

@@ -1045,7 +1045,8 @@ const char *get_data_directory(or_options_t *options) {
   if (d && strncmp(d,"~/",2)==0) {
     char *fn = expand_filename(d);
     if(!fn) {
-      /* XXX complain and exit(1) here */
+      log_fn(LOG_ERR,"Failed to expand filename '%s'. Exiting.",d);
+      exit(1);
     }
     tor_free(options->DataDirectory);
     options->DataDirectory = fn;

+ 1 - 0
src/or/or.h

@@ -1394,6 +1394,7 @@ int router_reload_router_list(void);
 routerinfo_t *router_pick_directory_server(int requireauth, int requireothers);
 int all_directory_servers_down(void);
 struct smartlist_t;
+void routerlist_add_friends(struct smartlist_t *sl, routerinfo_t *router);
 void add_nickname_list_to_smartlist(struct smartlist_t *sl, const char *list, int warn_if_down);
 routerinfo_t *routerlist_find_my_routerinfo(void);
 int router_nickname_matches(routerinfo_t *router, const char *nickname);

+ 7 - 0
src/or/routerlist.c

@@ -175,6 +175,13 @@ int all_directory_servers_down(void) {
   return 1;
 }
 
+/** Add all the friends of <b>router</b> to the smartlist <b>sl</b>.
+ */
+void routerlist_add_friends(smartlist_t *sl, routerinfo_t *router) {
+
+
+}
+
 /** Given a comma-and-whitespace separated list of nicknames, see which
  * nicknames in <b>list</b> name routers in our routerlist that are
  * currently running.  Add the routerinfos for those routers to <b>sl</b>.