]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Report only the first bootstrap failure from an orconn
authorNick Mathewson <nickm@torproject.org>
Thu, 27 Mar 2014 19:58:43 +0000 (15:58 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 27 Mar 2014 19:58:43 +0000 (15:58 -0400)
Otherwise, when we report "identity mismatch", we then later report
DONE when the connection gets closed.

Fixes bug 10431; bugfix on 0.2.1.1-alpha.

changes/bug10431 [new file with mode: 0644]
src/or/control.c
src/or/control.h
src/or/or.h
src/test/test_extorport.c

diff --git a/changes/bug10431 b/changes/bug10431
new file mode 100644 (file)
index 0000000..39353a2
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor bugfixes:
+    - Only report the first fatal boostrap error on a given OR
+      connection.  This prevents controllers from declaring that a
+      connection has failed because of "DONE" or other junk reasons.
+      Fixes bug 10431; bugfix on 0.2.1.1-alpha.
index 23e2054f9e66a83f959d0c5a1b3156893aa57ca2..43c0539ddbcdf3ecec1fb35689bfdac9836e99ca 100644 (file)
@@ -4884,7 +4884,7 @@ control_event_bootstrap(bootstrap_status_t status, int progress)
  */
 MOCK_IMPL(void,
           control_event_bootstrap_problem, (const char *warn, int reason,
-                                            const or_connection_t *or_conn))
+                                            or_connection_t *or_conn))
 {
   int status = bootstrap_percent;
   const char *tag, *summary;
@@ -4895,6 +4895,11 @@ MOCK_IMPL(void,
   /* bootstrap_percent must not be in "undefined" state here. */
   tor_assert(status >= 0);
 
+  if (or_conn->have_noted_bootstrap_problem)
+    return;
+
+  or_conn->have_noted_bootstrap_problem = 1;
+
   if (bootstrap_percent == 100)
     return; /* already bootstrapped; nothing to be done here. */
 
index ce605a1208bfabcf1e99eb88d932ee00f0ca29c8..988c171d7f8645b322d0b45808b521d9b67e1cbc 100644 (file)
@@ -94,7 +94,7 @@ void monitor_owning_controller_process(const char *process_spec);
 void control_event_bootstrap(bootstrap_status_t status, int progress);
 MOCK_DECL(void, control_event_bootstrap_problem,(const char *warn,
                                                  int reason,
-                                              const or_connection_t *or_conn));
+                                                 or_connection_t *or_conn));
 
 void control_event_clients_seen(const char *controller_str);
 void control_event_transport_launched(const char *mode,
index 38ab1767e03fee18ae1d504e20415bb527033497..1ecded97d10e09b2b38916a2943b28cd67f76496 100644 (file)
@@ -1481,6 +1481,10 @@ typedef struct or_connection_t {
   unsigned int is_outgoing:1;
   unsigned int proxy_type:2; /**< One of PROXY_NONE...PROXY_SOCKS5 */
   unsigned int wide_circ_ids:1;
+  /** True iff this connection has had its bootstrap failure logged with
+   * control_event_bootstrap_problem. */
+  unsigned int have_noted_bootstrap_problem:1;
+
   uint16_t link_proto; /**< What protocol version are we using? 0 for
                         * "none negotiated yet." */
 
index b34f5e38dee52e231c9680d77bc153d1bed8d0cb..f91ac7415e53787b62688035480b3914d0833b49 100644 (file)
@@ -364,7 +364,7 @@ test_ext_or_cookie_auth_testvec(void *arg)
 
 static void
 ignore_bootstrap_problem(const char *warn, int reason,
-                       const or_connection_t *conn)
+                         or_connection_t *conn)
 {
   (void)warn;
   (void)reason;