[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r15368: If you're using bridges, generate "bootstrap problem" warnin (in tor/trunk: . doc src/or)



Author: arma
Date: 2008-06-20 00:34:39 -0400 (Fri, 20 Jun 2008)
New Revision: 15368

Modified:
   tor/trunk/ChangeLog
   tor/trunk/doc/TODO
   tor/trunk/src/or/circuitbuild.c
   tor/trunk/src/or/connection.c
   tor/trunk/src/or/control.c
   tor/trunk/src/or/or.h
Log:
If you're using bridges, generate "bootstrap problem" warnings
as soon as you run out of working bridges, rather than waiting
for ten failures -- which will never happen if you have less than
ten bridges.


Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/ChangeLog	2008-06-20 04:34:39 UTC (rev 15368)
@@ -37,9 +37,18 @@
       from cannibalized circuits are completely ignored and not included in
       rendezvous service descriptors. This might be another reason for delay
       in making a hidden service available. Bugfix on 0.2.0.14-alpha.
+
+  o Bootstrapping bugfixes:
     - Directory authorities shouldn't complain about bootstrapping
       problems just because they do a lot of reachability testing and
       some of the connection attempts fail.
+    - Start sending "count" and "recommendation" key/value pairs in
+      bootstrap problem status events, so the controller can hear about
+      problems even before Tor decides they're worth reporting for sure.
+    - If you're using bridges, generate "bootstrap problem" warnings
+      as soon as you run out of working bridges, rather than waiting
+      for ten failures -- which will never happen if you have less than
+      ten bridges.
 
 
 Changes in version 0.2.1.1-alpha - 2008-06-13

Modified: tor/trunk/doc/TODO
===================================================================
--- tor/trunk/doc/TODO	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/doc/TODO	2008-06-20 04:34:39 UTC (rev 15368)
@@ -340,7 +340,7 @@
   o directory authorities shouldn't complain about bootstrapping problems
     just because they do a lot of reachability testing and some of
     it fails.
-R * if your bridge is unreachable, it won't generate enough connection
+  o if your bridge is unreachable, it won't generate enough connection
     failures to generate a bootstrap problem event.
 R - if "no running bridges known", an application request should make
     us retry all our bridges.

Modified: tor/trunk/src/or/circuitbuild.c
===================================================================
--- tor/trunk/src/or/circuitbuild.c	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/src/or/circuitbuild.c	2008-06-20 04:34:39 UTC (rev 15368)
@@ -3068,6 +3068,27 @@
   return choose_random_entry(NULL)!=NULL ? 1 : 0;
 }
 
+/** Return 1 if there are any directory conns fetching bridge descriptors
+ * that aren't marked for close. We use this to guess if we should tell
+ * the controller that we have a problem. */
+int
+any_pending_bridge_descriptor_fetches(void)
+{
+  smartlist_t *conns = get_connection_array();
+  SMARTLIST_FOREACH(conns, connection_t *, conn,
+  {
+    if (conn->type == CONN_TYPE_DIR &&
+        conn->purpose == DIR_PURPOSE_FETCH_SERVERDESC &&
+        TO_DIR_CONN(conn)->router_purpose == ROUTER_PURPOSE_BRIDGE &&
+        !conn->marked_for_close &&
+        conn->linked && !conn->linked_conn->marked_for_close) {
+      log_debug(LD_DIR, "found one: %s", conn->address);
+      return 1;
+    }
+  });
+  return 0;
+}
+
 /** Return 1 if we have at least one descriptor for a bridge and
  * all descriptors we know are down. Else return 0. If <b>act</b> is
  * 1, then mark the down bridges up; else just observe and report. */

Modified: tor/trunk/src/or/connection.c
===================================================================
--- tor/trunk/src/or/connection.c	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/src/or/connection.c	2008-06-20 04:34:39 UTC (rev 15368)
@@ -494,6 +494,10 @@
       or_conn = TO_OR_CONN(conn);
       /* Remember why we're closing this connection. */
       if (conn->state != OR_CONN_STATE_OPEN) {
+        /* Inform any pending (not attached) circs that they should
+         * give up. */
+        circuit_n_conn_done(TO_OR_CONN(conn), 0);
+        /* now mark things down as needed */
         if (connection_or_nonopen_was_started_here(or_conn)) {
           or_options_t *options = get_options();
           rep_hist_note_connect_failed(or_conn->identity_digest, now);
@@ -517,9 +521,6 @@
                 orconn_end_reason_to_control_string(reason), reason);
           }
         }
-        /* Inform any pending (not attached) circs that they should
-         * give up. */
-        circuit_n_conn_done(TO_OR_CONN(conn), 0);
       } else if (conn->hold_open_until_flushed) {
         /* We only set hold_open_until_flushed when we're intentionally
          * closing a connection. */

Modified: tor/trunk/src/or/control.c
===================================================================
--- tor/trunk/src/or/control.c	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/src/or/control.c	2008-06-20 04:34:39 UTC (rev 15368)
@@ -3868,12 +3868,19 @@
   if (bootstrap_problems >= BOOTSTRAP_PROBLEM_THRESHOLD)
     recommendation = "warn";
 
+  if (get_options()->UseBridges &&
+      !any_bridge_descriptors_known() &&
+      !any_pending_bridge_descriptor_fetches())
+    recommendation = "warn";
+
   while (status>=0 && bootstrap_status_to_string(status, &tag, &summary) < 0)
     status--; /* find a recognized status string based on current progress */
 
-  log_warn(LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s)",
+  log_warn(LD_CONTROL, "Problem bootstrapping. Stuck at %d%%: %s. (%s; %s; "
+           "count %d; recommendation %s)",
            status, summary, warn,
-           orconn_end_reason_to_control_string(reason));
+           orconn_end_reason_to_control_string(reason),
+           bootstrap_problems, recommendation);
   tor_snprintf(buf, sizeof(buf),
       "BOOTSTRAP PROGRESS=%d TAG=%s SUMMARY=\"%s\" WARNING=\"%s\" REASON=%s "
       "COUNT=%d RECOMMENDATION=%s",

Modified: tor/trunk/src/or/or.h
===================================================================
--- tor/trunk/src/or/or.h	2008-06-20 03:15:48 UTC (rev 15367)
+++ tor/trunk/src/or/or.h	2008-06-20 04:34:39 UTC (rev 15368)
@@ -2600,6 +2600,7 @@
 void fetch_bridge_descriptors(time_t now);
 void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
 int any_bridge_descriptors_known(void);
+int any_pending_bridge_descriptor_fetches(void);
 int bridges_known_but_down(void);
 void bridges_retry_all(void);