aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2011-03-11 03:22:53 -0500
committerNick Mathewson <nickm@torproject.org>2011-04-26 23:54:04 -0400
commit7e2e8074d52f9ace76d98a62d67a4bf781f06c3b (patch)
treed2ee2b01dc3732dc77b9e4d3270a0007f19ac0a5 /src/or/circuituse.c
parent4906188b622872899f76cf01167cfef3e09cbffd (diff)
downloadtor-7e2e8074d52f9ace76d98a62d67a4bf781f06c3b.tar.gz
tor-7e2e8074d52f9ace76d98a62d67a4bf781f06c3b.zip
slight tweak on circuit_conforms_to_options
this function really needs to get a total rewrite (or die) For now, use #if 0 to disable it.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index cdf49e3983..7b20f7f173 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -242,33 +242,34 @@ circuit_get_best(edge_connection_t *conn, int must_be_open, uint8_t purpose,
return best ? TO_ORIGIN_CIRCUIT(best) : NULL;
}
+#if 0
/** Check whether, according to the policies in <b>options</b>, the
* circuit <b>circ</b> makes sense. */
-/* XXXX currently only checks Exclude{Exit}Nodes. It should check more. */
+/* XXXX currently only checks Exclude{Exit}Nodes; it should check more.
+ * Also, it doesn't have the right definition of an exit circuit. Also,
+ * it's never called. */
int
circuit_conforms_to_options(const origin_circuit_t *circ,
const or_options_t *options)
{
const crypt_path_t *cpath, *cpath_next = NULL;
- for (cpath = circ->cpath; cpath && cpath_next != circ->cpath;
- cpath = cpath_next) {
+ /* first check if it includes any excluded nodes */
+ for (cpath = circ->cpath; cpath_next != circ->cpath; cpath = cpath_next) {
cpath_next = cpath->next;
-
if (routerset_contains_extendinfo(options->ExcludeNodes,
cpath->extend_info))
return 0;
+ }
- if (cpath->next == circ->cpath) {
- /* This is apparently the exit node. */
+ /* then consider the final hop */
+ if (routerset_contains_extendinfo(options->ExcludeExitNodes,
+ circ->cpath->prev->extend_info))
+ return 0;
- if (routerset_contains_extendinfo(options->ExcludeExitNodes,
- cpath->extend_info))
- return 0;
- }
- }
return 1;
}
+#endif
/** Close all circuits that start at us, aren't open, and were born
* at least CircuitBuildTimeout seconds ago.