[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/release-0.2.2] slight tweak on circuit_conforms_to_options
commit 7e2e8074d52f9ace76d98a62d67a4bf781f06c3b
Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date: Fri Mar 11 03:22:53 2011 -0500
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.
---
src/or/circuituse.c | 23 ++++++++++++-----------
src/or/circuituse.h | 2 ++
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index cdf49e3..7b20f7f 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.
diff --git a/src/or/circuituse.h b/src/or/circuituse.h
index a121099..9f393ab 100644
--- a/src/or/circuituse.h
+++ b/src/or/circuituse.h
@@ -16,8 +16,10 @@ void circuit_expire_building(void);
void circuit_remove_handled_ports(smartlist_t *needed_ports);
int circuit_stream_is_being_handled(edge_connection_t *conn, uint16_t port,
int min);
+#if 0
int circuit_conforms_to_options(const origin_circuit_t *circ,
const or_options_t *options);
+#endif
void circuit_build_needed_circs(time_t now);
void circuit_detach_stream(circuit_t *circ, edge_connection_t *conn);
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits