aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/relay.c
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2019-07-23 13:17:37 +0300
committerGeorge Kadianakis <desnacked@riseup.net>2019-08-05 18:03:23 +0300
commitce477da8a7969964810fb16502073d5f34e58692 (patch)
tree8c285de46394cecc6ab88b099c70cc2848a9b5d0 /src/core/or/relay.c
parent7a032c5e4838651b62b99938d56e94b4a6fc6197 (diff)
downloadtor-ce477da8a7969964810fb16502073d5f34e58692.tar.gz
tor-ce477da8a7969964810fb16502073d5f34e58692.zip
Ignore regular cells in padding circuits.
Padding circuits were regular cells that got closed before their padding machine could finish. This means that they can still receive regular cells from their past life, but they have no way or reason to answer them anymore. Hence let's ignore them before they even get to the proper subsystems.
Diffstat (limited to 'src/core/or/relay.c')
-rw-r--r--src/core/or/relay.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/core/or/relay.c b/src/core/or/relay.c
index 84fc587871..3b5aa2b665 100644
--- a/src/core/or/relay.c
+++ b/src/core/or/relay.c
@@ -1596,28 +1596,15 @@ handle_relay_command(cell_t *cell, circuit_t *circ,
tor_assert(rh);
- switch (rh->command) {
- case RELAY_COMMAND_DROP:
- /* Already examined in circpad_deliver_recognized_relay_cell_events */
- return 0;
- case RELAY_COMMAND_PADDING_NEGOTIATE:
- circpad_handle_padding_negotiate(circ, cell);
- return 0;
- case RELAY_COMMAND_PADDING_NEGOTIATED:
- if (circpad_handle_padding_negotiated(circ, cell, layer_hint) == 0)
- circuit_read_valid_data(TO_ORIGIN_CIRCUIT(circ), rh->length);
- return 0;
- }
-
- /* If this is a padding circuit we don't need to parse any other commands
- * than the padding ones. Just drop them to the floor. */
- if (circ->purpose == CIRCUIT_PURPOSE_C_CIRCUIT_PADDING) {
- log_info(domain, "Ignored cell (%d) that arrived in padding circuit.",
- rh.command);
+ /* First pass the cell to the circuit padding subsystem, in case it's a
+ * padding cell or circuit that should be handled there. */
+ if (circpad_check_received_cell(cell, circ, layer_hint, rh) == 0) {
+ log_debug(domain, "Cell handled as circuit padding");
return 0;
}
- switch (rh.command) {
+ /* Now handle all the other commands */
+ switch (rh->command) {
case RELAY_COMMAND_BEGIN:
case RELAY_COMMAND_BEGIN_DIR:
if (layer_hint &&