aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Yu <catalyst@torproject.org>2017-09-13 14:47:48 -0500
committerTaylor Yu <catalyst@torproject.org>2017-09-14 08:25:27 -0500
commit449bb2351eadd8d01fe89f8d46b4706d50b661b2 (patch)
tree312ce8ebfbf69b29ac433c29990488212c28e3a2
parent818332e7f1406399007fa9c102a0f6bdbe46a045 (diff)
downloadtor-449bb2351eadd8d01fe89f8d46b4706d50b661b2.tar.gz
tor-449bb2351eadd8d01fe89f8d46b4706d50b661b2.zip
Make trusted clock skew a bootstrap warning
Make clock skew events based on trusted sources produce a bootstrap warning so controllers can more easily alert users about clock skew problems.
-rw-r--r--src/or/connection.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/or/connection.c b/src/or/connection.c
index 5c675acca4..b831d231b0 100644
--- a/src/or/connection.c
+++ b/src/or/connection.c
@@ -5221,7 +5221,7 @@ clock_skew_warning(const connection_t *conn, long apparent_skew, int trusted,
const char *source)
{
char dbuf[64];
- char *ext_source = NULL;
+ char *ext_source = NULL, *warn = NULL;
format_time_interval(dbuf, sizeof(dbuf), apparent_skew);
if (conn)
tor_asprintf(&ext_source, "%s:%s:%d", source, conn->address, conn->port);
@@ -5235,9 +5235,14 @@ clock_skew_warning(const connection_t *conn, long apparent_skew, int trusted,
apparent_skew > 0 ? "ahead" : "behind", dbuf,
apparent_skew > 0 ? "behind" : "ahead",
(!conn || trusted) ? "" : ", or they are sending us the wrong time");
- if (trusted)
+ if (trusted) {
control_event_general_status(LOG_WARN, "CLOCK_SKEW SKEW=%ld SOURCE=%s",
apparent_skew, ext_source);
+ tor_asprintf(&warn, "Clock skew %ld in %s from %s", apparent_skew,
+ received, source);
+ control_event_bootstrap_problem(warn, "CLOCK_SKEW", conn, 1);
+ }
+ tor_free(warn);
tor_free(ext_source);
}