]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote-tracking branch 'teor/feature4483-v10-squashed'
authorNick Mathewson <nickm@torproject.org>
Tue, 15 Dec 2015 17:57:57 +0000 (12:57 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 15 Dec 2015 17:57:57 +0000 (12:57 -0500)
1  2 
doc/tor.1.txt
src/or/config.c
src/or/connection.h
src/or/directory.h
src/or/or.h
src/or/routerlist.c
src/or/routerlist.h
src/test/include.am
src/test/test_config.c

diff --cc doc/tor.1.txt
index 7f8d9b6cbf03e5e240a0fe85e3393b9cd464f627,2d95a5451fa4a2b312bd14aa44ff533495fb7f11..d8802bf104ec8301c9b14079588afdc475a661fc
@@@ -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/or/config.c
Simple merge
Simple merge
Simple merge
diff --cc src/or/or.h
Simple merge
Simple merge
Simple merge
Simple merge
index 4ecd5148e0b3c7eebfd32fd3cab66f4e3601988f,376dc1a31d6ae2c4bbb081548f02234df1ac5b5d..1d25f8693f330b8db5103968ec91ad380b626a70
@@@ -3205,45 -3245,48 +3241,87 @@@ test_config_adding_dir_servers(void *ar
    UNMOCK(add_default_fallback_dir_servers);
  }
  
 +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 }