[or-cvs] r16136: Never allow a circuit to be created with the same circid as (in tor/trunk: . src/or)
nickm at seul.org
nickm at seul.org
Wed Jul 23 12:55:56 UTC 2008
Author: nickm
Date: 2008-07-23 08:55:55 -0400 (Wed, 23 Jul 2008)
New Revision: 16136
Modified:
tor/trunk/
tor/trunk/ChangeLog
tor/trunk/src/or/circuitbuild.c
tor/trunk/src/or/circuitlist.c
tor/trunk/src/or/command.c
tor/trunk/src/or/or.h
Log:
r17302 at aud-055: nickm | 2008-07-23 14:55:28 +0200
Never allow a circuit to be created with the same circid as a circuit that has been marked for close. May be a fix for bug 779. Needs testing. Backport candidate.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r17302] on 49666b30-7950-49c5-bedf-9dc8f3168102
Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog 2008-07-23 12:47:13 UTC (rev 16135)
+++ tor/trunk/ChangeLog 2008-07-23 12:55:55 UTC (rev 16136)
@@ -8,6 +8,9 @@
or RENDEZVOUS_ESTABLISHED cell. This can save a second or two
on the client side when connecting to a hidden service. Bugfix
on 0.0.6pre1. Found and fixed by Christian Wilms; resolves bug 743.
+ - Ensure that two circuits can never exist on the same connection
+ with the same circuit ID, even if one is marked for close. This
+ is conceivably a bugfix for bug 779; fixes a bug on 0.1.0.4-rc.
o Minor features:
- When relays do their initial bandwidth measurement, don't limit
Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c 2008-07-23 12:47:13 UTC (rev 16135)
+++ tor/trunk/src/or/circuitbuild.c 2008-07-23 12:55:55 UTC (rev 16136)
@@ -99,7 +99,7 @@
return 0;
}
test_circ_id |= high_bit;
- } while (circuit_get_by_circid_orconn(test_circ_id, conn));
+ } while (circuit_id_in_use_on_orconn(test_circ_id, conn));
return test_circ_id;
}
Modified: tor/trunk/src/or/circuitlist.c
===================================================================
--- tor/trunk/src/or/circuitlist.c 2008-07-23 12:47:13 UTC (rev 16135)
+++ tor/trunk/src/or/circuitlist.c 2008-07-23 12:55:55 UTC (rev 16136)
@@ -661,6 +661,14 @@
return circ;
}
+/** Return true iff the circuit ID <b>circ_id</b> is currently used by a
+ * circuit, marked or not, on <b>conn</b>. */
+int
+circuit_id_in_use_on_orconn(uint16_t circ_id, or_connection_t *conn)
+{
+ return circuit_get_by_circid_orconn_impl(circ_id, conn) != NULL;
+}
+
/** Return the circuit that a given edge connection is using. */
circuit_t *
circuit_get_by_edge_conn(edge_connection_t *conn)
Modified: tor/trunk/src/or/command.c
===================================================================
--- tor/trunk/src/or/command.c 2008-07-23 12:47:13 UTC (rev 16135)
+++ tor/trunk/src/or/command.c 2008-07-23 12:55:55 UTC (rev 16136)
@@ -252,7 +252,7 @@
return;
}
- if (circuit_get_by_circid_orconn(cell->circ_id, conn)) {
+ if (circuit_id_in_use_on_orconn(cell->circ_id, conn)) {
routerinfo_t *router = router_get_by_digest(conn->identity_digest);
log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL,
"Received CREATE cell (circID %d) for known circ. "
Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h 2008-07-23 12:47:13 UTC (rev 16135)
+++ tor/trunk/src/or/or.h 2008-07-23 12:55:55 UTC (rev 16136)
@@ -2623,6 +2623,7 @@
or_circuit_t *or_circuit_new(uint16_t p_circ_id, or_connection_t *p_conn);
circuit_t *circuit_get_by_circid_orconn(uint16_t circ_id,
or_connection_t *conn);
+int circuit_id_in_use_on_orconn(uint16_t circ_id, or_connection_t *conn);
circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn);
void circuit_unlink_all_from_or_conn(or_connection_t *conn, int reason);
origin_circuit_t *circuit_get_by_global_id(uint32_t id);
More information about the tor-commits
mailing list