mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
Fix detach when setting circuit ID to 0 bug in circuit_set_circid_chan_helper() and add circuit_get_by_circid_channel_even_if_marked()
This commit is contained in:
parent
c097fb33fc
commit
b28119e6a8
@ -135,7 +135,7 @@ circuit_set_circid_chan_helper(circuit_t *circ, int direction,
|
|||||||
* attached), detach the circuit. ID changes require this because
|
* attached), detach the circuit. ID changes require this because
|
||||||
* circuitmux hashes on (channel_id, circuit_id).
|
* circuitmux hashes on (channel_id, circuit_id).
|
||||||
*/
|
*/
|
||||||
if (id != 0 && (old_chan != chan || old_id != id) &&
|
if (old_id != 0 && (old_chan != chan || old_id != id) &&
|
||||||
!(circ->marked_for_close)) {
|
!(circ->marked_for_close)) {
|
||||||
tor_assert(old_chan->cmux);
|
tor_assert(old_chan->cmux);
|
||||||
circuitmux_detach_circuit(old_chan->cmux, circ);
|
circuitmux_detach_circuit(old_chan->cmux, circ);
|
||||||
@ -986,6 +986,18 @@ circuit_get_by_circid_channel(circid_t circ_id, channel_t *chan)
|
|||||||
return circ;
|
return circ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Return a circ such that:
|
||||||
|
* - circ-\>n_circ_id or circ-\>p_circ_id is equal to <b>circ_id</b>, and
|
||||||
|
* - circ is attached to <b>chan</b>, either as p_chan or n_chan.
|
||||||
|
* Return NULL if no such circuit exists.
|
||||||
|
*/
|
||||||
|
circuit_t *
|
||||||
|
circuit_get_by_circid_channel_even_if_marked(circid_t circ_id,
|
||||||
|
channel_t *chan)
|
||||||
|
{
|
||||||
|
return circuit_get_by_circid_channel_impl(circ_id, chan);
|
||||||
|
}
|
||||||
|
|
||||||
/** Return true iff the circuit ID <b>circ_id</b> is currently used by a
|
/** Return true iff the circuit ID <b>circ_id</b> is currently used by a
|
||||||
* circuit, marked or not, on <b>chan</b>. */
|
* circuit, marked or not, on <b>chan</b>. */
|
||||||
int
|
int
|
||||||
|
@ -30,6 +30,9 @@ origin_circuit_t *origin_circuit_new(void);
|
|||||||
or_circuit_t *or_circuit_new(circid_t p_circ_id, channel_t *p_chan);
|
or_circuit_t *or_circuit_new(circid_t p_circ_id, channel_t *p_chan);
|
||||||
circuit_t *circuit_get_by_circid_channel(circid_t circ_id,
|
circuit_t *circuit_get_by_circid_channel(circid_t circ_id,
|
||||||
channel_t *chan);
|
channel_t *chan);
|
||||||
|
circuit_t *
|
||||||
|
circuit_get_by_circid_channel_even_if_marked(circid_t circ_id,
|
||||||
|
channel_t *chan);
|
||||||
int circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan);
|
int circuit_id_in_use_on_channel(circid_t circ_id, channel_t *chan);
|
||||||
circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn);
|
circuit_t *circuit_get_by_edge_conn(edge_connection_t *conn);
|
||||||
void circuit_unlink_all_from_channel(channel_t *chan, int reason);
|
void circuit_unlink_all_from_channel(channel_t *chan, int reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user