Directory mirrors no longer fetch the v1 directory or

running-routers files. They are obsolete, and nobody asks for them
anymore. This is the first step to making v1 authorities obsolete.


svn:r17513
This commit is contained in:
Roger Dingledine 2008-12-07 23:53:39 +00:00
parent c15b07bb30
commit f31c16d993
4 changed files with 10 additions and 116 deletions

View File

@ -1,4 +1,4 @@
Changes in version 0.2.1.8-alpha - 2008-12-06
Changes in version 0.2.1.8-alpha - 2008-12-08
o Major features:
- New DirPortFrontPage option that takes an html file and publishes
it as "/" on the DirPort. Now relay operators can provide a
@ -47,6 +47,9 @@ Changes in version 0.2.1.8-alpha - 2008-12-06
- Report the case where all signatures in a detached set are rejected
differently than the case where there is an error handling the
detached set. r17446
- Directory mirrors no longer fetch the v1 directory or
running-routers files. They are obsolete, and nobody asks for them
anymore. This is the first step to making v1 authorities obsolete.
o Minor features (controller):
- Return circuit purposes in response to GETINFO circuit-status. Fixes

View File

@ -105,11 +105,9 @@ purpose_needs_anonymity(uint8_t dir_purpose, uint8_t router_purpose)
return 1;
if (router_purpose == ROUTER_PURPOSE_BRIDGE && has_completed_circuit)
return 1; /* if no circuits yet, we may need this info to bootstrap. */
if (dir_purpose == DIR_PURPOSE_FETCH_DIR ||
dir_purpose == DIR_PURPOSE_UPLOAD_DIR ||
if (dir_purpose == DIR_PURPOSE_UPLOAD_DIR ||
dir_purpose == DIR_PURPOSE_UPLOAD_VOTE ||
dir_purpose == DIR_PURPOSE_UPLOAD_SIGNATURES ||
dir_purpose == DIR_PURPOSE_FETCH_RUNNING_LIST ||
dir_purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS ||
dir_purpose == DIR_PURPOSE_FETCH_STATUS_VOTE ||
dir_purpose == DIR_PURPOSE_FETCH_DETACHED_SIGNATURES ||
@ -150,8 +148,6 @@ dir_conn_purpose_to_string(int purpose)
{
switch (purpose)
{
case DIR_PURPOSE_FETCH_DIR:
return "v1 directory fetch";
case DIR_PURPOSE_FETCH_RENDDESC:
return "hidden-service descriptor fetch";
case DIR_PURPOSE_UPLOAD_DIR:
@ -162,8 +158,6 @@ dir_conn_purpose_to_string(int purpose)
return "server vote upload";
case DIR_PURPOSE_UPLOAD_SIGNATURES:
return "consensus signature upload";
case DIR_PURPOSE_FETCH_RUNNING_LIST:
return "running-routers fetch";
case DIR_PURPOSE_FETCH_NETWORKSTATUS:
return "network-status fetch";
case DIR_PURPOSE_FETCH_SERVERDESC:
@ -324,10 +318,6 @@ directory_get_from_dirserver(uint8_t dir_purpose, uint8_t router_purpose,
type = (router_purpose == ROUTER_PURPOSE_BRIDGE ? BRIDGE_AUTHORITY :
V2_AUTHORITY);
break;
case DIR_PURPOSE_FETCH_DIR:
case DIR_PURPOSE_FETCH_RUNNING_LIST:
type = V1_AUTHORITY;
break;
case DIR_PURPOSE_FETCH_RENDDESC:
type = HIDSERV_AUTHORITY;
break;
@ -559,13 +549,7 @@ connection_dir_request_failed(dir_connection_t *conn)
}
if (entry_list_can_grow(get_options()))
router_set_status(conn->identity_digest, 0); /* don't try him again */
if (conn->_base.purpose == DIR_PURPOSE_FETCH_DIR ||
conn->_base.purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
log_info(LD_DIR, "Giving up on directory server at '%s:%d'; retrying",
conn->_base.address, conn->_base.port);
directory_get_from_dirserver(conn->_base.purpose, conn->router_purpose,
NULL, 0 /* don't retry_if_no_servers */);
} else if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
log_info(LD_DIR, "Giving up on directory server at '%s'; retrying",
conn->_base.address);
connection_dir_download_networkstatus_failed(conn, -1);
@ -981,18 +965,6 @@ directory_send_command(dir_connection_t *conn,
}
switch (purpose) {
case DIR_PURPOSE_FETCH_DIR:
tor_assert(!resource);
tor_assert(!payload);
httpcommand = "GET";
url = tor_strdup("/tor/dir.z");
break;
case DIR_PURPOSE_FETCH_RUNNING_LIST:
tor_assert(!resource);
tor_assert(!payload);
httpcommand = "GET";
url = tor_strdup("/tor/running-routers");
break;
case DIR_PURPOSE_FETCH_NETWORKSTATUS:
tor_assert(resource);
httpcommand = "GET";
@ -1568,44 +1540,6 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
}
}
if (conn->_base.purpose == DIR_PURPOSE_FETCH_DIR) {
/* fetch/process the directory to cache it. */
log_info(LD_DIR,"Received directory (size %d) from server '%s:%d'",
(int)body_len, conn->_base.address, conn->_base.port);
if (status_code != 200) {
log_warn(LD_DIR,"Received http status code %d (%s) from server "
"'%s:%d' while fetching directory. I'll try again soon.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
tor_free(body); tor_free(headers); tor_free(reason);
return -1;
}
if (router_parse_directory(body) < 0) {
log_notice(LD_DIR,"I failed to parse the directory I fetched from "
"'%s:%d'. Ignoring.", conn->_base.address, conn->_base.port);
}
}
if (conn->_base.purpose == DIR_PURPOSE_FETCH_RUNNING_LIST) {
/* just update our list of running routers, if this list is new info */
log_info(LD_DIR,"Received running-routers list (size %d)", (int)body_len);
if (status_code != 200) {
log_warn(LD_DIR,"Received http status code %d (%s) from server "
"'%s:%d' while fetching running-routers. I'll try again soon.",
status_code, escaped(reason), conn->_base.address,
conn->_base.port);
tor_free(body); tor_free(headers); tor_free(reason);
return -1;
}
if (router_parse_runningrouters(body)<0) {
log_warn(LD_DIR,
"Bad running-routers from server '%s:%d'. I'll try again soon.",
conn->_base.address, conn->_base.port);
tor_free(body); tor_free(headers); tor_free(reason);
return -1;
}
}
if (conn->_base.purpose == DIR_PURPOSE_FETCH_NETWORKSTATUS) {
smartlist_t *which = NULL;
networkstatus_source_t source;
@ -2264,8 +2198,6 @@ note_client_request(int purpose, int compressed, size_t bytes)
char *key;
const char *kind = NULL;
switch (purpose) {
case DIR_PURPOSE_FETCH_DIR: kind = "dl/dir"; break;
case DIR_PURPOSE_FETCH_RUNNING_LIST: kind = "dl/running-routers"; break;
case DIR_PURPOSE_FETCH_NETWORKSTATUS: kind = "dl/status"; break;
case DIR_PURPOSE_FETCH_CONSENSUS: kind = "dl/consensus"; break;
case DIR_PURPOSE_FETCH_CERTIFICATE: kind = "dl/cert"; break;
@ -2504,11 +2436,6 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
log_info(LD_DIRSERV,"Client asked for the mirrored directory, but we "
"don't have a good one yet. Sending 503 Dir not available.");
write_http_status_line(conn, 503, "Directory unavailable");
/* try to get a new one now */
if (!already_fetching_directory(DIR_PURPOSE_FETCH_DIR) &&
!should_delay_dir_fetches(options))
directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR,
ROUTER_PURPOSE_GENERAL, NULL, 1);
goto done;
}
if (d->published < if_modified_since) {
@ -2548,11 +2475,6 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
cached_dir_t *d = dirserv_get_runningrouters();
if (!d) {
write_http_status_line(conn, 503, "Directory unavailable");
/* try to get a new one now */
if (!already_fetching_directory(DIR_PURPOSE_FETCH_RUNNING_LIST) &&
!should_delay_dir_fetches(options))
directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST,
ROUTER_PURPOSE_GENERAL, NULL, 1);
goto done;
}
if (d->published < if_modified_since) {

View File

@ -822,8 +822,6 @@ signewnym_impl(time_t now)
static void
run_scheduled_events(time_t now)
{
static time_t time_to_fetch_directory = 0;
static time_t time_to_fetch_running_routers = 0;
static time_t last_rotated_x509_certificate = 0;
static time_t time_to_check_v3_certificate = 0;
static time_t time_to_check_listeners = 0;
@ -974,33 +972,6 @@ run_scheduled_events(time_t now)
time_to_dump_geoip_stats = now + DUMP_GEOIP_STATS_INTERVAL;
}
/** 2. Periodically, we consider getting a new directory, getting a
* new running-routers list, and/or force-uploading our descriptor
* (if we've passed our internal checks). */
if (time_to_fetch_directory < now) {
/* Only caches actually need to fetch v1 directories now. */
if (directory_fetches_dir_info_early(options) &&
!authdir_mode_v1(options) && any_trusted_dir_is_v1_authority() &&
!should_delay_dir_fetches(options))
directory_get_from_dirserver(DIR_PURPOSE_FETCH_DIR,
ROUTER_PURPOSE_GENERAL, NULL, 1);
/** How often do we (as a cache) fetch a new V1 directory? */
#define V1_DIR_FETCH_PERIOD (12*60*60)
time_to_fetch_directory = now + V1_DIR_FETCH_PERIOD;
}
/* Caches need to fetch running_routers; directory clients don't. */
if (time_to_fetch_running_routers < now) {
if (directory_fetches_dir_info_early(options) &&
!authdir_mode_v1(options) && any_trusted_dir_is_v1_authority() &&
!should_delay_dir_fetches(options))
directory_get_from_dirserver(DIR_PURPOSE_FETCH_RUNNING_LIST,
ROUTER_PURPOSE_GENERAL, NULL, 1);
/** How often do we (as a cache) fetch a new V1 runningrouters document? */
#define V1_RUNNINGROUTERS_FETCH_PERIOD (12*60*60)
time_to_fetch_running_routers = now + V1_RUNNINGROUTERS_FETCH_PERIOD;
}
/* Remove old information from rephist and the rend cache. */
if (time_to_clean_caches < now) {
rep_history_clean(now - options->RephistTrackTime);
@ -1010,6 +981,9 @@ run_scheduled_events(time_t now)
time_to_clean_caches = now + CLEAN_CACHES_INTERVAL;
}
/** 2. Periodically, we consider force-uploading our descriptor
* (if we've passed our internal checks). */
/** How often do we check whether part of our router info has changed in a way
* that would require an upload? */
#define CHECK_DESCRIPTOR_INTERVAL (60)

View File

@ -317,12 +317,7 @@ typedef enum {
#define CONTROL_CONN_STATE_NEEDAUTH 2
#define _CONTROL_CONN_STATE_MAX 2
#define _DIR_PURPOSE_MIN 1
/** A connection to a directory server: download a directory. */
#define DIR_PURPOSE_FETCH_DIR 1
/** A connection to a directory server: download just the list
* of running routers. */
#define DIR_PURPOSE_FETCH_RUNNING_LIST 2
#define _DIR_PURPOSE_MIN 3
/** A connection to a directory server: download a rendezvous
* descriptor. */
#define DIR_PURPOSE_FETCH_RENDDESC 3