diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-05-30 13:05:15 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-05-30 13:05:15 -0400 |
commit | 711e4b423714de93abff03c4cf740f19f4d4c630 (patch) | |
tree | 9df3ca5a9b04100f3902ae49b57d2cf7d2f278c2 /src/or/command.c | |
parent | a5a8296892441bf43553f294bcdbc54b428b621f (diff) | |
parent | 2f0c0f92f84f1d29fda234db2bba41d20d5bf952 (diff) | |
download | tor-711e4b423714de93abff03c4cf740f19f4d4c630.tar.gz tor-711e4b423714de93abff03c4cf740f19f4d4c630.zip |
Merge remote-tracking branch 'linus/bug4369'
Diffstat (limited to 'src/or/command.c')
-rw-r--r-- | src/or/command.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/or/command.c b/src/or/command.c index ca3c341037..4e56edd5db 100644 --- a/src/or/command.c +++ b/src/or/command.c @@ -160,9 +160,11 @@ command_process_cell(cell_t *cell, or_connection_t *conn) if (handshaking && cell->command != CELL_VERSIONS && cell->command != CELL_NETINFO) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, - "Received unexpected cell command %d in state %s; ignoring it.", + "Received unexpected cell command %d in state %s; closing the " + "connection.", (int)cell->command, conn_state_to_string(CONN_TYPE_OR,conn->_base.state)); + connection_mark_for_close(TO_CONN(conn)); return; } @@ -258,8 +260,15 @@ command_process_var_cell(var_cell_t *cell, or_connection_t *conn) switch (conn->_base.state) { case OR_CONN_STATE_OR_HANDSHAKING_V2: - if (cell->command != CELL_VERSIONS) + if (cell->command != CELL_VERSIONS) { + log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, + "Received a cell with command %d in state %s; " + "closing the connection.", + (int)cell->command, + conn_state_to_string(CONN_TYPE_OR,conn->_base.state)); + connection_mark_for_close(TO_CONN(conn)); return; + } break; case OR_CONN_STATE_TLS_HANDSHAKING: /* If we're using bufferevents, it's entirely possible for us to @@ -272,9 +281,10 @@ command_process_var_cell(var_cell_t *cell, or_connection_t *conn) if (! command_allowed_before_handshake(cell->command)) { log_fn(LOG_PROTOCOL_WARN, LD_PROTOCOL, "Received a cell with command %d in state %s; " - "ignoring it.", + "closing the connection.", (int)cell->command, conn_state_to_string(CONN_TYPE_OR,conn->_base.state)); + connection_mark_for_close(TO_CONN(conn)); return; } else { if (enter_v3_handshake_with_cell(cell, conn)<0) |