aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.h
Commit message (Collapse)AuthorAge
* Unit tests for connection_edge_process_resolved_cellNick Mathewson2014-04-02
| | | | Also rename a function to be more accurate (resolve->resolved)
* Look at all of a RESOLVED cell; not just the first answer.Nick Mathewson2014-04-02
| | | | | | | | Also, stop accepting the old kind of RESOLVED cells with no TTL fields; they haven't been sent since 0.1.1.6-alpha. This patch won't work without the fix to #10468 -- it will break DNSPorts unless they set the proper ipv4/6 flags on entry_connection_t.
* Test code for implementation of faster circuit_unlink_all_from_channelNick Mathewson2014-03-14
| | | | | | | | This contains the obvious implementation using the circuitmux data structure. It also runs the old (slow) algorithm and compares the results of the two to make sure that they're the same. Needs review and testing.
* Refactor OOM-handling functions for more testabilityNick Mathewson2014-02-12
| | | | | | This patch splits out some of the functions in OOM handling so that it's easier to check them without involving the rest of Tor or requiring that the circuits be "wired up".
* Merge branch 'morestats4' into morestats5Karsten Loesing2013-10-28
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: doc/tor.1.txt src/or/config.c src/or/connection.h src/or/control.c src/or/control.h src/or/or.h src/or/relay.c src/or/relay.h src/test/test.c
| * Tweak CELL_STATS event based on comments by nickm.Karsten Loesing2013-05-25
| | | | | | | | | | | | | | | | | | | | - Move cell_command_to_string from control.c to command.c. - Use accessor for global_circuitlist instead of extern. - Add a struct for cell statistics by command instead of six arrays. - Split up control_event_circuit_cell_stats by using two helper functions. - Add TestingEnableCellStatsEvent option. - Prepare functions for testing. - Rename a few variables and document a few things better.
| * Add new CELL_STATS event.Karsten Loesing2013-05-16
| | | | | | | | Jointly authored with Rob Jansen <jansen@cs.umn.edu>.
* | Unit tests for cell queues.Nick Mathewson2013-07-18
| | | | | | | | | | This removes some INLINE markers from functions that probably didn't need them.
* | Use TOR_SIMPLEQ for packed_cell_tNick Mathewson2013-07-18
| |
* | Completely refactor how FILENAME_PRIVATE worksNick Mathewson2013-07-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We previously used FILENAME_PRIVATE identifiers mostly for identifiers exposed only to the unit tests... but also for identifiers exposed to the benchmarker, and sometimes for identifiers exposed to a similar module, and occasionally for no really good reason at all. Now, we use FILENAME_PRIVATE identifiers for identifiers shared by Tor and the unit tests. They should be defined static when we aren't building the unit test, and globally visible otherwise. (The STATIC macro will keep us honest here.) For identifiers used only by the unit tests and never by Tor at all, on the other hand, we wrap them in #ifdef TOR_UNIT_TESTS. This is not the motivating use case for the split test/non-test build system; it's just a test example to see how it works, and to take a chance to clean up the code a little.
* | Merge remote-tracking branch 'origin/maint-0.2.4'Nick Mathewson2013-06-18
|\ \
| * \ Merge remote-tracking branch 'origin/maint-0.2.3' into maint-0.2.4Nick Mathewson2013-06-18
| |\ \ | | |/ | |/| | | | | | | | | | Conflicts: src/or/config.c src/or/relay.c
| | * Implement a real OOM-killer for too-long circuit queues.Nick Mathewson2013-06-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This implements "algorithm 1" from my discussion of bug #9072: on OOM, find the circuits with the longest queues, and kill them. It's also a fix for #9063 -- without the side-effects of bug #9072. The memory bounds aren't perfect here, and you need to be sure to allow some slack for the rest of Tor's usage. This isn't a perfect fix; the rest of the solutions I describe on codeable.
* | | Merge remote-tracking branch 'public/bug7912_squashed'Nick Mathewson2013-06-13
|\ \ \ | |/ / |/| |
| * | Implementation of a fix for bug 7912Nick Mathewson2013-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | I added the code to pass a destroy cell to a queueing function rather than writing it immediately, and the code to remember that we shouldn't reuse the circuit id until the destroy is actually sent, and the code to release the circuit id once the destroy has been sent... and then I finished by hooking destroy_cell_queue into the rest of Tor.
* | | Debugging log for bug 8185Nick Mathewson2013-03-19
|/ / | | | | | | If the bug recurs, log the filename and line number that triggered it
* | Merge remote-tracking branch 'public/wide_circ_ids'Nick Mathewson2013-02-15
|\ \ | | | | | | | | | | | | | | | | | | Conflicts: src/or/channel.h src/or/connection_or.c src/or/cpuworker.c
| * | Allow a v4 link protocol for 4-byte circuit IDs.Nick Mathewson2012-11-06
| | | | | | | | | | | | | | | | | | Implements proposal 214. Needs testing.
* | | Fix numerous problems with Tor's weak RNG.Nick Mathewson2013-02-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need a weak RNG in a couple of places where the strong RNG is both needless and too slow. We had been using the weak RNG from our platform's libc implementation, but that was problematic (because many platforms have exceptionally horrible weak RNGs -- like, ones that only return values between 0 and SHORT_MAX) and because we were using it in a way that was wrong for LCG-based weak RNGs. (We were counting on the low bits of the LCG output to be as random as the high ones, which isn't true.) This patch adds a separate type for a weak RNG, adds an LCG implementation for it, and uses that exclusively where we had been using the platform weak RNG.
* | | Update the copyright date to 201.Nick Mathewson2013-01-16
| | |
* | | Get the client side of receiving an IPv6 address to workNick Mathewson2012-11-14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it so we can handle getting an IPv6 in the 3 different formats we specified it for in RESOLVED cells, END_STREAM_REASON_EXITPOLICY cells, and CONNECTED cells. We don't cache IPv6 addresses yet, since proposal 205 isn't implemented. There's a refactored function for parsing connected cells; it has unit tests.
* | | Possible fix for bug 7212Nick Mathewson2012-11-12
|/ / | | | | | | | | | | | | | | | | This is the simplest possible workaround: make it safe to call circuit_cell_queue_clear() on a non-attached circuit, and make it safe-but-a-LD_BUG-warning to call update_circuit_on_cmux() on a non-attached circuit. LocalWords: unstage src Untracked
* | Convert all include-guard macros to avoid reserved identifiers.Nick Mathewson2012-10-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In C, we technically aren't supposed to define our own things that start with an underscore. This is a purely machine-generated commit. First, I ran this script on all the headers in src/{common,or,test,tools/*}/*.h : ============================== use strict; my %macros = (); my %skipped = (); FILE: for my $fn (@ARGV) { my $f = $fn; if ($fn !~ /^\.\//) { $f = "./$fn"; } $skipped{$fn} = 0; open(F, $fn); while (<F>) { if (/^#ifndef ([A-Za-z0-9_]+)/) { $macros{$fn} = $1; next FILE; } } } print "#!/usr/bin/perl -w -i -p\n\n"; for my $fn (@ARGV) { if (! exists $macros{$fn}) { print "# No macro known for $fn!\n" if (!$skipped{$fn}); next; } if ($macros{$fn} !~ /_H_?$/) { print "# Weird macro for $fn...\n"; } my $goodmacro = uc $fn; $goodmacro =~ s#.*/##; $goodmacro =~ s#[\/\-\.]#_#g; print "s/(?<![A-Za-z0-9_])$macros{$fn}(?![A-Za-z0-9_])/TOR_${goodmacro}/g;\n" } ============================== It produced the following output, which I then re-ran on those same files: ============================== s/(?<![A-Za-z0-9_])_TOR_ADDRESS_H(?![A-Za-z0-9_])/TOR_ADDRESS_H/g; s/(?<![A-Za-z0-9_])_TOR_AES_H(?![A-Za-z0-9_])/TOR_AES_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_H(?![A-Za-z0-9_])/TOR_COMPAT_H/g; s/(?<![A-Za-z0-9_])_TOR_COMPAT_LIBEVENT_H(?![A-Za-z0-9_])/TOR_COMPAT_LIBEVENT_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTAINER_H(?![A-Za-z0-9_])/TOR_CONTAINER_H/g; s/(?<![A-Za-z0-9_])_TOR_CRYPTO_H(?![A-Za-z0-9_])/TOR_CRYPTO_H/g; s/(?<![A-Za-z0-9_])TOR_DI_OPS_H(?![A-Za-z0-9_])/TOR_DI_OPS_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMAREA_H(?![A-Za-z0-9_])/TOR_MEMAREA_H/g; s/(?<![A-Za-z0-9_])_TOR_MEMPOOL_H(?![A-Za-z0-9_])/TOR_MEMPOOL_H/g; s/(?<![A-Za-z0-9_])TOR_PROCMON_H(?![A-Za-z0-9_])/TOR_PROCMON_H/g; s/(?<![A-Za-z0-9_])_TOR_TORGZIP_H(?![A-Za-z0-9_])/TOR_TORGZIP_H/g; s/(?<![A-Za-z0-9_])_TOR_TORINT_H(?![A-Za-z0-9_])/TOR_TORINT_H/g; s/(?<![A-Za-z0-9_])_TOR_LOG_H(?![A-Za-z0-9_])/TOR_TORLOG_H/g; s/(?<![A-Za-z0-9_])_TOR_TORTLS_H(?![A-Za-z0-9_])/TOR_TORTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_UTIL_H(?![A-Za-z0-9_])/TOR_UTIL_H/g; s/(?<![A-Za-z0-9_])_TOR_BUFFERS_H(?![A-Za-z0-9_])/TOR_BUFFERS_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_H(?![A-Za-z0-9_])/TOR_CHANNEL_H/g; s/(?<![A-Za-z0-9_])_TOR_CHANNEL_TLS_H(?![A-Za-z0-9_])/TOR_CHANNELTLS_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITBUILD_H(?![A-Za-z0-9_])/TOR_CIRCUITBUILD_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITLIST_H(?![A-Za-z0-9_])/TOR_CIRCUITLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_EWMA_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_EWMA_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITMUX_H(?![A-Za-z0-9_])/TOR_CIRCUITMUX_H/g; s/(?<![A-Za-z0-9_])_TOR_CIRCUITUSE_H(?![A-Za-z0-9_])/TOR_CIRCUITUSE_H/g; s/(?<![A-Za-z0-9_])_TOR_COMMAND_H(?![A-Za-z0-9_])/TOR_COMMAND_H/g; s/(?<![A-Za-z0-9_])_TOR_CONFIG_H(?![A-Za-z0-9_])/TOR_CONFIG_H/g; s/(?<![A-Za-z0-9_])TOR_CONFPARSE_H(?![A-Za-z0-9_])/TOR_CONFPARSE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_EDGE_H(?![A-Za-z0-9_])/TOR_CONNECTION_EDGE_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_H(?![A-Za-z0-9_])/TOR_CONNECTION_H/g; s/(?<![A-Za-z0-9_])_TOR_CONNECTION_OR_H(?![A-Za-z0-9_])/TOR_CONNECTION_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_CONTROL_H(?![A-Za-z0-9_])/TOR_CONTROL_H/g; s/(?<![A-Za-z0-9_])_TOR_CPUWORKER_H(?![A-Za-z0-9_])/TOR_CPUWORKER_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRECTORY_H(?![A-Za-z0-9_])/TOR_DIRECTORY_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRSERV_H(?![A-Za-z0-9_])/TOR_DIRSERV_H/g; s/(?<![A-Za-z0-9_])_TOR_DIRVOTE_H(?![A-Za-z0-9_])/TOR_DIRVOTE_H/g; s/(?<![A-Za-z0-9_])_TOR_DNS_H(?![A-Za-z0-9_])/TOR_DNS_H/g; s/(?<![A-Za-z0-9_])_TOR_DNSSERV_H(?![A-Za-z0-9_])/TOR_DNSSERV_H/g; s/(?<![A-Za-z0-9_])TOR_EVENTDNS_TOR_H(?![A-Za-z0-9_])/TOR_EVENTDNS_TOR_H/g; s/(?<![A-Za-z0-9_])_TOR_GEOIP_H(?![A-Za-z0-9_])/TOR_GEOIP_H/g; s/(?<![A-Za-z0-9_])_TOR_HIBERNATE_H(?![A-Za-z0-9_])/TOR_HIBERNATE_H/g; s/(?<![A-Za-z0-9_])_TOR_MAIN_H(?![A-Za-z0-9_])/TOR_MAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_MICRODESC_H(?![A-Za-z0-9_])/TOR_MICRODESC_H/g; s/(?<![A-Za-z0-9_])_TOR_NETWORKSTATUS_H(?![A-Za-z0-9_])/TOR_NETWORKSTATUS_H/g; s/(?<![A-Za-z0-9_])_TOR_NODELIST_H(?![A-Za-z0-9_])/TOR_NODELIST_H/g; s/(?<![A-Za-z0-9_])_TOR_NTMAIN_H(?![A-Za-z0-9_])/TOR_NTMAIN_H/g; s/(?<![A-Za-z0-9_])_TOR_ONION_H(?![A-Za-z0-9_])/TOR_ONION_H/g; s/(?<![A-Za-z0-9_])_TOR_OR_H(?![A-Za-z0-9_])/TOR_OR_H/g; s/(?<![A-Za-z0-9_])_TOR_POLICIES_H(?![A-Za-z0-9_])/TOR_POLICIES_H/g; s/(?<![A-Za-z0-9_])_TOR_REASONS_H(?![A-Za-z0-9_])/TOR_REASONS_H/g; s/(?<![A-Za-z0-9_])_TOR_RELAY_H(?![A-Za-z0-9_])/TOR_RELAY_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCLIENT_H(?![A-Za-z0-9_])/TOR_RENDCLIENT_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDCOMMON_H(?![A-Za-z0-9_])/TOR_RENDCOMMON_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDMID_H(?![A-Za-z0-9_])/TOR_RENDMID_H/g; s/(?<![A-Za-z0-9_])_TOR_RENDSERVICE_H(?![A-Za-z0-9_])/TOR_RENDSERVICE_H/g; s/(?<![A-Za-z0-9_])_TOR_REPHIST_H(?![A-Za-z0-9_])/TOR_REPHIST_H/g; s/(?<![A-Za-z0-9_])_TOR_REPLAYCACHE_H(?![A-Za-z0-9_])/TOR_REPLAYCACHE_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTER_H(?![A-Za-z0-9_])/TOR_ROUTER_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERLIST_H(?![A-Za-z0-9_])/TOR_ROUTERLIST_H/g; s/(?<![A-Za-z0-9_])_TOR_ROUTERPARSE_H(?![A-Za-z0-9_])/TOR_ROUTERPARSE_H/g; s/(?<![A-Za-z0-9_])TOR_ROUTERSET_H(?![A-Za-z0-9_])/TOR_ROUTERSET_H/g; s/(?<![A-Za-z0-9_])TOR_STATEFILE_H(?![A-Za-z0-9_])/TOR_STATEFILE_H/g; s/(?<![A-Za-z0-9_])_TOR_STATUS_H(?![A-Za-z0-9_])/TOR_STATUS_H/g; s/(?<![A-Za-z0-9_])TOR_TRANSPORTS_H(?![A-Za-z0-9_])/TOR_TRANSPORTS_H/g; s/(?<![A-Za-z0-9_])_TOR_TEST_H(?![A-Za-z0-9_])/TOR_TEST_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_NATPMP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_NATPMP_H/g; s/(?<![A-Za-z0-9_])_TOR_FW_HELPER_UPNP_H(?![A-Za-z0-9_])/TOR_TOR_FW_HELPER_UPNP_H/g; ==============================
* | Remove EWMA code from relay.{c,h}; it goes to a circuitmux policy nowAndrea Shepard2012-10-10
| |
* | Use circuitmux_t in channels and when relaying cellsAndrea Shepard2012-10-10
| |
* | Convert relay.c/relay.h to channel_tAndrea Shepard2012-10-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note: this is a squashed commit; see branch bug6465_rebased_v2 of user/andrea/tor.git for full history of the following 10 commits: Convert relay.c/relay.h to channel_t Updating the timestamp if n_flushed > 0 at the end of channel_flush_from_first_active_circuit() was redundant since channel_write_cell() et al. do it themselves. Get rid of now-unnecessary time parameter in channel_flush_from_first_active_circuit() Get rid of now-unnecessary time parameter in channel_flush_from_first_active_circuit() in connection_or.c Add non-inlined external call for channeltls.c to free a packed_cell_t Appease make check-spaces in relay.c Replace channel_get_write_queue_len() with sufficient and easier to implement channel_has_queued_writes() in relay.c Rename channel_touched_by_client() and client_used field for consistency with other timestamps in relay.c Don't double-free packed cells in relay.c (channel_t Tor now bootstraps and works as a client) Rearrange channel_t struct to use a union distinguishing listener from cell-bearing channels in relay.c
* | Use channel_t rather than or_connection_t for circuitsAndrea Shepard2012-10-08
|/
* Move tor_gettimeofday_cached() into compat_libeventNick Mathewson2012-06-15
|
* Update copyright dates to 2012; add a few missing copyright statementsNick Mathewson2012-06-04
|
* All-in-one benchmark test for cell cryptoNick Mathewson2011-11-11
|
* Make the get_options() return constNick Mathewson2011-06-14
| | | | | | | | This lets us make a lot of other stuff const, allows the compiler to generate (slightly) better code, and will make me get slightly fewer patches from folks who stick mutable stuff into or_options_t. const: because not every input is an output!
* Move the decl for tor_gettimofday_cache_clear to the right headerNick Mathewson2011-03-16
|
* Bump copyright statements to 2011 (0.2.2)Nick Mathewson2011-01-03
|
* Merge remote branch fix_security_bug_021 into fix_security_bug_022Nick Mathewson2010-12-15
| | | | | | | Conflicts: src/common/memarea.c src/or/or.h src/or/rendclient.c
* Merge branch 'bug1184'Nick Mathewson2010-09-15
|\
| * Clear cell queues when marking or truncating a circuit.Nick Mathewson2010-07-30
| | | | | | | | | | | | | | | | | | At best, this patch helps us avoid sending queued relayed cells that would get ignored during the time between when a destroy cell is sent and when the circuit is finally freed. At worst, it lets us release some memory a little earlier than it would otherwise. Fix for bug #1184. Bugfix on 0.2.0.1-alpha.
* | Add a max_cells arg to connection_edge_process_raw_inbufNick Mathewson2010-09-13
| | | | | | | | | | | | | | I'm going to use this to implement more fairness in circuit_resume_edge_reading_helper in an attempt to fix bug 1298. (Updated with fixes from arma and Sebastian)
* | be more consistent in using streamid_tNick Mathewson2010-09-08
| |
* | Fix behavior of adding a cell to a blocked queue.Nick Mathewson2010-09-02
|/ | | | | | | | | | | | | | We frequently add cells to stream-blocked queues for valid reasons that don't mean we need to block streams. The most obvious reason is if the cell arrives over a circuit rather than from an edge: we don't block circuits, no matter how full queues get. The next most obvious reason is that we allow CONNECTED cells from a newly created stream to get delivered just fine. This patch changes the behavior so that we only iterate over the streams on a circuit when the cell in question came from a stream, and we only block the stream that generated the cell, so that other streams can still get their CONNECTEDs in.
* Create relay.hSebastian Hahn2010-07-27