aboutsummaryrefslogtreecommitdiff
path: root/src/or
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 /src/or
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
Diffstat (limited to 'src/or')
-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
4 files changed, 14 insertions, 6 deletions
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;
+
}
}