From cd6cb453720a5300d00d7996c5b3a03f054cd293 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 8 Aug 2019 09:15:42 -0400 Subject: Restore proper behavior of netinfo skew check My previous fix removed a comparison, which would have caused us to warn about every skew instead of skews of over an hour. --- src/or/channeltls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/or/channeltls.c b/src/or/channeltls.c index ea69792f12..d44f719138 100644 --- a/src/or/channeltls.c +++ b/src/or/channeltls.c @@ -1721,7 +1721,7 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan) /* Act on apparent skew. */ /** Warn when we get a netinfo skew with at least this value. */ #define NETINFO_NOTICE_SKEW 3600 - if (time_abs(apparent_skew) && + if (time_abs(apparent_skew) > NETINFO_NOTICE_SKEW && router_get_by_id_digest(chan->conn->identity_digest)) { int trusted = router_digest_is_trusted_dir(chan->conn->identity_digest); clock_skew_warning(TO_CONN(chan->conn), apparent_skew, trusted, LD_GENERAL, -- cgit v1.2.3-54-g00ecf From 878f4409015f741c7075d0ccf3da794a6f313302 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 8 Aug 2019 09:38:03 -0400 Subject: Fix another time_t/long warning for 31343. --- src/or/routerlist.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/or/routerlist.c b/src/or/routerlist.c index f73ec9baa1..f3b298006c 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -5443,7 +5443,7 @@ int router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2) { time_t r1pub, r2pub; - long time_difference; + time_t time_difference; tor_assert(r1 && r2); /* r1 should be the one that was published first. */ @@ -5506,7 +5506,9 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2) * give or take some slop? */ r1pub = r1->cache_info.published_on; r2pub = r2->cache_info.published_on; - time_difference = labs(r2->uptime - (r1->uptime + (r2pub - r1pub))); + time_difference = r2->uptime - (r1->uptime + (r2pub - r1pub)); + if (time_difference < 0) + time_difference = - time_difference; if (time_difference > ROUTER_ALLOW_UPTIME_DRIFT && time_difference > r1->uptime * .05 && time_difference > r2->uptime * .05) @@ -5816,4 +5818,3 @@ refresh_all_country_info(void) nodelist_refresh_countries(); } - -- cgit v1.2.3-54-g00ecf