aboutsummaryrefslogtreecommitdiff
path: root/src/or/connection_or.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-02-06 05:31:21 +0000
committerNick Mathewson <nickm@torproject.org>2008-02-06 05:31:21 +0000
commitec6c131da613adad2ea4936256b7b0dc00b2ca2f (patch)
tree98e5e4c9b47244b2426cedb2cc2757f65b10bf88 /src/or/connection_or.c
parent8366da01fb62f7c860e86831642b99cfa6e60712 (diff)
downloadtor-ec6c131da613adad2ea4936256b7b0dc00b2ca2f.tar.gz
tor-ec6c131da613adad2ea4936256b7b0dc00b2ca2f.zip
r17936@catbus: nickm | 2008-02-06 00:31:11 -0500
Fix/downgrade some more XXX020s. svn:r13397
Diffstat (limited to 'src/or/connection_or.c')
-rw-r--r--src/or/connection_or.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 806beb6205..b8f16a6466 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -1089,3 +1089,43 @@ connection_or_send_netinfo(or_connection_t *conn)
return 0;
}
+/** DOCDOC Called when we're done authenticating; act on stuff we
+ * learned in netinfo. */
+int
+connection_or_act_on_netinfo(or_connection_t *conn)
+{
+ long delta;
+ if (!conn->handshake_state)
+ return -1;
+
+ tor_assert(conn->handshake_state->received_versions != 0);
+
+ delta = conn->handshake_state->apparent_skew;
+/** Warn when we get a netinfo skew with at least this value. */
+#define NETINFO_NOTICE_SKEW 3600
+ if (abs(delta) > NETINFO_NOTICE_SKEW &&
+ router_get_by_digest(conn->identity_digest)) {
+ char dbuf[64];
+ /*XXXX020 not always warn!*/
+ format_time_interval(dbuf, sizeof(dbuf), delta);
+ log_fn(LOG_WARN, LD_HTTP, "Received NETINFO cell with skewed time from "
+ "server at %s:%d. It seems that our clock is %s by %s, or "
+ "that theirs is %s. Tor requires an accurate clock to work: "
+ "please check your time and date settings.",
+ conn->_base.address, (int)conn->_base.port,
+ delta>0 ? "ahead" : "behind", dbuf,
+ delta>0 ? "behind" : "ahead");
+ control_event_general_status(LOG_WARN,
+ "CLOCK_SKEW SKEW=%ld SOURCE=OR:%s:%d",
+ delta, conn->_base.address, conn->_base.port);
+ }
+
+ /* XXX020 possibly, learn my address from my_apparent_addr */
+
+ if (conn->handshake_state->apparently_canonical) {
+ conn->is_canonical = 1;
+ }
+
+ return 0;
+}
+