diff --git a/src/or/directory.c b/src/or/directory.c index 62681ae844..e4a5d15553 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -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."); } diff --git a/src/or/routerlist.c b/src/or/routerlist.c index af289ebab6..d319e7d542 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -843,7 +843,11 @@ routerlist_remove_old_routers(int age) * signed directory s. 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 dir_is_recent is non-zero, then examine the + * Recommended-versions line and take appropriate action. + * + * If dir_is_cached 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, diff --git a/src/or/routerparse.c b/src/or/routerparse.c index b4bc715c25..07ecf44cd4 100644 --- a/src/or/routerparse.c +++ b/src/or/routerparse.c @@ -289,10 +289,17 @@ int check_software_version_against_directory(const char *directory, } /** Parse a directory from str and, when done, store the - * resulting routerlist in *dest, freeing the old value if necessary. + * resulting routerlist in *dest, freeing the old value if + * necessary. + * * If pkey is provided, we check the directory signature with pkey. * - * DOCDOC check_version, write_to_cache. + * If check_version is non-zero, then examine the + * Recommended-versions * line in the directory, and warn or quit + * as needed. + * + * If write_to_cache 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,