From 27f30040f63d13234d07e58cf3d0d2a3cbd93ce5 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 1 Oct 2014 17:44:21 +1000 Subject: [PATCH 1/3] Add TestingDirAuthVoteExit option (like TestingDirAuthVoteGuard) Add the TestingDirAuthVoteExit option, a list of nodes to vote Exit for, regardless of their uptime, bandwidth, or exit policy. TestingTorNetwork must be set for this option to have any effect. Works around an issue where authorities would take up to 35 minutes to give nodes the Exit flag in a test network, despite short consensus intervals. Partially implements ticket 13161. --- changes/feature13161-TestingDirAuthVoteExit | 7 +++++++ doc/tor.1.txt | 9 +++++++++ src/or/config.c | 1 + src/or/dirserv.c | 15 +++++++++++---- src/or/or.h | 4 ++++ 5 files changed, 32 insertions(+), 4 deletions(-) create mode 100644 changes/feature13161-TestingDirAuthVoteExit diff --git a/changes/feature13161-TestingDirAuthVoteExit b/changes/feature13161-TestingDirAuthVoteExit new file mode 100644 index 0000000000..d6c8f414a3 --- /dev/null +++ b/changes/feature13161-TestingDirAuthVoteExit @@ -0,0 +1,7 @@ + o Minor features (testing): + - Add the TestingDirAuthVoteExit option, a list of nodes to vote + Exit for regardless of their uptime, bandwidth, or exit policy. + TestingTorNetwork must be set for this option to have any effect. + Works around an issue where authorities would take up to 35 minutes + to give nodes the Exit flag in a test network, despite short + consensus intervals. Partially implements ticket 13161. diff --git a/doc/tor.1.txt b/doc/tor.1.txt index ff178196a8..c0b8c11692 100644 --- a/doc/tor.1.txt +++ b/doc/tor.1.txt @@ -2197,6 +2197,15 @@ The following options are used for running a testing Tor network. Try this often to download a v3 authority certificate before giving up. Changing this requires that **TestingTorNetwork** is set. (Default: 8) +[[TestingDirAuthVoteExit]] **TestingDirAuthVoteExit** __node__,__node__,__...__:: + A list of identity fingerprints, nicknames, country codes and + address patterns of nodes to vote Exit for regardless of their + uptime, bandwidth, or exit policy. See the **ExcludeNodes** + option for more information on how to specify nodes. + + + In order for this option to have any effect, **TestingTorNetwork** + has to be set. + [[TestingDirAuthVoteGuard]] **TestingDirAuthVoteGuard** __node__,__node__,__...__:: A list of identity fingerprints, nicknames, country codes and address patterns of nodes to vote Guard for regardless of their diff --git a/src/or/config.c b/src/or/config.c index 921d032529..3b37a123af 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -439,6 +439,7 @@ static config_var_t option_vars_[] = { V(TestingDescriptorMaxDownloadTries, UINT, "8"), V(TestingMicrodescMaxDownloadTries, UINT, "8"), V(TestingCertMaxDownloadTries, UINT, "8"), + V(TestingDirAuthVoteExit, ROUTERSET, NULL), V(TestingDirAuthVoteGuard, ROUTERSET, NULL), VAR("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_, "0"), diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 374cfa6f40..c8f47e648e 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2169,12 +2169,19 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs, rs->ipv6_orport = ri->ipv6_orport; } - /* Iff we are in a testing network, use TestingDirAuthVoteGuard to + /* Iff we are in a testing network, use TestingDirAuthVoteExit to + give out Exit flags, and TestingDirAuthVoteGuard to give out Guard flags. */ - if (options->TestingTorNetwork && - routerset_contains_routerstatus(options->TestingDirAuthVoteGuard, + if (options->TestingTorNetwork) { + if (routerset_contains_routerstatus(options->TestingDirAuthVoteExit, + rs, 0)) { + rs->is_exit = 1; + } + + if (routerset_contains_routerstatus(options->TestingDirAuthVoteGuard, rs, 0)) { - rs->is_possible_guard = 1; + rs->is_possible_guard = 1; + } } } diff --git a/src/or/or.h b/src/or/or.h index 54cee46ee3..4130ea6351 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -4056,6 +4056,10 @@ typedef struct { /** Minimum value for the Fast flag threshold on testing networks. */ uint64_t TestingMinFastFlagThreshold; + /** Relays in a testing network which should be voted Exit + * regardless of exit policy. */ + routerset_t *TestingDirAuthVoteExit; + /** Relays in a testing network which should be voted Guard * regardless of uptime and bandwidth. */ routerset_t *TestingDirAuthVoteGuard; From 7c0215f8cafd2b7e1d251439b97ad97ec46e6211 Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 1 Oct 2014 17:56:53 +1000 Subject: [PATCH 2/3] test-network.sh: Use "/bin/echo -n" rather than builtin echo The default shell on OS X is bash, which has a builtin echo. When called in "sh" mode, this echo does not accept "-n". This patch uses "/bin/echo -n" instead. Partially fixes issue 13161. --- changes/bug13161-test-network-echo-n | 3 +++ src/test/test-network.sh | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changes/bug13161-test-network-echo-n diff --git a/changes/bug13161-test-network-echo-n b/changes/bug13161-test-network-echo-n new file mode 100644 index 0000000000..501ebdda1f --- /dev/null +++ b/changes/bug13161-test-network-echo-n @@ -0,0 +1,3 @@ + o Minor bugfixes: + - Stop using "echo -n", as some shells' built-in echo doesn't support + "-n". Instead, use "/bin/echo -n". Partially fixes bug 13161. diff --git a/src/test/test-network.sh b/src/test/test-network.sh index 7b59864166..e1bed5c694 100755 --- a/src/test/test-network.sh +++ b/src/test/test-network.sh @@ -1,5 +1,7 @@ #! /bin/sh +ECHO_N="/bin/echo -n" + until [ -z $1 ] do case $1 in @@ -40,8 +42,8 @@ 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=18 -echo -n "$myname: sleeping for $BOOTSTRAP_TIME seconds" +$ECHO_N "$myname: sleeping for $BOOTSTRAP_TIME seconds" n=$BOOTSTRAP_TIME; while [ $n -gt 0 ]; do - sleep 1; n=$(expr $n - 1); echo -n . + sleep 1; n=$(expr $n - 1); $ECHO_N . done; echo "" ./chutney verify $CHUTNEY_NETWORK From bae73343902072c24469d42deffe90b22b7fff6e Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 1 Oct 2014 18:05:04 +1000 Subject: [PATCH 3/3] Add test-network delay option Add a --delay option to test-network.sh, which configures the delay before the chutney network tests for data transmission. The default remains at 18 seconds if the argument isn't specified. Apparently we should be using bootstrap status for this (eventually). Partially implements ticket 13161. --- changes/feature13161-test-network-delay-option | 4 ++++ src/test/test-network.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 changes/feature13161-test-network-delay-option diff --git a/changes/feature13161-test-network-delay-option b/changes/feature13161-test-network-delay-option new file mode 100644 index 0000000000..1cf2e71a37 --- /dev/null +++ b/changes/feature13161-test-network-delay-option @@ -0,0 +1,4 @@ + o Minor features (testing): + - Add a --delay option to test-network.sh, which configures the delay + before the chutney network tests for data transmission. + Partially implements ticket 13161. diff --git a/src/test/test-network.sh b/src/test/test-network.sh index e1bed5c694..4fe4e639fe 100755 --- a/src/test/test-network.sh +++ b/src/test/test-network.sh @@ -17,6 +17,10 @@ do export NETWORK_FLAVOUR="$2" shift ;; + --delay|--sleep|--bootstrap-time|--time) + export BOOTSTRAP_TIME="$2" + shift + ;; *) echo "Sorry, I don't know what to do with '$1'." exit 2 @@ -41,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=18 +BOOTSTRAP_TIME=${BOOTSTRAP_TIME:-18} $ECHO_N "$myname: sleeping for $BOOTSTRAP_TIME seconds" n=$BOOTSTRAP_TIME; while [ $n -gt 0 ]; do sleep 1; n=$(expr $n - 1); $ECHO_N .