diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-03-13 14:54:01 +0200 |
---|---|---|
committer | teor <teor@torproject.org> | 2019-03-21 10:29:04 +1000 |
commit | bc64fb4e33ff98ca7271ee369fef24b3cf693574 (patch) | |
tree | 3df58c3f67eaff215f5dcfe0f7207a8a8467c656 /src/core | |
parent | fe78ba855a50c1f83e449d63d32e754bc988595a (diff) | |
download | tor-bc64fb4e33ff98ca7271ee369fef24b3cf693574.tar.gz tor-bc64fb4e33ff98ca7271ee369fef24b3cf693574.zip |
circpad: Don't pad if Tor is in dormant mode.
This is something we should think about harder, but we probably want dormant
mode to be more powerful than padding in case a client has been inactive for a
day or so. After all, there are probably no circuits open at this point and
dormant mode will not allow the client to open more circuits.
Furthermore, padding should not block dormant mode from being activated, since
dormant mode relies on SocksPort activity, and circuit padding does not mess
with that.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/or/circuitpadding.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/or/circuitpadding.c b/src/core/or/circuitpadding.c index 2895d49e18..599d88f493 100644 --- a/src/core/or/circuitpadding.c +++ b/src/core/or/circuitpadding.c @@ -48,6 +48,7 @@ #include "core/or/circuitpadding.h" #include "core/or/circuitlist.h" #include "core/or/circuituse.h" +#include "core/mainloop/netstatus.h" #include "core/or/relay.h" #include "feature/stats/rephist.h" #include "feature/nodelist/networkstatus.h" @@ -965,7 +966,7 @@ circpad_send_padding_cell_for_callback(circpad_machine_state_t *mi) mi->padding_scheduled_at_usec = 0; circpad_statenum_t state = mi->current_state; - // Make sure circuit didn't close on us + /* Make sure circuit didn't close on us */ if (mi->on_circ->marked_for_close) { log_fn(LOG_INFO,LD_CIRC, "Padding callback on a circuit marked for close. Ignoring."); @@ -1157,6 +1158,12 @@ circpad_machine_schedule_padding,(circpad_machine_state_t *mi)) struct timeval timeout; tor_assert(mi); + /* Don't schedule padding if we are currently in dormant mode. */ + if (!is_participating_on_network()) { + log_info(LD_CIRC, "Not scheduling padding because we are dormant."); + return CIRCPAD_STATE_UNCHANGED; + } + // Don't pad in end (but also don't cancel any previously // scheduled padding either). if (mi->current_state == CIRCPAD_STATE_END) { |