summaryrefslogtreecommitdiff
path: root/src/or/command.c
diff options
context:
space:
mode:
authorMike Perry <mikeperry-git@torproject.org>2016-09-06 11:35:53 -0700
committerNick Mathewson <nickm@torproject.org>2017-05-08 13:49:21 -0400
commitb0e92634d85a3bf7612a6ce0339b96e4aad1e0bb (patch)
tree43a2d03fb5c35e203b5d284882c05c1d273dd887 /src/or/command.c
parent515e1f663ad4a5f1023ef2d2bbcb2de0152d0a47 (diff)
downloadtor-b0e92634d85a3bf7612a6ce0339b96e4aad1e0bb.tar.gz
tor-b0e92634d85a3bf7612a6ce0339b96e4aad1e0bb.zip
Netflow record collapsing defense.
This defense will cause Cisco, Juniper, Fortinet, and other routers operating in the default configuration to collapse netflow records that would normally be split due to the 15 second flow idle timeout. Collapsing these records should greatly reduce the utility of default netflow data for correlation attacks, since all client-side records should become 30 minute chunks of total bytes sent/received, rather than creating multiple separate records for every webpage load/ssh command interaction/XMPP chat/whatever else happens to be inactive for more than 15 seconds. The defense adds consensus parameters to govern the range of timeout values for sending padding packets, as well as for keeping connections open. The defense only sends padding when connections are otherwise inactive, and it does not pad connections used solely for directory traffic at all. By default it also doesn't pad inter-relay connections. Statistics on the total padding in the last 24 hours are exported to the extra-info descriptors.
Diffstat (limited to 'src/or/command.c')
-rw-r--r--src/or/command.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/or/command.c b/src/or/command.c
index 5866c386e4..cebb5bfc7a 100644
--- a/src/or/command.c
+++ b/src/or/command.c
@@ -328,8 +328,16 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
if (create_cell->handshake_type != ONION_HANDSHAKE_TYPE_FAST) {
/* hand it off to the cpuworkers, and then return. */
- if (connection_or_digest_is_known_relay(chan->identity_digest))
+ if (connection_or_digest_is_known_relay(chan->identity_digest)) {
rep_hist_note_circuit_handshake_requested(create_cell->handshake_type);
+ // Needed for chutney: Sometimes relays aren't in the consensus yet, and
+ // get marked as clients. This resets their channels once they appear.
+ // Probably useful for normal operation wrt relay flapping, too.
+ chan->is_client = 0;
+ } else {
+ channel_mark_client(chan);
+ }
+
if (assign_onionskin_to_cpuworker(circ, create_cell) < 0) {
log_debug(LD_GENERAL,"Failed to hand off onionskin. Closing.");
circuit_mark_for_close(TO_CIRCUIT(circ), END_CIRC_REASON_RESOURCELIMIT);
@@ -344,9 +352,15 @@ command_process_create_cell(cell_t *cell, channel_t *chan)
int len;
created_cell_t created_cell;
- /* Make sure we never try to use the OR connection on which we
- * received this cell to satisfy an EXTEND request, */
- channel_mark_client(chan);
+ /* If this is a create_fast, this might be a client. Let's check. */
+ if (connection_or_digest_is_known_relay(chan->identity_digest)) {
+ // Needed for chutney: Sometimes relays aren't in the consensus yet, and
+ // get marked as clients. This resets their channels once they appear.
+ // Probably useful for normal operation wrt relay flapping, too.
+ chan->is_client = 0;
+ } else {
+ channel_mark_client(chan);
+ }
memset(&created_cell, 0, sizeof(created_cell));
len = onion_skin_server_handshake(ONION_HANDSHAKE_TYPE_FAST,