mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Resolve a FIXME: use identity comparison, not nickname comparison, to
choose circuit ID types. This is important because our view of "the nickname of the router on the other side of this connection" is skewed, and depends on whether we think the other rotuer is verified--and there's no way to know whether another router thinks you are verified. For backward compatibility, we notice when the other router chooses the same circuit ID type as us (because it's running an old version), and switch our type to be polite. svn:r2797
This commit is contained in:
@@ -139,6 +139,22 @@ static void command_process_create_cell(cell_t *cell, connection_t *conn) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* If the high bit of the circuit ID is not as expected, then switch
|
||||
* which half of the space we'll use for our own CREATE cells.
|
||||
*
|
||||
* This can happen because Tor 0.0.9pre5 and earlier decide which
|
||||
* half to use based on nickname, and we now use identity keys.
|
||||
*/
|
||||
if ((cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_HIGHER) {
|
||||
log_fn(LOG_INFO, "Got a high circuit ID from %s (%d); switching to low circuit IDs.",
|
||||
conn->nickname, conn->s);
|
||||
conn->circ_id_type = CIRC_ID_TYPE_LOWER;
|
||||
} else if (!(cell->circ_id & (1<<15)) && conn->circ_id_type == CIRC_ID_TYPE_LOWER) {
|
||||
log_fn(LOG_INFO, "Got a low circuit ID from %s (%d); switching to high circuit IDs.",
|
||||
conn->nickname, conn->s);
|
||||
conn->circ_id_type = CIRC_ID_TYPE_HIGHER;
|
||||
}
|
||||
|
||||
circ = circuit_new(cell->circ_id, conn);
|
||||
circ->state = CIRCUIT_STATE_ONIONSKIN_PENDING;
|
||||
circ->purpose = CIRCUIT_PURPOSE_OR;
|
||||
|
||||
Reference in New Issue
Block a user