aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2018-04-17Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-17heartbeat: Log the number of circuits killed because too many cellsDavid Goulet
We recently merged a circuit cell queue size safeguard. This commit adds the number of killed circuits that have reached the limit to the DoS heartbeat. It now looks like this: [notice] DoS mitigation since startup: 0 circuits killed with too many cells. 0 circuits rejected, 0 marked addresses. 0 connections closed. 0 single hop clients refused. Second thing that this patch does. It makes tor always print the DoS mitigation heartbeat line (for a relay) even though no DoS mitigation have been enabled. The reason is because we now kill circuits that have too many cells regardless on if it is enabled or not but also it will give the operator a chance to learn what is enabled with the heartbeat instead of suddenly appearing when it is enabled by let say the consensus. Fixes #25824 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-17Merge remote-tracking branch 'public/bug24688'Nick Mathewson
2018-04-16token: Fix uint32_t to uint64_t conversionDavid Goulet
Unfortunately, the units passed to monotime_coarse_stamp_units_to_approx_msec() was always 0 due to a type conversion. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-16Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-16Merge branch 'maint-0.3.2' into maint-0.3.3Nick Mathewson
2018-04-16Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2018-04-16Merge branch 'maint-0.2.9' into maint-0.3.1Nick Mathewson
2018-04-16Fix an LCOV exclusion pattern in address.cNick Mathewson
2018-04-16Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-16Merge remote-tracking branch 'dgoulet/bug25226_033_02' into maint-0.3.3Nick Mathewson
2018-04-16relay: Implement a circuit cell queue maximum sizeDavid Goulet
This commit introduces the consensus parameter "circ_max_cell_queue_size" which controls the maximum number of cells a circuit queue should have. The default value is currently 50000 cells which is above what should be expected but keeps us a margin of error for padding cells. Related to this is #9072. Back in 0.2.4.14-alpha, we've removed that limit due to a Guard discovery attack. Ticket #25226 details why we are putting back the limit due to the memory pressure issue on relays. Fixes #25226 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-16Remove old tor-fw-helper README from EXTRA_DISTNick Mathewson
We removed this file, but didn't take it out of EXTRA_DIST -- thus breaking "make dist".
2018-04-15bump to 0.3.3.5-rc-devNick Mathewson
2018-04-14bump to 0.3.3.5-rcNick Mathewson
2018-04-1332-bit compilation warningsNick Mathewson
2018-04-13token_bucket: Fix indentationDavid Goulet
Both header and code file had some indentation issues after mass renaming. No code behavior change. Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-04-13Merge branch 'token_bucket_once_again_squashed'Nick Mathewson
2018-04-13Fix "make check-spaces"Nick Mathewson
2018-04-13Refactor "timestamp" not to be its own type coupled to token buffersNick Mathewson
Really, the uint32_t is only an optimization; any kind of unit should work fine. Some users might want to use time_t or monotime_coarse_t or something like that.
2018-04-13Move token_bucket_raw_* functions to the start of the module.Nick Mathewson
(These functions were previously helper functions for token_bucket_rw_t).
2018-04-13Never pick a rate of 0.Nick Mathewson
(The tests caught this one.)
2018-04-13Start re-refactoring the token bucket interface.Nick Mathewson
Begin by creating a lowest-level triple of the types needed to implement a token bucket: a configuration, a timestamp, and the raw bucket itself. Note that for low-level buckets, the units of the timestamp and the bucket itself are unspecified: each user can use a different type. (This patch breaks check-spaces; a later patch will fix it)
2018-04-13Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-13Merge branch 'postloop_callbacks_2'Nick Mathewson
2018-04-13Remove tell_event_loop_to_run_external_code() per reviewNick Mathewson
(This function is no longer used.)
2018-04-13Rename token_bucket_t to token_bucket_rw_t.Nick Mathewson
This is a simple search-and-replace to rename the token bucket type to indicate that it contains both a read and a write bucket, bundled with their configuration. It's preliminary to refactoring the bucket type.
2018-04-13Merge branch 'token_bucket_refactor_squashed'Nick Mathewson
2018-04-13Add a unit test for post-loop eventsNick Mathewson
This test works by having two post-loop events activate one another in a tight loop. If the "post-loop" mechanism didn't work, this would be enough to starve all other events.
2018-04-13Move connection_ap_attach_pending(0) into a postloop eventNick Mathewson
This is a second motivating case for our postloop event logic.
2018-04-13Move the "activate linked connections" logic to a postloop event.Nick Mathewson
A linked connection_t is one that gets its I/O, not from the network, but from another connection_t. When such a connection has something to write, we want the corresponding connection to run its read callback ... but not immediately, to avoid infinite recursion and/or event loop starvation. Previously we handled this case by activating the read events outside the event loop. Now we use the "postloop event" logic. This lets us simplify do_main_loop_once() a little.
2018-04-13Generic mechaism for "post-loop" callbacksNick Mathewson
We've been labeling some events as happening "outside the event loop", to avoid Libevent starvation. This patch provides a cleaner mechanism to avoid that starvation. For background, the problem here is that Libevent only scans for new events once it has run all its active callbacks. So if the callbacks keep activating new callbacks, they could potentially starve Libevent indefinitely and keep it from ever checking for timed, socket, or signal events. To solve this, we add the ability to label some events as "post-loop". The rule for a "post-loop" event is that any events _it_ activates can only be run after libevent has re-scanned for new events at least once.
2018-04-13Disable load_geoip_file() tests on windowsNick Mathewson
See bug #25787 for discussion; we should have a better fix here.
2018-04-13Increase tolerances for imprecise time.Nick Mathewson
2018-04-13Accept small hops backward in the monotonic timer.Nick Mathewson
2018-04-13Remove a bunch of int casts; make clang happier.Nick Mathewson
2018-04-13Ensure that global buckets are updated on configuration changeNick Mathewson
2018-04-13Replace the global buckets with token_bucket_tNick Mathewson
2018-04-13Refactor or_connection token buckets to use token_bucket_tNick Mathewson
2018-04-13Add a helper function to decrement read and write at the same timeNick Mathewson
2018-04-13Add a new token-bucket backend abstraction, with testsNick Mathewson
This differs from our previous token bucket abstraction in a few ways: 1) It is an abstraction, and not a collection of fields. 2) It is meant to be used with monotonic timestamps, which should produce better results than calling gettimeofday over and over.
2018-04-13Expose a function that computes stamp units from msec.Nick Mathewson
(It turns out we can't just expose STAMP_TICKS_PER_SECOND, since Apple doesn't have that.)
2018-04-12Refine extend_info_for_node's "enough info" check once again.Nick Mathewson
In d1874b433953f64, we adjusted this check so that we insist on using routerinfos for bridges. That's almost correct... but if we have a bridge that is also a regular relay, then we should use insist on its routerinfo when connecting to it as a bridge (directly), and be willing to use its microdescriptor when connecting to it elsewhere in our circuits. This bug is a likely cause of some (all?) of the (exit_ei == NULL) failures we've been seeing. Fixes bug 25691; bugfix on 0.3.3.4-alpha
2018-04-12Remove windows log_from_handle as unused.Nick Mathewson
This function was only used by PortForwardingHelper, which was removed in 9df110cd72. Its presence caused warnings on windows.
2018-04-12Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-12Attempt to fix 32-bit clang builds, which broke with 31508a0abccfee1cdNick Mathewson
When size_t is 32 bits, the unit tests can't fit anything more than 4GB-1 into a size_t. Additionally, tt_int_op() uses "long" -- we need tt_u64_op() to safely test uint64_t values for equality. Bug caused by tests for #24782 fix; not in any released Tor.
2018-04-12Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-12Attempt to fix 32-bit builds, which broke with 31508a0abccfee1cdNick Mathewson
When size_t is 32 bits, doing "size_t ram; if (ram > 8GB) { ... }" produces a compile-time warning. Bug caused by #24782 fix; not in any released Tor.
2018-04-12Merge branch 'maint-0.3.3'Nick Mathewson
2018-04-12Use less memory for MaxMemInQueues for machines with more than 8 GB of RAM.Alexander Færøy
This patch changes the algorithm of compute_real_max_mem_in_queues() to use 0.4 * RAM iff the system has more than or equal to 8 GB of RAM, but will continue to use the old value of 0.75 * RAM if the system have less than * GB of RAM available. This patch also adds tests for compute_real_max_mem_in_queues(). See: https://bugs.torproject.org/24782