summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-10-11 22:06:01 +0000
committerNick Mathewson <nickm@torproject.org>2006-10-11 22:06:01 +0000
commiteca28f24f51a3b7e59a22002d8119db8a98c781a (patch)
treeb35c2427cc76b50c021863d94f7d481cb9d4d0db
parent7f3fc70945e8f3286c9701c168fa364003949b3e (diff)
downloadtor-eca28f24f51a3b7e59a22002d8119db8a98c781a.tar.gz
tor-eca28f24f51a3b7e59a22002d8119db8a98c781a.zip
r9004@totoro: nickm | 2006-10-11 18:05:24 -0400
Add client support for a 'BadExit' flag, so authorities can say "Server X is a poor choise for your nytimes.com connections, as it seems to direct them to HoorayForMao.com or (more likely) WouldYouLikeToBuyTheseFineEncyclopedias.com" svn:r8690
-rw-r--r--ChangeLog4
-rw-r--r--doc/TODO4
-rw-r--r--doc/dir-spec.txt3
-rw-r--r--doc/path-spec.txt3
-rw-r--r--src/or/circuitbuild.c7
-rw-r--r--src/or/or.h4
-rw-r--r--src/or/routerlist.c6
-rw-r--r--src/or/routerparse.c3
8 files changed, 28 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 464248488b..087f81e27a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
Changes in version 0.1.2.3-alpha - 2006-10-??
+ o Minor features:
+ - If most authorities set a (newly defined) BadExit flag for a server, do
+ not consider it as a general-purpose exit.
+
o Minor features, controller:
- Add a REASON field to CIRC events; for backward compatibility, this
field is sent only to controllers that have enabled the extended
diff --git a/doc/TODO b/doc/TODO
index d5005aec90..6d8b09ec33 100644
--- a/doc/TODO
+++ b/doc/TODO
@@ -363,6 +363,10 @@ Minor items for 0.1.2.x as time permits:
Future version:
- Configuration format really wants sections.
- Good RBL substitute.
+ - Authorities should try using exits for http to connect to some URLS
+ (specified in a configuration file, so as not to make the List Of Things
+ Not To Censor completely obvious) and ask them for results. Exits that
+ don't give good answers should have the BadExit flag set.
- Our current approach to block attempts to use Tor as a single-hop proxy
is pretty lame; we should get a better one.
. Update the hidden service stuff for the new dir approach.
diff --git a/doc/dir-spec.txt b/doc/dir-spec.txt
index 5d47131944..a4793fa44c 100644
--- a/doc/dir-spec.txt
+++ b/doc/dir-spec.txt
@@ -355,6 +355,9 @@ $Id$
- A directory port (or "0" for none")
"s" -- A series of whitespace-separated status flags, in any order:
"Authority" if the router is a directory authority.
+ "BadExit" if the router is believed to be useless as an exit node
+ (because its ISP censors it, because it is behind a restrictive
+ proxy, or for some similar reason).
"Exit" if the router is useful for building general-purpose exit
circuits.
"Fast" if the router is suitable for high-bandwidth circuits.
diff --git a/doc/path-spec.txt b/doc/path-spec.txt
index 7a2277620c..aeaf1bba9f 100644
--- a/doc/path-spec.txt
+++ b/doc/path-spec.txt
@@ -208,6 +208,9 @@ of their choices.
such a connection if any clause that accepts any connections to that port
precedes all clauses (if any) that reject all connections to that port.
+ Unless requested to do so by the user, we never choose a server flagged by
+ more than half of the authorities as BadExit for an exit server.
+
2.2.2. User configuration
Users can alter the default behavior for path selection with configuration
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 878c20f254..8d76e6a341 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1165,12 +1165,9 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
*/
continue;
}
- if (!router->is_running) {
+ if (!router->is_running || router->is_bad_exit) {
n_supported[i] = -1;
-// log_fn(LOG_DEBUG,
-// "Skipping node %s (index %d) -- directory says it's not running.",
-// router->nickname, i);
- continue; /* skip routers that are known to be down */
+ continue; /* skip routers that are known to be down or bad exits */
}
if (router_is_unreliable(router, need_uptime, need_capacity, 0)) {
n_supported[i] = -1;
diff --git a/src/or/or.h b/src/or/or.h
index d3304cd698..763ce2dbee 100644
--- a/src/or/or.h
+++ b/src/or/or.h
@@ -925,6 +925,8 @@ typedef struct {
unsigned int is_stable:1; /** Do we think this is a stable OR? */
unsigned int is_possible_guard:1; /**< Do we think this is an OK guard? */
unsigned int is_exit:1; /**< Do we think this is an OK exit? */
+ unsigned int is_bad_exit:1; /**< Do we think this exit is censored, borked,
+ * or otherwise nasty? */
/** Tor can use this desc for circuit-building. */
#define ROUTER_PURPOSE_GENERAL 0
@@ -972,6 +974,8 @@ typedef struct routerstatus_t {
* directories.) */
unsigned int is_possible_guard:1; /**< True iff this router would be a good
* choice as an entry guard. */
+ unsigned int is_bad_exit:1; /**< True iff this node is a bad choice for
+ * an exit node. */
/** True if we, as a directory mirror, want to download the corresponding
* routerinfo from the authority who gave us this routerstatus. (That is,
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index f8a22a1926..226b6d52f7 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -3294,7 +3294,7 @@ routerstatus_list_update_from_networkstatus(time_t now)
*/
while (1) {
int n_running=0, n_named=0, n_valid=0, n_listing=0;
- int n_v2_dir=0, n_fast=0, n_stable=0, n_exit=0, n_guard=0;
+ int n_v2_dir=0, n_fast=0, n_stable=0, n_exit=0, n_guard=0, n_bad_exit=0;
int n_desc_digests=0, highest_count=0;
const char *the_name = NULL;
local_routerstatus_t *rs_out, *rs_old;
@@ -3380,6 +3380,8 @@ routerstatus_list_update_from_networkstatus(time_t now)
++n_stable;
if (rs->is_v2_dir)
++n_v2_dir;
+ if (rs->is_bad_exit)
+ ++n_bad_exit;
}
/* Go over the descriptor digests and figure out which descriptor we
* want. */
@@ -3428,6 +3430,7 @@ routerstatus_list_update_from_networkstatus(time_t now)
rs_out->status.is_possible_guard = n_guard > n_statuses/2;
rs_out->status.is_stable = n_stable > n_statuses/2;
rs_out->status.is_v2_dir = n_v2_dir > n_statuses/2;
+ rs_out->status.is_bad_exit = n_bad_exit > n_statuses/2;
}
SMARTLIST_FOREACH(routerstatus_list, local_routerstatus_t *, rs,
local_routerstatus_free(rs));
@@ -3482,6 +3485,7 @@ routers_update_status_from_networkstatus(smartlist_t *routers,
router->is_stable = rs->status.is_stable;
router->is_possible_guard = rs->status.is_possible_guard;
router->is_exit = rs->status.is_exit;
+ router->is_bad_exit = rs->status.is_bad_exit;
}
if (router->is_running && ds) {
ds->n_networkstatus_failures = 0;
diff --git a/src/or/routerparse.c b/src/or/routerparse.c
index 060f3b7839..fce16d40ad 100644
--- a/src/or/routerparse.c
+++ b/src/or/routerparse.c
@@ -1061,6 +1061,9 @@ routerstatus_parse_entry_from_string(const char **s, smartlist_t *tokens)
rs->is_v2_dir = 1;
else if (!strcmp(tok->args[i], "Guard"))
rs->is_possible_guard = 1;
+ else if (!strcmp(tok->args[i], "BadExit"))
+ rs->is_bad_exit = 1;
+
}
}