diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-02-16 09:41:06 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-02-16 09:41:06 -0500 |
commit | cb92d47deca15c44dd52cad6fc326520648c632e (patch) | |
tree | 4a13531c5add07457232ad2d112e0cc17d2a7da6 /src/or/command.c | |
parent | 2b99350ca4c905db1bd4f1aecc630b4f55933e96 (diff) | |
parent | e7f631478254c38d6d8b1bea65840b4c6429e4f4 (diff) | |
download | tor-cb92d47deca15c44dd52cad6fc326520648c632e.tar.gz tor-cb92d47deca15c44dd52cad6fc326520648c632e.zip |
Merge remote-tracking branch 'dgoulet/ticket24902_029_05' into maint-0.2.9
Diffstat (limited to 'src/or/command.c')
-rw-r--r-- | src/or/command.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/or/command.c b/src/or/command.c index 8831446f0b..3f5386c5a3 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -46,6 +46,7 @@ #include "config.h" #include "control.h" #include "cpuworker.h" +#include "dos.h" #include "hibernate.h" #include "nodelist.h" #include "onion.h" @@ -247,6 +248,11 @@ command_process_create_cell(cell_t *cell, channel_t *chan) (unsigned)cell->circ_id, U64_PRINTF_ARG(chan->global_identifier), chan); + /* First thing we do, even though the cell might be invalid, is inform the + * DoS mitigation subsystem layer of this event. Validation is done by this + * function. */ + dos_cc_new_create_cell(chan); + /* We check for the conditions that would make us drop the cell before * we check for the conditions that would make us send a DESTROY back, * since those conditions would make a DESTROY nonsensical. */ @@ -284,6 +290,13 @@ command_process_create_cell(cell_t *cell, channel_t *chan) return; } + /* Check if we should apply a defense for this channel. */ + if (dos_cc_get_defense_type(chan) == DOS_CC_DEFENSE_REFUSE_CELL) { + channel_send_destroy(cell->circ_id, chan, + END_CIRC_REASON_RESOURCELIMIT); + return; + } + if (!server_mode(options) || (!public_server_mode(options) && channel_is_outgoing(chan))) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, |