]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Bug 40876: Extra logging
authorMike Perry <mikeperry-git@torproject.org>
Wed, 25 Oct 2023 00:55:43 +0000 (00:55 +0000)
committerMike Perry <mikeperry-git@torproject.org>
Wed, 1 Nov 2023 19:57:08 +0000 (19:57 +0000)
src/feature/client/entrynodes.c

index 45fd3a4d9a02b5d14993e242f549f760959b1ab7..7c469ea84a93c272aeb5cd1c63aa68c9b29e0cd8 100644 (file)
@@ -2193,6 +2193,10 @@ select_primary_guard_for_circuit(guard_selection_t *gs,
        * one from the list. */
       if (num_entry_guards_considered >= num_entry_guards_to_consider) {
         break;
+      }
+    } else {
+      log_info(LD_GUARD, "Guard %s is not reachable",
+          entry_guard_describe(guard));
     }
   } SMARTLIST_FOREACH_END(guard);
 
@@ -2202,6 +2206,10 @@ select_primary_guard_for_circuit(guard_selection_t *gs,
         "Selected primary guard %s for circuit from a list size of %d.",
         entry_guard_describe(chosen_guard),
         smartlist_len(usable_primary_guards));
+    /* Describe each guard in the list: */
+    SMARTLIST_FOREACH_BEGIN(usable_primary_guards, entry_guard_t *, guard) {
+      log_info(LD_GUARD, "  %s", entry_guard_describe(guard));
+    } SMARTLIST_FOREACH_END(guard);
     smartlist_free(usable_primary_guards);
   }
 
@@ -2307,16 +2315,22 @@ select_entry_guard_for_circuit(guard_selection_t *gs,
   /* "If any entry in PRIMARY_GUARDS has {is_reachable} status of
       <maybe> or <yes>, return the first such guard." */
   chosen_guard = select_primary_guard_for_circuit(gs, usage, rst, state_out);
-  if (chosen_guard)
+  if (chosen_guard) {
+    log_info(LD_GUARD, "Selected primary guard %s for circuit.",
+             entry_guard_describe(chosen_guard));
     return chosen_guard;
+  }
 
   /* "Otherwise, if the ordered intersection of {CONFIRMED_GUARDS}
       and {USABLE_FILTERED_GUARDS} is nonempty, return the first
       entry in that intersection that has {is_pending} set to
       false." */
   chosen_guard = select_confirmed_guard_for_circuit(gs, usage, rst, state_out);
-  if (chosen_guard)
+  if (chosen_guard) {
+     log_info(LD_GUARD, "Selected confirmed guard %s for circuit.",
+             entry_guard_describe(chosen_guard));
     return chosen_guard;
+  }
 
   /* "Otherwise, if there is no such entry, select a member
    * {USABLE_FILTERED_GUARDS} following the sample ordering" */
@@ -2329,6 +2343,8 @@ select_entry_guard_for_circuit(guard_selection_t *gs,
     return NULL;
   }
 
+  log_info(LD_GUARD, "Selected filtered guard %s for circuit.",
+             entry_guard_describe(chosen_guard));
   return chosen_guard;
 }