]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Supply better and less frequent warnings on circID exhaustion
authorNick Mathewson <nickm@torproject.org>
Fri, 18 Apr 2014 16:28:30 +0000 (12:28 -0400)
committerNick Mathewson <nickm@torproject.org>
Fri, 18 Apr 2014 16:31:06 +0000 (12:31 -0400)
Fixes the surface behavior of #11553

changes/bug11553 [new file with mode: 0644]
src/or/channel.h
src/or/circuitbuild.c

diff --git a/changes/bug11553 b/changes/bug11553
new file mode 100644 (file)
index 0000000..1540f46
--- /dev/null
@@ -0,0 +1,5 @@
+  o Minor features:
+    - When we run out of usable circuit IDs on a channel, log only one
+      warning for the whole channel, and include a description of
+      how many circuits there were on the channel. Fix for part of ticket
+      #11553.
index 2dca81705f7c9466693171d3a52b8f00c745d630..29ba40e32639b7a2961d3342b19ffaf765940608 100644 (file)
@@ -148,6 +148,8 @@ struct channel_s {
   ENUM_BF(circ_id_type_t) circ_id_type:2;
   /** DOCDOC*/
   unsigned wide_circ_ids:1;
+  /** Have we logged a warning about circID exhaustion on this channel? */
+  unsigned warned_circ_ids_exhausted:1;
   /*
    * Which circ_id do we try to use next on this connection?  This is
    * always in the range 0..1<<15-1.
index e47a2780af1fbae136bc59904132feba1485d445..2b4d3c3118456ae17f563c25b28b967c22497f7a 100644 (file)
@@ -127,7 +127,14 @@ get_unique_circ_id_by_chan(channel_t *chan)
       /* Make sure we don't loop forever if all circ_id's are used. This
        * matters because it's an external DoS opportunity.
        */
-      log_warn(LD_CIRC,"No unused circ IDs. Failing.");
+      if (! chan->warned_circ_ids_exhausted) {
+        chan->warned_circ_ids_exhausted = 1;
+        log_warn(LD_CIRC,"No unused circIDs found on channel %s wide "
+                 "circID support, with %u inbound and %u outbound circuits. "
+                 "Failing a circuit.",
+                 chan->wide_circ_ids ? "with" : "without",
+                 chan->num_p_circuits, chan->num_n_circuits);
+      }
       return 0;
     }
     test_circ_id |= high_bit;