mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 04:13:28 +01:00
Merge remote-tracking branch 'teor/nickm-bug13401'
This commit is contained in:
commit
180ecd6a2b
7
changes/bug13401
Normal file
7
changes/bug13401
Normal file
@ -0,0 +1,7 @@
|
||||
o Minor features (testing networks):
|
||||
- Drop the minimum RendPostPeriod on a testing network to 5 seconds,
|
||||
and the default to 2 minutes. Closes ticket 13401. Patch by "nickm".
|
||||
- Drop the MIN_REND_INITIAL_POST_DELAY on a testing network to 5 seconds,
|
||||
but keep the default at 30 seconds. This reduces HS bootstrap time to
|
||||
around 25 seconds. Change src/test/test-network.sh default time to match.
|
||||
Closes ticket 13401. Patch by "teor".
|
6
changes/bug14067-TestingDirAuthVoteHSDir
Normal file
6
changes/bug14067-TestingDirAuthVoteHSDir
Normal file
@ -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".
|
@ -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.
|
||||
|
@ -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 }
|
||||
@ -496,6 +497,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 +2494,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 +2979,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) {
|
||||
|
@ -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)) {
|
||||
@ -2126,6 +2127,12 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs,
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -3270,6 +3270,9 @@ rend_services_introduce(void)
|
||||
smartlist_free(exclude_nodes);
|
||||
}
|
||||
|
||||
#define MIN_REND_INITIAL_POST_DELAY (30)
|
||||
#define MIN_REND_INITIAL_POST_DELAY_TESTING (5)
|
||||
|
||||
/** Regenerate and upload rendezvous service descriptors for all
|
||||
* services, if necessary. If the descriptor has been dirty enough
|
||||
* for long enough, definitely upload; else only upload when the
|
||||
@ -3284,6 +3287,9 @@ rend_consider_services_upload(time_t now)
|
||||
int i;
|
||||
rend_service_t *service;
|
||||
int rendpostperiod = get_options()->RendPostPeriod;
|
||||
int rendinitialpostdelay = (get_options()->TestingTorNetwork ?
|
||||
MIN_REND_INITIAL_POST_DELAY_TESTING :
|
||||
MIN_REND_INITIAL_POST_DELAY);
|
||||
|
||||
if (!get_options()->PublishHidServDescriptors)
|
||||
return;
|
||||
@ -3291,17 +3297,17 @@ rend_consider_services_upload(time_t now)
|
||||
for (i=0; i < smartlist_len(rend_service_list); ++i) {
|
||||
service = smartlist_get(rend_service_list, i);
|
||||
if (!service->next_upload_time) { /* never been uploaded yet */
|
||||
/* The fixed lower bound of 30 seconds ensures that the descriptor
|
||||
* is stable before being published. See comment below. */
|
||||
/* The fixed lower bound of rendinitialpostdelay seconds ensures that
|
||||
* the descriptor is stable before being published. See comment below. */
|
||||
service->next_upload_time =
|
||||
now + 30 + crypto_rand_int(2*rendpostperiod);
|
||||
now + rendinitialpostdelay + crypto_rand_int(2*rendpostperiod);
|
||||
}
|
||||
if (service->next_upload_time < now ||
|
||||
(service->desc_is_dirty &&
|
||||
service->desc_is_dirty < now-30)) {
|
||||
service->desc_is_dirty < now-rendinitialpostdelay)) {
|
||||
/* if it's time, or if the directory servers have a wrong service
|
||||
* descriptor and ours has been stable for 30 seconds, upload a
|
||||
* new one of each format. */
|
||||
* descriptor and ours has been stable for rendinitialpostdelay seconds,
|
||||
* upload a new one of each format. */
|
||||
rend_service_update_descriptor(service);
|
||||
upload_service_descriptor(service);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ PATH="$TOR_DIR/src/or:$TOR_DIR/src/tools:$PATH"
|
||||
|
||||
# Sleep some, waiting for the network to bootstrap.
|
||||
# TODO: Add chutney command 'bootstrap-status' and use that instead.
|
||||
BOOTSTRAP_TIME=${BOOTSTRAP_TIME:-18}
|
||||
BOOTSTRAP_TIME=${BOOTSTRAP_TIME:-25}
|
||||
$ECHO_N "$myname: sleeping for $BOOTSTRAP_TIME seconds"
|
||||
n=$BOOTSTRAP_TIME; while [ $n -gt 0 ]; do
|
||||
sleep 1; n=$(expr $n - 1); $ECHO_N .
|
||||
|
Loading…
Reference in New Issue
Block a user