aboutsummaryrefslogtreecommitdiff
path: root/src/or/relay.c
AgeCommit message (Collapse)Author
2018-04-01misc tiny fixesRoger Dingledine
2018-03-19Merge branch 'ticket25268_034_01'Nick Mathewson
2018-02-15Merge branch 'bug24914'Nick Mathewson
2018-02-15Merge remote-tracking branch 'valentecaio/t-24714'Nick Mathewson
2018-02-15cmux: Remove PARANOIA assert functionsDavid Goulet
The reason to do so is because these functions haven't been used in years so since 0.2.4, every callsite is NOP. In future commits, we'll remove the round robin circuit policy which is mostly validated within those function. This simplifies the code greatly and remove dead code for which we never had a configure option in the first place nor an easy way to use them in production. Part of #25268 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-02-02Merge remote-tracking branch 'dgoulet/ticket24902_029_05'Nick Mathewson
2018-02-02geoip: Hook the client history cache into the OOM handlerDavid Goulet
If the cache is using 20% of our maximum allowed memory, clean 10% of it. Same behavior as the HS descriptor cache. Closes #25122 Signed-off-by: David Goulet <dgoulet@torproject.org>
2018-02-01refactor: rename connection_t struct fields.Caio Valente
connection_t.timestamp_lastwritten renamed to connection_t.timestamp_last_write_allowed connection_t.timestamp_lastread renamed to connection_t.timestamp_last_read_allowed Closes ticket 24714.
2018-01-25In relay_digest_matches(), use stack instead of heap.Nick Mathewson
We'd been using crypto_digest_dup() and crypto_digest_assign() here, but they aren't necessary. Instead we can just use the stack to store the previous state of the SHA_CTX and avoid a malloc/free pair. Closes ticket 24914.
2018-01-10Merge remote-tracking branch 'ffmancera/github/bug24501'Nick Mathewson
2017-12-21In 0.3.3, we use timestamps, not absolute milliseconds.Nick Mathewson
2017-12-21Merge branch 'maint-0.3.2'Nick Mathewson
2017-12-21Merge branch 'maint-0.3.1' into maint-0.3.2Nick Mathewson
2017-12-21Merge branch 'maint-0.3.0' into maint-0.3.1Nick Mathewson
2017-12-21Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-12-21Use monotime_coarse_absolute_msec() in destroy queueNick Mathewson
This way it will match the insert queue in 029 and later.
2017-12-21Merge branch 'maint-0.2.8' into maint-0.2.9Nick Mathewson
2017-12-21Merge branch 'maint-0.2.5' into maint-0.2.8maint-0.2.8Nick Mathewson
2017-12-21Move destroy cells into a separate queue type of their own, to save RAMNick Mathewson
We've been seeing problems with destroy cells queues taking up a huge amount of RAM. We can mitigate this, since while a full packed destroy cell takes 514 bytes, we only need 5 bytes to remember a circuit ID and a reason. Fixes bug 24666. Bugfix on 0.2.5.1-alpha, when destroy cell queues were introduced.
2017-12-20Add some values to OOM log msg #24501Fernando Fernandez Mancera
Exposing cell_queues_get_total_allocation(), buf_get_total_allocation(), tor_compress_get_total_allocation(), tor_compress_get_total_allocation() when hit MaxMemInQueues threshold. Fixes #24501 Signed-off-by: Fernando Fernandez Mancera <ffernandezmancera@gmail.com>
2017-12-08Merge branch 'macro_free_v2_squashed'Nick Mathewson
2017-12-08Change the free macro convention in the rest of src/or/*.hNick Mathewson
2017-12-08Merge branch 'dgoulet_ticket23709_033_01_squashed'Nick Mathewson
2017-12-08chan: Do not re-queue after a fail cell writeDavid Goulet
Couple things happen in this commit. First, we do not re-queue a cell back in the circuit queue if the write packed cell failed. Currently, it is close to impossible to have it failed but just in case, the channel is mark as closed and we move on. The second thing is that the channel_write_packed_cell() always took ownership of the cell whatever the outcome. This means, on success or failure, it needs to free it. It turns out that that we were using the wrong free function in one case and not freeing it in an other possible code path. So, this commit makes sure we only free it in one place that is at the very end of channel_write_packed_cell() which is the top layer of the channel abstraction. This makes also channel_tls_write_packed_cell_method() return a negative value on error. Two unit tests had to be fixed (quite trivial) due to a double free of the packed cell in the test since now we do free it in all cases correctly. Part of #23709 Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-27Add a new notion of "stamps" to be a fast 32-bit monotonic timestampNick Mathewson
The goal here is to replace our use of msec-based timestamps with something less precise, but easier to calculate. We're doing this because calculating lots of msec-based timestamps requires lots of 64/32 division operations, which can be inefficient on 32-bit platforms. We make sure that these stamps can be calculated using only the coarse monotonic timer and 32-bit bitwise operations.
2017-11-22channel: Requeue cell to circuit if channnel failedDavid Goulet
If the channel layer failed to write a cell from the circuit queue, requeue it so it can be retried on the same channel later. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-22relay: Improve comment in append_cell_to_circuit_queue()David Goulet
This function is part of the tor fast path so this commit adds more documentation to it as it is critical. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-22relay: Remove dead codeDavid Goulet
append_cell_to_circuit_queue() had code disabled from commit 2a95f3171681ee53c97ccba9d80f4454b462aaa7 This code is 4+ years old related to bug #9072 so if we ever want to revisit it, lets inspect/revert this commit. Signed-off-by: David Goulet <dgoulet@torproject.org>
2017-11-13Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-11-13Merge branch 'bug8185_025' into maint-0.2.9Nick Mathewson
2017-11-04Revert "Make ClientDNSRejectInternalAddresses testing-only."Sebastian Hahn
This reverts commit 27fa4a98d23972213122fa99499efa4baebe49e3.
2017-09-29Merge branches 'bug8185_031' and 'bug8185_diagnostic_032'Nick Mathewson
2017-09-29Merge branch 'bug8185_025' into bug8185_031Nick Mathewson
2017-09-29Don't package cells onto marked circuits.Nick Mathewson
This caused a BUG log when we noticed that the circuit had no channel. The likeliest culprit for exposing that behavior is d769cab3e5097980, where we made circuit_mark_for_close() NULL out the n_chan and p_chan fields of the circuit. Fixes bug 8185; bugfix on 0.2.5.4-alpha, I think.
2017-09-29Log more information when bug8185 is about to trigger.Nick Mathewson
My current theory is that this is just a marked circuit that hasn't closed yet, but let's gather more information in case that theory is wrong. Diagnostic for 8185.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-11Merge branch 'maint-0.2.9' into maint-0.3.0Nick Mathewson
2017-09-11Fix GCC 7 -Wimplicit-fallthrough warningsAndreas Stieger
Add magic comments recognized by default -Wimplicit-fallthrough=3 or break, as required.
2017-09-07Make ClientDNSRejectInternalAddresses testing-only.Nick Mathewson
Undeprecate it; rename it to TestingClientDNSRejectInternalAddresses; add the old name as an alias; reject configurations where it is set but TestingTorNetwork is not; change the documentation accordingly. Closes tickets 21031 and 21522.
2017-09-07Merge branch 'maint-0.3.1'Nick Mathewson
2017-09-07Add a stack trace to the warning at issue with 23105.Nick Mathewson
With luck, this will help us diagnose 23105 and fix it. I also added a stack trace to the warning right before it, since why not.
2017-09-05Merge branch 'http_tunnel_squashed'Nick Mathewson
2017-09-05Add support for HTTP Connect tunnelsNick Mathewson
2017-09-05Refactor buffer APIs to put a buf_t first.Nick Mathewson
By convention, a function that frobs a foo_t should be called foo_frob, and it should have a foo_t * as its first argument. But for many of the buf_t functions, the buf_t was the final argument, which is silly.
2017-09-05Repair buffer API so everything starts with buf_.Nick Mathewson
Our convention is that functions which manipulate a type T should be named T_foo. But the buffer functions were super old, and followed all kinds of conventions. Now they're uniform. Here's the perl I used to do this: \#!/usr/bin/perl -w -i -p s/read_to_buf\(/buf_read_from_socket\(/; s/flush_buf\(/buf_flush_to_socket\(/; s/read_to_buf_tls\(/buf_read_from_tls\(/; s/flush_buf_tls\(/buf_flush_to_tls\(/; s/write_to_buf\(/buf_add\(/; s/write_to_buf_compress\(/buf_add_compress\(/; s/move_buf_to_buf\(/buf_move_to_buf\(/; s/peek_from_buf\(/buf_peek\(/; s/fetch_from_buf\(/buf_get_bytes\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/fetch_from_buf_line\(/buf_get_line\(/; s/buf_remove_from_front\(/buf_drain\(/; s/peek_buf_startswith\(/buf_peek_startswith\(/; s/assert_buf_ok\(/buf_assert_ok\(/;
2017-06-19Remove an XXXX RD comment that neither Roger or I understand. Closes 22420Nick Mathewson
2017-06-19Merge remote-tracking branch 'arma/ticket22420'Nick Mathewson
2017-06-08Merge branch 'maint-0.2.7-redux' into maint-0.2.8Nick Mathewson
2017-06-08Merge branch 'maint-0.2.4' into maint-0.2.5Nick Mathewson
2017-06-08Merge branch 'maint-0.2.8' into maint-0.2.9Nick Mathewson