summaryrefslogtreecommitdiff
path: root/src/feature/relay
diff options
context:
space:
mode:
authorGeorge Kadianakis <desnacked@riseup.net>2021-03-17 18:23:18 +0200
committerGeorge Kadianakis <desnacked@riseup.net>2021-03-17 18:23:18 +0200
commit29f07a4e9d2e7cd061e696f673c42e00885ec231 (patch)
tree5db514a485f8b35a32fa1ed05a974e970fd37b7e /src/feature/relay
parent15a95df376f8b8e27072db8d36f28b7054d13cef (diff)
parent7740a8b5d4de649e3ba2a0578f789140725974b6 (diff)
downloadtor-29f07a4e9d2e7cd061e696f673c42e00885ec231.tar.gz
tor-29f07a4e9d2e7cd061e696f673c42e00885ec231.zip
Merge branch 'mr/334'
Diffstat (limited to 'src/feature/relay')
-rw-r--r--src/feature/relay/dns.c11
-rw-r--r--src/feature/relay/onion_queue.c23
-rw-r--r--src/feature/relay/router.c6
3 files changed, 31 insertions, 9 deletions
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index 62dfbe3184..22f929808e 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -63,6 +63,7 @@
#include "feature/relay/dns.h"
#include "feature/relay/router.h"
#include "feature/relay/routermode.h"
+#include "feature/stats/rephist.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/evloop/compat_libevent.h"
#include "lib/sandbox/sandbox.h"
@@ -1547,6 +1548,16 @@ evdns_callback(int result, char type, int count, int ttl, void *addresses,
tor_addr_make_unspec(&addr);
+ /* Note down any DNS errors to the statistics module */
+ if (result == DNS_ERR_TIMEOUT) {
+ /* libevent timed out while resolving a name. However, because libevent
+ * handles retries and timeouts internally, this means that all attempts of
+ * libevent timed out. If we wanted to get more granular information about
+ * individual libevent attempts, we would have to implement our own DNS
+ * timeout/retry logic */
+ rep_hist_note_overload(OVERLOAD_GENERAL);
+ }
+
/* Keep track of whether IPv6 is working */
if (type == DNS_IPv6_AAAA) {
if (result == DNS_ERR_TIMEOUT) {
diff --git a/src/feature/relay/onion_queue.c b/src/feature/relay/onion_queue.c
index 1fd6e9df8c..85ec0dc74a 100644
--- a/src/feature/relay/onion_queue.c
+++ b/src/feature/relay/onion_queue.c
@@ -33,6 +33,7 @@
#include "core/or/circuitlist.h"
#include "core/or/onion.h"
#include "feature/nodelist/networkstatus.h"
+#include "feature/stats/rephist.h"
#include "core/or/or_circuit_st.h"
@@ -163,15 +164,19 @@ onion_pending_add(or_circuit_t *circ, create_cell_t *onionskin)
#define WARN_TOO_MANY_CIRC_CREATIONS_INTERVAL (60)
static ratelim_t last_warned =
RATELIM_INIT(WARN_TOO_MANY_CIRC_CREATIONS_INTERVAL);
- char *m;
- if (onionskin->handshake_type == ONION_HANDSHAKE_TYPE_NTOR &&
- (m = rate_limit_log(&last_warned, approx_time()))) {
- log_warn(LD_GENERAL,
- "Your computer is too slow to handle this many circuit "
- "creation requests! Please consider using the "
- "MaxAdvertisedBandwidth config option or choosing a more "
- "restricted exit policy.%s",m);
- tor_free(m);
+ if (onionskin->handshake_type == ONION_HANDSHAKE_TYPE_NTOR) {
+ char *m;
+ /* Note this ntor onionskin drop as an overload */
+ rep_hist_note_overload(OVERLOAD_GENERAL);
+ if ((m = rate_limit_log(&last_warned, approx_time()))) {
+ log_warn(LD_GENERAL,
+ "Your computer is too slow to handle this many circuit "
+ "creation requests! Please consider using the "
+ "MaxAdvertisedBandwidth config option or choosing a more "
+ "restricted exit policy.%s",
+ m);
+ tor_free(m);
+ }
}
tor_free(tmp);
return -1;
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 30cf98f5ff..47dbcaaad6 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -3372,6 +3372,12 @@ extrainfo_dump_to_string_stats_helper(smartlist_t *chunks,
if (contents)
smartlist_add(chunks, contents);
}
+ if (options->OverloadStatistics) {
+ contents = rep_hist_get_overload_stats_lines();
+ if (contents) {
+ smartlist_add(chunks, contents);
+ }
+ }
/* bridge statistics */
if (should_record_bridge_info(options)) {
const char *bridge_stats = geoip_get_bridge_stats_extrainfo(now);