Browse Source

Add a new config option TestVia, that lets you specify preferred middle
hops to use for testing circuits. Perhaps this will let me debug the
reachability problem better.


svn:r6581

Roger Dingledine 19 years ago
parent
commit
889b8d5bac
3 changed files with 8 additions and 2 deletions
  1. 4 2
      src/or/circuitbuild.c
  2. 3 0
      src/or/config.c
  3. 1 0
      src/or/or.h

+ 4 - 2
src/or/circuitbuild.c

@@ -1481,6 +1481,7 @@ choose_good_middle_server(uint8_t purpose,
   routerinfo_t *r, *choice;
   crypt_path_t *cpath;
   smartlist_t *excluded;
+  or_options_t *options = get_options();
   tor_assert(_CIRCUIT_PURPOSE_MIN <= purpose &&
              purpose <= _CIRCUIT_PURPOSE_MAX);
 
@@ -1501,9 +1502,10 @@ choose_good_middle_server(uint8_t purpose,
     }
   }
   choice = router_choose_random_node(
-           NULL, get_options()->ExcludeNodes, excluded,
+           purpose == CIRCUIT_PURPOSE_TESTING ? options->TestVia : NULL,
+           options->ExcludeNodes, excluded,
            state->need_uptime, state->need_capacity, 0,
-           get_options()->_AllowInvalid & ALLOW_INVALID_MIDDLE, 0);
+           options->_AllowInvalid & ALLOW_INVALID_MIDDLE, 0);
   smartlist_free(excluded);
   return choice;
 }

+ 3 - 0
src/or/config.c

@@ -233,6 +233,7 @@ static config_var_t _option_vars[] = {
   VAR("StrictExitNodes",     BOOL,     StrictExitNodes,      "0"),
   VAR("SysLog",              LINELIST_S, OldLogOptions,      NULL),
   VAR("TestSocks",           BOOL,     TestSocks,            "0"),
+  VAR("TestVia",             STRING,   TestVia,              NULL),
   VAR("TrackHostExits",      CSV,      TrackHostExits,       NULL),
   VAR("TrackHostExitsExpire",INTERVAL, TrackHostExitsExpire, "30 minutes"),
   OBSOLETE("TrafficShaping"),
@@ -2378,6 +2379,8 @@ options_validate(or_options_t *old_options, or_options_t *options,
     return -1;
   if (check_nickname_list(options->RendNodes, "RendExcludeNodes", msg))
     return -1;
+  if (check_nickname_list(options->TestVia, "TestVia", msg))
+    return -1;
   if (check_nickname_list(options->MyFamily, "MyFamily", msg))
     return -1;
   for (cl = options->NodeFamilies; cl; cl = cl->next) {

+ 1 - 0
src/or/or.h

@@ -1327,6 +1327,7 @@ typedef struct {
   int NumCpus; /**< How many CPUs should we try to use? */
   int RunTesting; /**< If true, create testing circuits to measure how well the
                    * other ORs are running. */
+  char *TestVia; /**< When reachability testing, use these as middle hop. */
   config_line_t *RendConfigLines; /**< List of configuration lines
                                           * for rendezvous services. */
   char *ContactInfo; /**< Contact info to be published in the directory */