]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Fix several places where md-using relays would get wrong behavior.
authorNick Mathewson <nickm@torproject.org>
Wed, 6 Sep 2017 20:26:47 +0000 (16:26 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 15 Sep 2017 13:35:59 +0000 (09:35 -0400)
This patch replaces a few calls to router_get_by_id_digest ("do we
have a routerinfo?") with connection_or_digest_is_known_relay ("do
we know this relay to be in the consensus, or have been there some
time recently?").

Found while doing the 21585 audit; fixes bug 23533.  Bugfix on
0.3.0.1-alpha.

changes/bug23533 [new file with mode: 0644]
src/or/channel.c
src/or/channeltls.c
src/or/rephist.c

diff --git a/changes/bug23533 b/changes/bug23533
new file mode 100644 (file)
index 0000000..b5bfdc0
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay):
+    - Inform the geoip and rephist modules about all requests, even
+      on relays that are only fetching microdescriptors. Fixes a bug related
+      to 21585; bugfix on 0.3.0.1-alpha.
index 17b2191b772511b29d19b0b196696ea90f4b22eb..2970b967911365418947a8327b64297fd3c7edd1 100644 (file)
@@ -2696,7 +2696,7 @@ channel_do_open_actions(channel_t *chan)
     router_set_status(chan->identity_digest, 1);
   } else {
     /* only report it to the geoip module if it's not a known router */
-    if (!router_get_by_id_digest(chan->identity_digest)) {
+    if (!connection_or_digest_is_known_relay(chan->identity_digest)) {
       if (channel_get_addr_if_possible(chan, &remote_addr)) {
         char *transport_name = NULL;
         if (chan->get_transport_name(chan, &transport_name) < 0)
index f44e4fc8ea5ded7e97dd52a20e5d4c5411a59527..c6a0bb21e9f92399fd3634ec5924f8c052b6eaa5 100644 (file)
@@ -1823,7 +1823,7 @@ channel_tls_process_netinfo_cell(cell_t *cell, channel_tls_t *chan)
   /** Warn when we get a netinfo skew with at least this value. */
 #define NETINFO_NOTICE_SKEW 3600
   if (labs(apparent_skew) > NETINFO_NOTICE_SKEW &&
-      router_get_by_id_digest(chan->conn->identity_digest)) {
+      connection_or_digest_is_known_relay(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,
                        "NETINFO cell", "OR");
index 72a5cc5a9b91d5493293f813b680ce8abad16e2f..6a589379bb70d88f47fb925e3e8fede2f7983ba7 100644 (file)
@@ -947,9 +947,9 @@ rep_hist_record_mtbf_data(time_t now, int missing_means_down)
     base16_encode(dbuf, sizeof(dbuf), digest, DIGEST_LEN);
 
     if (missing_means_down && hist->start_of_run &&
-        !router_get_by_id_digest(digest)) {
+        !connection_or_digest_is_known_relay(digest)) {
       /* We think this relay is running, but it's not listed in our
-       * routerlist. Somehow it fell out without telling us it went
+       * consensus. Somehow it fell out without telling us it went
        * down. Complain and also correct it. */
       log_info(LD_HIST,
                "Relay '%s' is listed as up in rephist, but it's not in "