Kaynağa Gözat

new config option FetchDirInfoEarly for tup/ioerror and the tordnsel

svn:r12896
Roger Dingledine 17 yıl önce
ebeveyn
işleme
9ebf86bb66
9 değiştirilmiş dosya ile 36 ekleme ve 21 silme
  1. 5 3
      ChangeLog
  2. 2 1
      contrib/exitlist
  3. 7 0
      doc/tor.1.in
  4. 5 4
      src/or/config.c
  5. 4 3
      src/or/dirserv.c
  6. 2 2
      src/or/main.c
  7. 3 3
      src/or/networkstatus.c
  8. 5 2
      src/or/or.h
  9. 3 3
      src/or/routerlist.c

+ 5 - 3
ChangeLog

@@ -1,4 +1,4 @@
-Changes in version 0.2.0.13-alpha - 2007-12-??
+Changes in version 0.2.0.13-alpha - 2007-12-21
   o New directory authorities:
   o New directory authorities:
     - Set up lefkada (run by Geoff Goodell) as the fourth v3 directory
     - Set up lefkada (run by Geoff Goodell) as the fourth v3 directory
       authority.
       authority.
@@ -18,8 +18,6 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
     - Stop thinking that 0.1.2.x directory servers can handle "begin_dir"
     - Stop thinking that 0.1.2.x directory servers can handle "begin_dir"
       requests. Should ease bugs 406 and 419 where 0.1.2.x relays are
       requests. Should ease bugs 406 and 419 where 0.1.2.x relays are
       crashing or mis-answering these requests.
       crashing or mis-answering these requests.
-    - Stop being so aggressive about fetching v2 dir info if your
-      DirPort is on but your ORPort is off.
     - Relays were publishing their server descriptor to v1 and v2
     - Relays were publishing their server descriptor to v1 and v2
       directory authorities, but they didn't try publishing to v3-only
       directory authorities, but they didn't try publishing to v3-only
       authorities. Fix this; and also stop publishing to v1 authorities.
       authorities. Fix this; and also stop publishing to v1 authorities.
@@ -47,6 +45,10 @@ Changes in version 0.2.0.13-alpha - 2007-12-??
       bridges they know. They provide router status summaries to the
       bridges they know. They provide router status summaries to the
       controller on "getinfo ns/purpose/bridge", and also dump summaries
       controller on "getinfo ns/purpose/bridge", and also dump summaries
       to a file periodically.
       to a file periodically.
+    - Stop fetching directory info so aggressively if your DirPort is
+      on but your ORPort is off; stop fetching v2 dir info entirely.
+      You can override these choices with the new FetchDirInfoEarly
+      config option.
 
 
   o Minor bugfixes:
   o Minor bugfixes:
     - The fix in 0.2.0.12-alpha cleared the "hsdir" flag in v3 network
     - The fix in 0.2.0.12-alpha cleared the "hsdir" flag in v3 network

+ 2 - 1
contrib/exitlist

@@ -17,7 +17,8 @@
     cat ~/.tor/cached-descriptors* | python exitlist 18.244.0.188:80
     cat ~/.tor/cached-descriptors* | python exitlist 18.244.0.188:80
 
 
  You should look at the "FetchUselessDescriptors" config option in the
  You should look at the "FetchUselessDescriptors" config option in the
- man page.
+ man page. For 0.2.0.13-alpha and later, also look at the
+ "FetchDirInfoEarly" config option.
 
 
  Note that this script won't give you a perfect list of IP addresses
  Note that this script won't give you a perfect list of IP addresses
  that might connect to you using Tor, since some Tor servers might exit
  that might connect to you using Tor, since some Tor servers might exit

+ 7 - 0
doc/tor.1.in

@@ -211,6 +211,13 @@ you use it, you will be distinguishable from other users, because you won't
 believe the same authorities they do.
 believe the same authorities they do.
 .LP
 .LP
 .TP
 .TP
+\fBFetchDirInfoEarly \fR\fB0\fR|\fB1\fR\fP
+If set to 1, Tor will always fetch directory information like other
+directory caches, even if you don't meet the normal criteria for
+fetching early. Normal users should leave it off.
+(Default: 0)
+.LP
+.TP
 \fBFetchHidServDescriptors \fR\fB0\fR|\fB1\fR\fP
 \fBFetchHidServDescriptors \fR\fB0\fR|\fB1\fR\fP
 If set to 0, Tor will never fetch any hidden service descriptors from
 If set to 0, Tor will never fetch any hidden service descriptors from
 the rendezvous directories. This option is only useful if you're using
 the rendezvous directories. This option is only useful if you're using

+ 5 - 4
src/or/config.c

@@ -190,6 +190,7 @@ static config_var_t _option_vars[] = {
   V(FascistFirewall,             BOOL,     "0"),
   V(FascistFirewall,             BOOL,     "0"),
   V(FirewallPorts,               CSV,      ""),
   V(FirewallPorts,               CSV,      ""),
   V(FastFirstHopPK,              BOOL,     "1"),
   V(FastFirstHopPK,              BOOL,     "1"),
+  V(FetchDirInfoEarly,           BOOL,     "0"),
   V(FetchServerDescriptors,      BOOL,     "1"),
   V(FetchServerDescriptors,      BOOL,     "1"),
   V(FetchHidServDescriptors,     BOOL,     "1"),
   V(FetchHidServDescriptors,     BOOL,     "1"),
   V(FetchUselessDescriptors,     BOOL,     "0"),
   V(FetchUselessDescriptors,     BOOL,     "0"),
@@ -1240,10 +1241,10 @@ options_act(or_options_t *old_options)
   if (old_options) {
   if (old_options) {
     if (authdir_mode_v3(options) && !authdir_mode_v3(old_options))
     if (authdir_mode_v3(options) && !authdir_mode_v3(old_options))
       dirvote_recalculate_timing(options, time(NULL));
       dirvote_recalculate_timing(options, time(NULL));
-    if (!bool_eq(directory_fetches_dir_info_like_mirror(options),
+    if (!bool_eq(directory_fetches_dir_info_early(options),
-                 directory_fetches_dir_info_like_mirror(old_options)) ||
+                 directory_fetches_dir_info_early(old_options)) ||
-        !bool_eq(directory_fetches_dir_info_like_bridge_user(options),
+        !bool_eq(directory_fetches_dir_info_later(options),
-                 directory_fetches_dir_info_like_bridge_user(old_options))) {
+                 directory_fetches_dir_info_later(old_options))) {
       /* Make sure update_router_have_min_dir_info gets called. */
       /* Make sure update_router_have_min_dir_info gets called. */
       router_dir_info_changed();
       router_dir_info_changed();
       /* We might need to download a new consensus status later or sooner than
       /* We might need to download a new consensus status later or sooner than

+ 4 - 3
src/or/dirserv.c

@@ -1114,7 +1114,8 @@ dirserv_dump_directory_to_string(char **dir_out,
 int
 int
 directory_fetches_from_authorities(or_options_t *options)
 directory_fetches_from_authorities(or_options_t *options)
 {
 {
-  /* XXX if options->FetchDirInfoEagerly, return 1 */
+  if (options->FetchDirInfoEarly)
+    return 1;
   if (options->DirPort == 0)
   if (options->DirPort == 0)
     return 0;
     return 0;
   if (options->BridgeRelay == 1)
   if (options->BridgeRelay == 1)
@@ -1130,7 +1131,7 @@ directory_fetches_from_authorities(or_options_t *options)
  * on the "mirror" schedule rather than the "client" schedule.
  * on the "mirror" schedule rather than the "client" schedule.
  */
  */
 int
 int
-directory_fetches_dir_info_like_mirror(or_options_t *options)
+directory_fetches_dir_info_early(or_options_t *options)
 {
 {
   return directory_fetches_from_authorities(options);
   return directory_fetches_from_authorities(options);
 }
 }
@@ -1142,7 +1143,7 @@ directory_fetches_dir_info_like_mirror(or_options_t *options)
  * client as a directory guard.
  * client as a directory guard.
  */
  */
 int
 int
-directory_fetches_dir_info_like_bridge_user(or_options_t *options)
+directory_fetches_dir_info_later(or_options_t *options)
 {
 {
   return options->UseBridges != 0;
   return options->UseBridges != 0;
 }
 }

+ 2 - 2
src/or/main.c

@@ -954,7 +954,7 @@ run_scheduled_events(time_t now)
    * (if we've passed our internal checks). */
    * (if we've passed our internal checks). */
   if (time_to_fetch_directory < now) {
   if (time_to_fetch_directory < now) {
     /* Only caches actually need to fetch directories now. */
     /* Only caches actually need to fetch directories now. */
-    if (directory_fetches_dir_info_like_mirror(options) &&
+    if (directory_fetches_dir_info_early(options) &&
         !authdir_mode_v1(options)) {
         !authdir_mode_v1(options)) {
       if (any_trusted_dir_is_v1_authority() &&
       if (any_trusted_dir_is_v1_authority() &&
           !should_delay_dir_fetches(options))
           !should_delay_dir_fetches(options))
@@ -967,7 +967,7 @@ run_scheduled_events(time_t now)
   }
   }
 
 
   /* Caches need to fetch running_routers; directory clients don't. */
   /* Caches need to fetch running_routers; directory clients don't. */
-  if (directory_fetches_dir_info_like_mirror(options) &&
+  if (directory_fetches_dir_info_early(options) &&
       time_to_fetch_running_routers < now) {
       time_to_fetch_running_routers < now) {
     if (!authdir_mode_v1(options) && !should_delay_dir_fetches(options)) {
     if (!authdir_mode_v1(options) && !should_delay_dir_fetches(options)) {
       directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST,
       directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST,

+ 3 - 3
src/or/networkstatus.c

@@ -1063,7 +1063,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
     long dl_interval;
     long dl_interval;
     long interval = c->fresh_until - c->valid_after;
     long interval = c->fresh_until - c->valid_after;
     time_t start;
     time_t start;
-    if (directory_fetches_dir_info_like_mirror(options)) {
+    if (directory_fetches_dir_info_early(options)) {
       /* We want to cache the next one at some point after this one
       /* We want to cache the next one at some point after this one
        * is no longer fresh... */
        * is no longer fresh... */
       start = c->fresh_until + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
       start = c->fresh_until + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
@@ -1078,7 +1078,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
 
 
       /* If we're a bridge user, make use of the numbers we just computed
       /* If we're a bridge user, make use of the numbers we just computed
        * to choose the rest of the interval *after* them. */
        * to choose the rest of the interval *after* them. */
-      if (directory_fetches_dir_info_like_bridge_user(options)) {
+      if (directory_fetches_dir_info_later(options)) {
         /* Give all the *clients* enough time to download the consensus. */
         /* Give all the *clients* enough time to download the consensus. */
         start = start + dl_interval + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
         start = start + dl_interval + CONSENSUS_MIN_SECONDS_BEFORE_CACHING;
         /* But try to get it before ours actually expires. */
         /* But try to get it before ours actually expires. */
@@ -1133,7 +1133,7 @@ update_networkstatus_downloads(time_t now)
   or_options_t *options = get_options();
   or_options_t *options = get_options();
   if (should_delay_dir_fetches(options))
   if (should_delay_dir_fetches(options))
     return;
     return;
-  if (directory_fetches_dir_info_like_mirror(options))
+  if (directory_fetches_dir_info_early(options))
     update_v2_networkstatus_cache_downloads(now);
     update_v2_networkstatus_cache_downloads(now);
   update_consensus_networkstatus_downloads(now);
   update_consensus_networkstatus_downloads(now);
   update_certificate_downloads(now);
   update_certificate_downloads(now);

+ 5 - 2
src/or/or.h

@@ -2268,6 +2268,9 @@ typedef struct {
   int RephistTrackTime; /**< How many seconds do we keep rephist info? */
   int RephistTrackTime; /**< How many seconds do we keep rephist info? */
   int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
   int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
                        * of our PK time by sending CREATE_FAST cells? */
                        * of our PK time by sending CREATE_FAST cells? */
+  /** Should we always fetch our dir info on the mirror schedule (which
+   * means directly from the authorities) no matter our other config? */
+  int FetchDirInfoEarly;
 
 
   addr_policy_t *reachable_addr_policy; /**< Parsed from ReachableAddresses */
   addr_policy_t *reachable_addr_policy; /**< Parsed from ReachableAddresses */
 
 
@@ -3066,8 +3069,8 @@ int dirserv_dump_directory_to_string(char **dir_out,
                                      crypto_pk_env_t *private_key);
                                      crypto_pk_env_t *private_key);
 
 
 int directory_fetches_from_authorities(or_options_t *options);
 int directory_fetches_from_authorities(or_options_t *options);
-int directory_fetches_dir_info_like_mirror(or_options_t *options);
+int directory_fetches_dir_info_early(or_options_t *options);
-int directory_fetches_dir_info_like_bridge_user(or_options_t *options);
+int directory_fetches_dir_info_later(or_options_t *options);
 int directory_caches_v2_dir_info(or_options_t *options);
 int directory_caches_v2_dir_info(or_options_t *options);
 #define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
 #define directory_caches_v1_dir_info(o) directory_caches_v2_dir_info(o)
 int directory_caches_dir_info(or_options_t *options);
 int directory_caches_dir_info(or_options_t *options);

+ 3 - 3
src/or/routerlist.c

@@ -3575,7 +3575,7 @@ launch_router_descriptor_downloads(smartlist_t *downloadable, time_t now)
   or_options_t *options = get_options();
   or_options_t *options = get_options();
 
 
   n_downloadable = smartlist_len(downloadable);
   n_downloadable = smartlist_len(downloadable);
-  if (!directory_fetches_dir_info_like_mirror(options)) {
+  if (!directory_fetches_dir_info_early(options)) {
     if (n_downloadable >= MAX_DL_TO_DELAY) {
     if (n_downloadable >= MAX_DL_TO_DELAY) {
       log_debug(LD_DIR,
       log_debug(LD_DIR,
              "There are enough downloadable routerdescs to launch requests.");
              "There are enough downloadable routerdescs to launch requests.");
@@ -3642,7 +3642,7 @@ update_router_descriptor_cache_downloads_v2(time_t now)
   or_options_t *options = get_options();
   or_options_t *options = get_options();
   const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
   const smartlist_t *networkstatus_v2_list = networkstatus_get_v2_list();
 
 
-  if (! directory_fetches_dir_info_like_mirror(options)) {
+  if (! directory_fetches_dir_info_early(options)) {
     log_warn(LD_BUG, "Called update_router_descriptor_cache_downloads_v2() "
     log_warn(LD_BUG, "Called update_router_descriptor_cache_downloads_v2() "
              "on a non-dir-mirror?");
              "on a non-dir-mirror?");
   }
   }
@@ -3877,7 +3877,7 @@ update_router_descriptor_downloads(time_t now)
   or_options_t *options = get_options();
   or_options_t *options = get_options();
   if (should_delay_dir_fetches(options))
   if (should_delay_dir_fetches(options))
     return;
     return;
-  if (directory_fetches_dir_info_like_mirror(options)) {
+  if (directory_fetches_dir_info_early(options)) {
     update_router_descriptor_cache_downloads_v2(now);
     update_router_descriptor_cache_downloads_v2(now);
   }
   }
   update_consensus_router_descriptor_downloads(now);
   update_consensus_router_descriptor_downloads(now);