diff options
author | Mike Perry <mikeperry-git@torproject.org> | 2020-06-07 22:16:25 -0500 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2020-06-07 22:16:25 -0500 |
commit | 6ec01c5f728b0daddebaf8e5364ce0b34027fb5e (patch) | |
tree | fb2a409b8637a9b2f796c43390d728657411e6aa /src/feature/control/control_cmd.c | |
parent | 1d32c3114fa3ebcd4219eba6ad7bb2a57b878511 (diff) | |
download | tor-6ec01c5f728b0daddebaf8e5364ce0b34027fb5e.tar.gz tor-6ec01c5f728b0daddebaf8e5364ce0b34027fb5e.zip |
Provide a DROPTIMEOUTS command to drop CBT times
This allows us to reset CBT when we change guards in fixed-guards onionperf
instances (#33325 and children).
Diffstat (limited to 'src/feature/control/control_cmd.c')
-rw-r--r-- | src/feature/control/control_cmd.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/feature/control/control_cmd.c b/src/feature/control/control_cmd.c index d9a38011de..74d542ec6d 100644 --- a/src/feature/control/control_cmd.c +++ b/src/feature/control/control_cmd.c @@ -20,9 +20,11 @@ #include "core/or/circuitlist.h" #include "core/or/circuituse.h" #include "core/or/connection_edge.h" +#include "core/or/circuitstats.h" #include "feature/client/addressmap.h" #include "feature/client/dnsserv.h" #include "feature/client/entrynodes.h" +#include "feature/control/control_events.h" #include "feature/control/control.h" #include "feature/control/control_auth.h" #include "feature/control/control_cmd.h" @@ -1396,6 +1398,33 @@ handle_control_dropguards(control_connection_t *conn, return 0; } +static const control_cmd_syntax_t droptimeouts_syntax = { + .max_args = 0, +}; + +/** Implementation for the DROPTIMEOUTS command. */ +static int +handle_control_droptimeouts(control_connection_t *conn, + const control_cmd_args_t *args) +{ + (void) args; /* We don't take arguments. */ + + static int have_warned = 0; + if (! have_warned) { + log_warn(LD_CONTROL, "DROPTIMEOUTS is dangerous; make sure you understand " + "the risks before using it. It may be removed in a future " + "version of Tor."); + have_warned = 1; + } + + circuit_build_times_reset(get_circuit_build_times_mutable()); + send_control_done(conn); + cbt_control_event_buildtimeout_set(get_circuit_build_times(), + BUILDTIMEOUT_SET_EVENT_RESET); + + return 0; +} + static const char *hsfetch_keywords[] = { "SERVER", NULL, }; @@ -2331,6 +2360,7 @@ static const control_cmd_def_t CONTROL_COMMANDS[] = ONE_LINE(protocolinfo, 0), ONE_LINE(authchallenge, CMD_FL_WIPE), ONE_LINE(dropguards, 0), + ONE_LINE(droptimeouts, 0), ONE_LINE(hsfetch, 0), MULTLINE(hspost, 0), ONE_LINE(add_onion, CMD_FL_WIPE), |