[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Merge remote-tracking branch 'teor/feature4483-v10-squashed'
commit a7d44731d9ac831cd68f34ac640b50cdde3a60af
Merge: 5443399 d72af10
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Tue Dec 15 12:57:57 2015 -0500
Merge remote-tracking branch 'teor/feature4483-v10-squashed'
changes/bug4483-multiple-consensus-downloads | 9 +
doc/tor.1.txt | 61 ++-
src/common/torint.h | 26 +
src/or/config.c | 76 ++-
src/or/connection.c | 230 +++++---
src/or/connection.h | 59 +-
src/or/directory.c | 479 ++++++++++++++--
src/or/directory.h | 27 +-
src/or/entrynodes.c | 2 +-
src/or/main.c | 24 +-
src/or/networkstatus.c | 358 +++++++++++-
src/or/networkstatus.h | 8 +
src/or/or.h | 120 +++-
src/or/routerlist.c | 37 +-
src/or/routerlist.h | 1 +
src/test/Makefile.nmake | 3 +-
src/test/include.am | 1 +
src/test/test.c | 2 +
src/test/test_config.c | 99 +++-
src/test/test_connection.c | 757 ++++++++++++++++++++++++++
src/test/test_dir.c | 431 +++++++++++++++
src/test/test_routerlist.c | 4 +-
22 files changed, 2621 insertions(+), 193 deletions(-)
diff --cc doc/tor.1.txt
index 7f8d9b6,2d95a54..d8802bf
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@@ -360,14 -360,11 +360,18 @@@ GENERAL OPTION
[[FallbackDir]] **FallbackDir** __address__:__port__ orport=__port__ id=__fingerprint__ [weight=__num__]::
When we're unable to connect to any directory cache for directory info
- (usually because we don't know about any yet) we try a FallbackDir.
+ (usually because we don't know about any yet) we try a directory authority.
+ Clients also simultaneously try a FallbackDir, to avoid hangs on client
+ startup if a directory authority is down. Clients retry FallbackDirs more
+ often than directory authorities, to reduce the load on the directory
+ authorities.
+ By default, the directory authorities are also FallbackDirs. Specifying a
+ FallbackDir replaces Tor's default hard-coded FallbackDirs (if any).
+
+[[UseDefaultFallbackDirs]] **UseDefaultFallbackDirs** **0**|**1**::
+ Use Tor's default hard-coded FallbackDirs (if any). (When a
+ FallbackDir line is present, it replaces the hard-coded FallbackDirs,
+ regardless of the value of UseDefaultFallbackDirs.) (Default: 1)
[[DirAuthority]] **DirAuthority** [__nickname__] [**flags**] __address__:__port__ __fingerprint__::
Use a nonstandard authoritative directory server at the provided address
diff --cc src/test/test_config.c
index 4ecd514,376dc1a..1d25f86
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@@ -3206,44 -3246,47 +3242,86 @@@ test_config_adding_dir_servers(void *ar
}
static void
+test_config_default_dir_servers(void *arg)
+{
+ or_options_t *opts = NULL;
+ (void)arg;
+ int trusted_count = 0;
+ int fallback_count = 0;
+
+ opts = tor_malloc_zero(sizeof(or_options_t));
+ opts->UseDefaultFallbackDirs = 0;
+ consider_adding_dir_servers(opts, opts);
+ trusted_count = smartlist_len(router_get_trusted_dir_servers());
+ fallback_count = smartlist_len(router_get_fallback_dir_servers());
+ or_options_free(opts);
+ opts = NULL;
+
+ /* assume a release will never go out with less than 7 authorities */
+ tt_assert(trusted_count >= 7);
+ /* if we disable the default fallbacks, there must not be any extra */
+ tt_assert(fallback_count == trusted_count);
+
+ opts = tor_malloc_zero(sizeof(or_options_t));
+ opts->UseDefaultFallbackDirs = 1;
+ consider_adding_dir_servers(opts, opts);
+ trusted_count = smartlist_len(router_get_trusted_dir_servers());
+ fallback_count = smartlist_len(router_get_fallback_dir_servers());
+ or_options_free(opts);
+ opts = NULL;
+
+ /* assume a release will never go out with less than 7 authorities */
+ tt_assert(trusted_count >= 7);
+ /* XX/teor - allow for default fallbacks to be added without breaking
+ * the unit tests. Set a minimum fallback count once the list is stable. */
+ tt_assert(fallback_count >= trusted_count);
+
+ done:
+ or_options_free(opts);
+}
+
++static void
+ test_config_use_multiple_directories(void *arg)
+ {
+ (void)arg;
+
+ or_options_t *options = tor_malloc_zero(sizeof(or_options_t));
+
+ /* Clients can use multiple directory mirrors for bootstrap */
+ memset(options, 0, sizeof(or_options_t));
+ options->ClientOnly = 1;
+ tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
+ == 1);
+
+ /* Bridge Clients can use multiple directory mirrors for bootstrap */
+ memset(options, 0, sizeof(or_options_t));
+ options->UseBridges = 1;
+ tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
+ == 1);
+
+ /* Bridge Relays (Bridges) must act like clients, and use multiple
+ * directory mirrors for bootstrap */
+ memset(options, 0, sizeof(or_options_t));
+ options->BridgeRelay = 1;
+ tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
+ == 1);
+
+ /* Clients set to FetchDirInfoEarly must fetch it from the authorities */
+ memset(options, 0, sizeof(or_options_t));
+ options->FetchDirInfoEarly = 1;
+ tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
+ == 0);
+
+ /* OR servers must fetch the consensus from the authorities */
+ memset(options, 0, sizeof(or_options_t));
+ options->ORPort_set = 1;
+ tt_assert(networkstatus_consensus_can_use_multiple_directories(options)
+ == 0);
+
+ done:
+ tor_free(options);
+ }
+
#define CONFIG_TEST(name, flags) \
{ #name, test_config_ ## name, flags, NULL, NULL }
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits