Commit d2738911 authored by Roger Dingledine's avatar Roger Dingledine
Browse files

if we fetch the dir from a mirror that has a wildly skewed

clock, then don't bother checking recommended-versions: it will
just make us sad.

as a side effect, people running obsolete versions and whose
clocks are wildly skewed will not be auto-shut-down. but they
will still get warns about their clock skew.


svn:r3459
parent 191e5217
Loading
Loading
Loading
Loading
+4 −3
Changes for src/or/directory.c: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -592,6 +592,7 @@ connection_dir_client_reached_eof(connection_t *conn)
  int delta;
  int compression;
  int plausible;
  int skewed=0;

  switch (fetch_from_buf_http(conn->inbuf,
                              &headers, MAX_HEADERS_SIZE,
@@ -621,6 +622,7 @@ connection_dir_client_reached_eof(connection_t *conn)
             conn->address,
             abs(delta)/60, delta>0 ? "ahead" : "behind",
             abs(delta)/60, delta>0 ? "behind" : "ahead");
      skewed = 1; /* don't check the recommended-versions line */
    } else {
      log_fn(LOG_INFO, "Time on received directory is within tolerance; we are %d seconds skewed.  (That's okay.)", delta);
    }
@@ -692,9 +694,8 @@ connection_dir_client_reached_eof(connection_t *conn)
      tor_free(body); tor_free(headers);
      return -1;
    }
    /* xxx maybe we can tell router_... here that it was skewed so don't believe it all. */
    if (router_load_routerlist_from_directory(body, NULL, 1, 0) < 0) {
      log_fn(LOG_WARN,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
    if (router_load_routerlist_from_directory(body, NULL, skewed, 0) < 0) {
      log_fn(LOG_NOTICE,"I failed to parse the directory I fetched from %s:%d. Ignoring.", conn->address, conn->port);
    } else {
      log_fn(LOG_INFO,"updated routers.");
    }
+5 −1
Changes for src/or/routerlist.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -843,7 +843,11 @@ routerlist_remove_old_routers(int age)
 * signed directory <b>s</b>.  If pkey is provided, check the signature against
 * pkey; else check against the pkey of the signing directory server.
 *
 * DOCDOC dir_is_recent/cached
 * If <b>dir_is_recent</b> is non-zero, then examine the
 * Recommended-versions line and take appropriate action.
 *
 * If <b>dir_is_cached</b> is non-zero, then we're reading it
 * from the cache so don't bother to re-write it to the cache.
 */
int router_load_routerlist_from_directory(const char *s,
                                          crypto_pk_env_t *pkey,
+9 −2
Changes for src/or/routerparse.c: 9 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -289,10 +289,17 @@ int check_software_version_against_directory(const char *directory,
}

/** Parse a directory from <b>str</b> and, when done, store the
 * resulting routerlist in *<b>dest</b>, freeing the old value if necessary.
 * resulting routerlist in *<b>dest</b>, freeing the old value if
 * necessary.
 *
 * If <b>pkey</b> is provided, we check the directory signature with pkey.
 *
 * DOCDOC check_version, write_to_cache.
 * If <b>check_version</b> is non-zero, then examine the
 * Recommended-versions * line in the directory, and warn or quit
 * as needed.
 *
 * If <b>write_to_cache</b> is non-zero, then store this directory in
 * memory and/or disk as well.
 */
int /* Should be static; exposed for unit tests */
router_parse_routerlist_from_directory(const char *str,