[or-cvs] Add a new config option TestVia, that lets you specify pref...

arma at seul.org arma at seul.org
Sat Jun 10 00:26:41 UTC 2006


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

Modified Files:
	circuitbuild.c config.c or.h 
Log Message:
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.


Index: circuitbuild.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/circuitbuild.c,v
retrieving revision 1.242
retrieving revision 1.243
diff -u -p -d -r1.242 -r1.243
--- circuitbuild.c	9 Jun 2006 09:07:59 -0000	1.242
+++ circuitbuild.c	10 Jun 2006 00:26:38 -0000	1.243
@@ -1481,6 +1481,7 @@ choose_good_middle_server(uint8_t purpos
   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 purpos
     }
   }
   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;
 }

Index: config.c
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/config.c,v
retrieving revision 1.565
retrieving revision 1.566
diff -u -p -d -r1.565 -r1.566
--- config.c	9 Jun 2006 02:20:42 -0000	1.565
+++ config.c	10 Jun 2006 00:26:39 -0000	1.566
@@ -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_optio
     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) {

Index: or.h
===================================================================
RCS file: /home2/or/cvsroot/tor/src/or/or.h,v
retrieving revision 1.837
retrieving revision 1.838
diff -u -p -d -r1.837 -r1.838
--- or.h	8 Jun 2006 22:36:13 -0000	1.837
+++ or.h	10 Jun 2006 00:26:39 -0000	1.838
@@ -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 */



More information about the tor-commits mailing list