[tor-commits] [tor/maint-0.2.2] revert most of ef81649d2fc
nickm at torproject.org
nickm at torproject.org
Wed Apr 27 18:02:16 UTC 2011
commit f962dda8c188ebe17be1ad7d6548f303b6425943
Author: Roger Dingledine <arma at torproject.org>
Date: Tue Apr 26 19:55:34 2011 -0400
revert most of ef81649d2fc
Now we believe it to be the case that we never build a circuit for our
stream that has an unsuitable exit, so we'll never need to use such
a circuit. The risk is that we have some code that builds the circuit,
but now we refuse to use it, meaning we just build a bazillion circuits
and ignore them all.
---
src/or/circuitbuild.c | 2 +-
src/or/circuituse.c | 18 ++++++++++++------
src/or/connection_edge.c | 19 ++-----------------
src/or/connection_edge.h | 3 +--
4 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index b963f1a..6401e71 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2728,7 +2728,7 @@ choose_good_exit_server_general(routerlist_t *dir, int need_uptime,
{
if (!ap_stream_wants_exit_attention(conn))
continue; /* Skip everything but APs in CIRCUIT_WAIT */
- if (connection_ap_can_use_exit(TO_EDGE_CONN(conn), router, 1)) {
+ if (connection_ap_can_use_exit(TO_EDGE_CONN(conn), router)) {
++n_supported[i];
// log_fn(LOG_DEBUG,"%s is supported. n_supported[%d] now %d.",
// router->nickname, i, n_supported[i]);
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index 530941c..cc4a739 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -127,7 +127,7 @@ circuit_is_acceptable(circuit_t *circ, edge_connection_t *conn,
return 0;
}
}
- if (exitrouter && !connection_ap_can_use_exit(conn, exitrouter, 0)) {
+ if (exitrouter && !connection_ap_can_use_exit(conn, exitrouter)) {
/* can't exit from this router */
return 0;
}
@@ -166,6 +166,10 @@ circuit_is_better(circuit_t *a, circuit_t *b, uint8_t purpose)
return 1;
if (CIRCUIT_IS_ORIGIN(b) &&
TO_ORIGIN_CIRCUIT(b)->build_state->is_internal)
+ /* XXX023 what the heck is this internal thing doing here. I
+ * think we can get rid of it. circuit_is_acceptable() already
+ * makes sure that is_internal is exactly what we need it to
+ * be. -RD */
return 1;
}
break;
@@ -511,7 +515,7 @@ circuit_stream_is_being_handled(edge_connection_t *conn,
if (exitrouter && (!need_uptime || build_state->need_uptime)) {
int ok;
if (conn) {
- ok = connection_ap_can_use_exit(conn, exitrouter, 0);
+ ok = connection_ap_can_use_exit(conn, exitrouter);
} else {
addr_policy_result_t r = compare_addr_to_addr_policy(
0, port, exitrouter->exit_policy);
@@ -1291,9 +1295,10 @@ circuit_get_open_circ_or_launch(edge_connection_t *conn,
* refactor into a single function? */
routerinfo_t *router = router_get_by_nickname(conn->chosen_exit_name, 1);
int opt = conn->chosen_exit_optional;
- if (router && !connection_ap_can_use_exit(conn, router, 0)) {
+ if (router && !connection_ap_can_use_exit(conn, router)) {
log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP,
- "Requested exit point '%s' would refuse request. %s.",
+ "Requested exit point '%s' is excluded or "
+ "would refuse request. %s.",
conn->chosen_exit_name, opt ? "Trying others" : "Closing");
if (opt) {
conn->chosen_exit_optional = 0;
@@ -1611,9 +1616,10 @@ connection_ap_handshake_attach_circuit(edge_connection_t *conn)
}
return -1;
}
- if (router && !connection_ap_can_use_exit(conn, router, 0)) {
+ if (router && !connection_ap_can_use_exit(conn, router)) {
log_fn(opt ? LOG_INFO : LOG_WARN, LD_APP,
- "Requested exit point '%s' would refuse request. %s.",
+ "Requested exit point '%s' is excluded or "
+ "would refuse request. %s.",
conn->chosen_exit_name, opt ? "Trying others" : "Closing");
if (opt) {
conn->chosen_exit_optional = 0;
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 1ee57ab..082cd5f 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -3044,15 +3044,9 @@ connection_edge_is_rendezvous_stream(edge_connection_t *conn)
* to exit from it, or 0 if it probably will not allow it.
* (We might be uncertain if conn's destination address has not yet been
* resolved.)
- *
- * If <b>excluded_means_no</b> is 1 and Exclude*Nodes is set and excludes
- * this relay, return 0.
- * XXX022-1090 This StrictNodes business needs more work, a la bug 1090. See
- * also git commit ef81649d.
*/
int
-connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
- int excluded_means_no)
+connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit)
{
or_options_t *options = get_options();
@@ -3102,17 +3096,8 @@ connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
return 0;
}
if (options->_ExcludeExitNodesUnion &&
- (options->StrictNodes || excluded_means_no) &&
routerset_contains_router(options->_ExcludeExitNodesUnion, exit)) {
- /* If we are trying to avoid this node as exit, and we have StrictNodes
- * set, then this is not a suitable exit. Refuse it.
- *
- * If we don't have StrictNodes set, then this function gets called in
- * two contexts. First, we've got a circuit open and we want to know
- * whether we can use it. In that case, we somehow built this circuit
- * despite having the last hop in ExcludeExitNodes, so we should be
- * willing to use it. Second, we are evaluating whether this is an
- * acceptable exit for a new circuit. In that case, skip it. */
+ /* Not a suitable exit. Refuse it. */
return 0;
}
diff --git a/src/or/connection_edge.h b/src/or/connection_edge.h
index c4ae467..70d0dd2 100644
--- a/src/or/connection_edge.h
+++ b/src/or/connection_edge.h
@@ -47,8 +47,7 @@ int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
void connection_exit_connect(edge_connection_t *conn);
int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
-int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
- int excluded_means_no);
+int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit);
void connection_ap_expire_beginning(void);
void connection_ap_attach_pending(void);
void connection_ap_fail_onehop(const char *failed_digest,
More information about the tor-commits
mailing list