aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-11-28 11:09:37 -0500
committerRoger Dingledine <arma@torproject.org>2013-03-10 20:31:53 -0400
commite4614d30e58007be1d44613d039891b6f131f50f (patch)
treec3fb910f66e84dd5c576f8de5bf4ad6e72a02e8b /src/or/directory.c
parent301faf281391698e44eb3a8d400b477716a74fd4 (diff)
downloadtor-e4614d30e58007be1d44613d039891b6f131f50f.tar.gz
tor-e4614d30e58007be1d44613d039891b6f131f50f.zip
Add a DisableV2DirectoryInfo_ option to 404 all v2 ns requests
I have no idea whether b0rken clients will DoS the network if the v2 authorities all turn this on or not. It's experimental. See #6783 for a description of how to test it more or less safely, and please be careful!
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 6b61fc6a99..38a423cb8e 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -2805,6 +2805,19 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers,
const char *key = url + strlen("/tor/status/");
long lifetime = NETWORKSTATUS_CACHE_LIFETIME;
+ if (options->DisableV2DirectoryInfo_ && !is_v3) {
+ static ratelim_t reject_v2_ratelim = RATELIM_INIT(1800);
+ char *m;
+ write_http_status_line(conn, 404, "Not found");
+ smartlist_free(dir_fps);
+ geoip_note_ns_response(GEOIP_REJECT_NOT_FOUND);
+ if ((m = rate_limit_log(&reject_v2_ratelim, approx_time()))) {
+ log_notice(LD_DIR, "Rejected a v2 networkstatus request.%s", m);
+ tor_free(m);
+ }
+ goto done;
+ }
+
if (!is_v3) {
dirserv_get_networkstatus_v2_fingerprints(dir_fps, key);
if (!strcmpstart(key, "fp/"))