mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Ticket #25573: Count TRUNCATED cells.
TRUNCATED cells were ignored while in path bias. Now they are obeyed, and cause us to tear down the circuit. The actual impact is minimal, since we would just wait around for a probe that would never arrive before. This commit changes client behavior.
This commit is contained in:
@@ -115,6 +115,16 @@ mock_connection_mark_unattached_ap_(entry_connection_t *conn, int endreason,
|
||||
conn->edge_.end_reason = endreason;
|
||||
}
|
||||
|
||||
static void
|
||||
mock_mark_circ_for_close(circuit_t *circ, int reason, int line,
|
||||
const char *file)
|
||||
{
|
||||
(void)reason; (void)line; (void)file;
|
||||
|
||||
circ->marked_for_close = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
mock_mark_for_close(connection_t *conn,
|
||||
int line, const char *file)
|
||||
@@ -694,6 +704,7 @@ test_circbw_relay(void *arg)
|
||||
MOCK(connection_start_reading, mock_start_reading);
|
||||
MOCK(connection_mark_for_close_internal_, mock_mark_for_close);
|
||||
MOCK(relay_send_command_from_edge_, mock_send_command);
|
||||
MOCK(circuit_mark_for_close_, mock_mark_circ_for_close);
|
||||
|
||||
circ = helper_create_origin_circuit(CIRCUIT_PURPOSE_C_GENERAL, 0);
|
||||
circ->cpath->state = CPATH_STATE_AWAITING_KEYS;
|
||||
@@ -856,11 +867,18 @@ test_circbw_relay(void *arg)
|
||||
if (!subtest_circbw_halfclosed(circ, 6))
|
||||
goto done;
|
||||
|
||||
/* Path bias: truncated */
|
||||
tt_int_op(circ->base_.marked_for_close, OP_EQ, 0);
|
||||
PACK_CELL(0, RELAY_COMMAND_TRUNCATED, "Data1234");
|
||||
pathbias_count_valid_cells(circ, &cell);
|
||||
tt_int_op(circ->base_.marked_for_close, OP_EQ, 1);
|
||||
|
||||
done:
|
||||
UNMOCK(connection_start_reading);
|
||||
UNMOCK(connection_mark_unattached_ap_);
|
||||
UNMOCK(connection_mark_for_close_internal_);
|
||||
UNMOCK(relay_send_command_from_edge_);
|
||||
UNMOCK(circuit_mark_for_close_);
|
||||
circuit_free_(TO_CIRCUIT(circ));
|
||||
connection_free_minimal(ENTRY_TO_CONN(entryconn1));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user