aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-05-31 18:18:54 -0400
committerNick Mathewson <nickm@torproject.org>2009-05-31 21:56:12 -0400
commit16bca35eab81b13d6ec69acaf25e609bf663d037 (patch)
tree6771e1563aaa20e8aadabab16e81f0ab518e9392
parent74aba2204080dbb0df5c30c712f08f52bb087449 (diff)
downloadtor-16bca35eab81b13d6ec69acaf25e609bf663d037.tar.gz
tor-16bca35eab81b13d6ec69acaf25e609bf663d037.zip
backport r19291, r19292, r19295, r19296: fix dynamic ip relay reachability
-rw-r--r--ChangeLog7
-rw-r--r--doc/TODO.0202
-rw-r--r--src/or/connection_edge.c14
-rw-r--r--src/or/directory.c3
4 files changed, 19 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 63e4f65b89..ea756f2429 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,13 @@ Changes in version 0.2.0.35 - 2009-??-??
Found by lark, and by automated fuzzing.
o Major bugfixes:
+ - Finally fix the bug where dynamic-IP relays disappear when their
+ IP address changes: directory mirrors were mistakenly telling
+ them their old address if they asked via begin_dir, so they
+ never got an accurate answer about their new address, so they
+ just vanished after a day. For belt-and-suspenders, relays that
+ don't set Address in their config now avoid using begin_dir for
+ all direct connections. Should fix bugs 827, 883, and 900.
- Fix a timing-dependent, allocator-dependent, DNS-related crash bug
that would occur on some exit nodes when DNS failures and timeouts
occurred in certain patterns. Fix for bug 957.
diff --git a/doc/TODO.020 b/doc/TODO.020
index ebdd43ceff..902cce6d74 100644
--- a/doc/TODO.020
+++ b/doc/TODO.020
@@ -3,7 +3,7 @@
description of the patch.)
Backport for 0.2.0:
- - r19291, r19292, r19295, r19296: Dir mirrors tell relays their actual
+ o r19291, r19292, r19295, r19296: Dir mirrors tell relays their actual
IP address, not just the address listed in the directory currently.
Backport for 0.2.0 once better tested:
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index d9f4787c5d..0474a469d7 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -2458,8 +2458,12 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
end_payload, 1, NULL);
return 0;
}
- if (or_circ && or_circ->p_conn && or_circ->p_conn->_base.address)
- address = tor_strdup(or_circ->p_conn->_base.address);
+ /* Make sure to get the 'real' address of the previous hop: the
+ * caller might want to know whether his IP address has changed, and
+ * we might already have corrected _base.addr[ess] for the relay's
+ * canonical IP address. */
+ if (or_circ && or_circ->p_conn)
+ address = tor_dup_addr(or_circ->p_conn->real_addr);
else
address = tor_strdup("127.0.0.1");
port = 1; /* XXXX This value is never actually used anywhere, and there
@@ -2533,8 +2537,8 @@ connection_exit_begin_conn(cell_t *cell, circuit_t *circ)
if (rh.command == RELAY_COMMAND_BEGIN_DIR) {
tor_assert(or_circ);
- if (or_circ->p_conn && or_circ->p_conn->_base.addr)
- n_stream->_base.addr = or_circ->p_conn->_base.addr;
+ if (or_circ->p_conn && &or_circ->p_conn->real_addr)
+ n_stream->_base.addr = or_circ->p_conn->real_addr;
return connection_exit_connect_dir(n_stream);
}
@@ -2718,7 +2722,7 @@ connection_exit_connect_dir(edge_connection_t *exitconn)
dirconn->_base.addr = exitconn->_base.addr;
dirconn->_base.port = 0;
- dirconn->_base.address = tor_strdup(circ->p_conn->_base.address);
+ dirconn->_base.address = tor_strdup(exitconn->_base.address);
dirconn->_base.type = CONN_TYPE_DIR;
dirconn->_base.purpose = DIR_PURPOSE_SERVER;
dirconn->_base.state = DIR_CONN_STATE_SERVER_COMMAND_WAIT;
diff --git a/src/or/directory.c b/src/or/directory.c
index 46721e7fc8..9362c210c8 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -635,7 +635,8 @@ directory_command_should_use_begindir(or_options_t *options, uint32_t addr,
return 0; /* We don't know an ORPort -- no chance. */
if (!anonymized_connection)
if (!fascist_firewall_allows_address_or(addr, or_port) ||
- directory_fetches_from_authorities(options))
+ directory_fetches_from_authorities(options) ||
+ (server_mode(options) && !options->Address))
return 0; /* We're firewalled or are acting like a relay -- also no. */
if (!options->TunnelDirConns &&
router_purpose != ROUTER_PURPOSE_BRIDGE)