diff options
-rw-r--r-- | src/or/circuitbuild.c | 6 | ||||
-rw-r--r-- | src/or/config.c | 3 | ||||
-rw-r--r-- | src/or/or.h | 1 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 0e08b03b49..7c09a25f5c 100644 --- a/src/or/circuitbuild.c +++ b/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; } diff --git a/src/or/config.c b/src/or/config.c index a11acb1a73..bcfd258bee 100644 --- a/src/or/config.c +++ b/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) { diff --git a/src/or/or.h b/src/or/or.h index 1434830b61..92a7e5f2b0 100644 --- a/src/or/or.h +++ b/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 */ |