aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-28 14:14:45 -0400
committerNick Mathewson <nickm@torproject.org>2011-04-26 23:54:15 -0400
commitca74badbe95be77bd990c9c4f9c1b26052d4159e (patch)
tree8f7d9e60fc9e286a7ea613d0ee7a1dde3e8069a6
parentaffdec8d044513fb87a6dd8931be49974326e8e7 (diff)
downloadtor-ca74badbe95be77bd990c9c4f9c1b26052d4159e.tar
tor-ca74badbe95be77bd990c9c4f9c1b26052d4159e.tar.gz
If we're excluded, and StrictNodes is set, do not do self-tests.
-rw-r--r--src/or/router.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 6993e1eb0..64cb079bd 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -850,14 +850,33 @@ consider_testing_reachability(int test_or, int test_dir)
routerinfo_t *me = router_get_my_routerinfo();
int orport_reachable = check_whether_orport_reachable();
tor_addr_t addr;
+ or_options_t *options = get_options();
if (!me)
return;
+ if (routerset_contains_router(options->ExcludeNodes, me) &&
+ options->StrictNodes) {
+ /* If we've excluded ourself, and StrictNodes is set, we can't test
+ * ourself. */
+ if (test_or || test_dir) {
+#define SELF_EXCLUDED_WARN_INTERVAL 3600
+ static ratelim_t warning_limit=RATELIM_INIT(SELF_EXCLUDED_WARN_INTERVAL);
+ char *msg;
+ if ((msg = rate_limit_log(&warning_limit, approx_time()))) {
+ log_warn(LD_CIRC, "Can't peform self-tests for this relay: we have "
+ "listed ourself in ExcludeNodes, and StrictNodes is set. "
+ "We will cannot learn whether we are usable, and will not "
+ "be able to advertise ourself.%s", msg);
+ tor_free(msg);
+ }
+ }
+ return;
+ }
+
if (test_or && (!orport_reachable || !circuit_enough_testing_circs())) {
log_info(LD_CIRC, "Testing %s of my ORPort: %s:%d.",
!orport_reachable ? "reachability" : "bandwidth",
me->address, me->or_port);
- /* XXX022-1090 If we ExcludeNodes ourself, should this fail? -RD */
circuit_launch_by_router(CIRCUIT_PURPOSE_TESTING, me,
CIRCLAUNCH_NEED_CAPACITY|CIRCLAUNCH_IS_INTERNAL);
}
@@ -868,7 +887,6 @@ consider_testing_reachability(int test_or, int test_dir)
CONN_TYPE_DIR, &addr, me->dir_port,
DIR_PURPOSE_FETCH_SERVERDESC)) {
/* ask myself, via tor, for my server descriptor. */
- /* XXX022-1090 If we ExcludeNodes ourself, should this fail? -RD */
directory_initiate_command(me->address, &addr,
me->or_port, me->dir_port,
0, /* does not matter */