From e136606fe8325140f26dda26d2f634961aae5448 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 4 Jan 2015 20:10:53 -0500 Subject: Smaller RendPostPeriod on test networks This patch makes the minimum 5 seconds, and the default 2 minutes. Closes 13401. --- src/or/config.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/or/config.c') diff --git a/src/or/config.c b/src/or/config.c index 2fa077e146..9a374847d7 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -496,6 +496,7 @@ static const config_var_t testing_tor_network_defaults[] = { V(TestingEnableCellStatsEvent, BOOL, "1"), V(TestingEnableTbEmptyEvent, BOOL, "1"), VAR("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_, "1"), + V(RendPostPeriod, INTERVAL, "2 minutes"), { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } }; @@ -2492,6 +2493,7 @@ compute_publishserverdescriptor(or_options_t *options) /** Lowest allowable value for RendPostPeriod; if this is too low, hidden * services can overload the directory system. */ #define MIN_REND_POST_PERIOD (10*60) +#define MIN_REND_POST_PERIOD_TESTING (5) /** Higest allowable value for PredictedPortsRelevanceTime; if this is * too high, our selection of exits will decrease for an extended @@ -2976,10 +2978,13 @@ options_validate(or_options_t *old_options, or_options_t *options, options->MinUptimeHidServDirectoryV2 = 0; } - if (options->RendPostPeriod < MIN_REND_POST_PERIOD) { + const int min_rendpostperiod = + options->TestingTorNetwork ? + MIN_REND_POST_PERIOD_TESTING : MIN_REND_POST_PERIOD; + if (options->RendPostPeriod < min_rendpostperiod) { log_warn(LD_CONFIG, "RendPostPeriod option is too short; " - "raising to %d seconds.", MIN_REND_POST_PERIOD); - options->RendPostPeriod = MIN_REND_POST_PERIOD; + "raising to %d seconds.", min_rendpostperiod); + options->RendPostPeriod = min_rendpostperiod;; } if (options->RendPostPeriod > MAX_DIR_PERIOD) { -- cgit v1.2.3-54-g00ecf From f9d57473e1ff34f1ec56c62dd9ea138ceec42d6f Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 10 Jan 2015 21:43:31 +1100 Subject: Create TestingDirAuthVoteHSDir like TestingDirAuthVoteExit/Guard TestingDirAuthVoteHSDir ensures that authorities vote the HSDir flag for the listed relays regardless of uptime or ORPort connectivity. Respects the value of VoteOnHidServDirectoriesV2. Partial fix for bug 14067. --- changes/bug14067-TestingDirAuthVoteHSDir | 6 ++++++ doc/tor.1.txt | 9 +++++++++ src/or/config.c | 1 + src/or/dirserv.c | 15 +++++++++++---- src/or/or.h | 5 +++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 changes/bug14067-TestingDirAuthVoteHSDir (limited to 'src/or/config.c') diff --git a/changes/bug14067-TestingDirAuthVoteHSDir b/changes/bug14067-TestingDirAuthVoteHSDir new file mode 100644 index 0000000000..52d2bee5e6 --- /dev/null +++ b/changes/bug14067-TestingDirAuthVoteHSDir @@ -0,0 +1,6 @@ + o Minor features (authorities, testing): + - Create TestingDirAuthVoteHSDir like TestingDirAuthVoteExit/Guard. + Ensures that authorities vote the HSDir flag for the listed + relays regardless of uptime or ORPort connectivity. + Respects the value of VoteOnHidServDirectoriesV2. + Partial fix for bug 14067. Patch by "teor". diff --git a/doc/tor.1.txt b/doc/tor.1.txt index 9e86a67359..7b214538b0 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -2245,6 +2245,15 @@ The following options are used for running a testing Tor network. In order for this option to have any effect, **TestingTorNetwork** has to be set. +[[TestingDirAuthVoteHSDir]] **TestingDirAuthVoteHSDir** __node__,__node__,__...__:: + A list of identity fingerprints and country codes and + address patterns of nodes to vote HSDir for regardless of their + uptime and ORPort connectivity. See the **ExcludeNodes** option for more + information on how to specify nodes. + + + In order for this option to have any effect, **TestingTorNetwork** + and **VoteOnHidServDirectoriesV2** both have to be set. + [[TestingEnableConnBwEvent]] **TestingEnableConnBwEvent** **0**|**1**:: If this option is set, then Tor controllers may register for CONN_BW events. Changing this requires that **TestingTorNetwork** is set. diff --git a/src/or/config.c b/src/or/config.c index 9a374847d7..a1347b9d7d 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -448,6 +448,7 @@ static config_var_t option_vars_[] = { V(TestingCertMaxDownloadTries, UINT, "8"), V(TestingDirAuthVoteExit, ROUTERSET, NULL), V(TestingDirAuthVoteGuard, ROUTERSET, NULL), + V(TestingDirAuthVoteHSDir, ROUTERSET, NULL), VAR("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_, "0"), { NULL, CONFIG_TYPE_OBSOLETE, 0, NULL } diff --git a/src/or/dirserv.c b/src/or/dirserv.c index d668749c5b..8abe6cb778 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2113,9 +2113,10 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs, rs->ipv6_orport = ri->ipv6_orport; } - /* Iff we are in a testing network, use TestingDirAuthVoteExit to - give out Exit flags, and TestingDirAuthVoteGuard to - give out Guard flags. */ + /* Iff we are in a testing network, use TestingDirAuthVoteExit, + TestingDirAuthVoteGuard, and TestingDirAuthVoteHSDir to + give out the Exit, Guard, and HSDir flags, respectively. + But don't set the corresponding node flags. */ if (options->TestingTorNetwork) { if (routerset_contains_routerstatus(options->TestingDirAuthVoteExit, rs, 0)) { @@ -2123,9 +2124,15 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs, } if (routerset_contains_routerstatus(options->TestingDirAuthVoteGuard, - rs, 0)) { + rs, 0)) { rs->is_possible_guard = 1; } + + if (routerset_contains_routerstatus(options->TestingDirAuthVoteHSDir, + rs, 0)) { + /* TestingDirAuthVoteHSDir respects VoteOnHidServDirectoriesV2 */ + rs->is_hs_dir = vote_on_hsdirs; + } } } diff --git a/src/or/or.h b/src/or/or.h index 58e2164665..f3fee8fc73 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4105,6 +4105,11 @@ typedef struct { * regardless of uptime and bandwidth. */ routerset_t *TestingDirAuthVoteGuard; + /** Relays in a testing network which should be voted HSDir + * regardless of uptime and ORPort connectivity. + * Respects VoteOnHidServDirectoriesV2. */ + routerset_t *TestingDirAuthVoteHSDir; + /** Enable CONN_BW events. Only altered on testing networks. */ int TestingEnableConnBwEvent; -- cgit v1.2.3-54-g00ecf