]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Log a message when a hidden service has fewer intro points than expected
authorteor <teor2345@gmail.com>
Thu, 2 Mar 2017 05:38:21 +0000 (16:38 +1100)
committerNick Mathewson <nickm@torproject.org>
Sun, 5 Mar 2017 04:22:34 +0000 (23:22 -0500)
Closes ticket 21598.

changes/feature21598 [new file with mode: 0644]
src/or/rendservice.c

diff --git a/changes/feature21598 b/changes/feature21598
new file mode 100644 (file)
index 0000000..317ace4
--- /dev/null
@@ -0,0 +1,4 @@
+  o Minor feature (hidden services):
+    - Log a message when a hidden service descriptor has fewer introduction
+      points than specified in HiddenServiceNumIntroductionPoints.
+      Closes ticket 21598.
index cb87624df546bb23d641ad88309f98979b5b4106..87a9ccfaed9a056a79ff4a864985ef8a41fa647d 100644 (file)
@@ -1080,6 +1080,25 @@ rend_service_update_descriptor(rend_service_t *service)
       intro_svc->time_published = time(NULL);
     }
   }
+
+  /* Check that we have the right number of intro points */
+  unsigned int have_intro = (unsigned int)smartlist_len(d->intro_nodes);
+  if (have_intro != service->n_intro_points_wanted) {
+    int severity;
+    /* Getting less than we wanted or more than we're allowed is serious */
+    if (have_intro < service->n_intro_points_wanted ||
+        have_intro > NUM_INTRO_POINTS_MAX) {
+      severity = LOG_WARN;
+    } else {
+      /* Getting more than we wanted is weird, but less of a problem */
+      severity = LOG_NOTICE;
+    }
+    log_fn(severity, LD_REND, "Hidden service %s wanted %d intro points, but "
+           "descriptor was updated with %d instead.",
+           service->service_id,
+           service->n_intro_points_wanted, have_intro);
+    rend_service_dump_stats(severity);
+  }
 }
 
 /* Allocate and return a string containing the path to file_name in