Browse Source

Report the states of failed TLS connections from bootstrap_problem

Nick Mathewson 14 years ago
parent
commit
b0de8560f6
2 changed files with 13 additions and 1 deletions
  1. 5 0
      changes/feature3116
  2. 8 1
      src/or/control.c

+ 5 - 0
changes/feature3116

@@ -0,0 +1,5 @@
+  o Major features:
+    - While we're trying to bootstrap, record how many TLS connections
+      fail in each state, and report which states saw the most failures
+      in response to any bootstrap failures. This feature may speed up
+      diagnosis of censorship events.

+ 8 - 1
src/or/control.c

@@ -18,6 +18,7 @@
 #include "config.h"
 #include "config.h"
 #include "connection.h"
 #include "connection.h"
 #include "connection_edge.h"
 #include "connection_edge.h"
+#include "connection_or.h"
 #include "control.h"
 #include "control.h"
 #include "directory.h"
 #include "directory.h"
 #include "dirserv.h"
 #include "dirserv.h"
@@ -4268,6 +4269,7 @@ control_event_bootstrap_problem(const char *warn, int reason)
   const char *tag, *summary;
   const char *tag, *summary;
   char buf[BOOTSTRAP_MSG_LEN];
   char buf[BOOTSTRAP_MSG_LEN];
   const char *recommendation = "ignore";
   const char *recommendation = "ignore";
+  int severity;
 
 
   /* bootstrap_percent must not be in "undefined" state here. */
   /* bootstrap_percent must not be in "undefined" state here. */
   tor_assert(status >= 0);
   tor_assert(status >= 0);
@@ -4292,12 +4294,17 @@ control_event_bootstrap_problem(const char *warn, int reason)
     status--; /* find a recognized status string based on current progress */
     status--; /* find a recognized status string based on current progress */
   status = bootstrap_percent; /* set status back to the actual number */
   status = bootstrap_percent; /* set status back to the actual number */
 
 
-  log_fn(!strcmp(recommendation, "warn") ? LOG_WARN : LOG_INFO,
+  severity = !strcmp(recommendation, "warn") ? LOG_WARN : LOG_INFO;
+
+  log_fn(severity,
          LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
          LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
          "count %d; recommendation %s)",
          "count %d; recommendation %s)",
          status, summary, warn,
          status, summary, warn,
          orconn_end_reason_to_control_string(reason),
          orconn_end_reason_to_control_string(reason),
          bootstrap_problems, recommendation);
          bootstrap_problems, recommendation);
+
+  connection_or_report_broken_states(severity, LD_HANDSHAKE);
+
   tor_snprintf(buf, sizeof(buf),
   tor_snprintf(buf, sizeof(buf),
       "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
       "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
       "COUNT=%d RECOMMENDATION=%s",
       "COUNT=%d RECOMMENDATION=%s",