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

[tor-commits] [tor/master] Add the prop271 fields to entry_guard_t. Not used yet.



commit df8256a931099767d9f70997c9eb1ef934afd392
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Mon Nov 14 13:27:35 2016 -0500

    Add the prop271 fields to entry_guard_t. Not used yet.
---
 src/or/entrynodes.c |  1 +
 src/or/entrynodes.h | 43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 7890f83..bd4d83c 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -683,6 +683,7 @@ entry_guard_free(entry_guard_t *e)
   if (!e)
     return;
   tor_free(e->chosen_by_version);
+  tor_free(e->sampled_by_version);
   tor_free(e);
 }
 
diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
index 2e18a2f..4f39a09 100644
--- a/src/or/entrynodes.h
+++ b/src/or/entrynodes.h
@@ -18,6 +18,10 @@ typedef struct guard_selection_s guard_selection_t;
 /* Forward declare for entry_guard_t; the real declaration is private. */
 typedef struct entry_guard_t entry_guard_t;
 
+#define GUARD_REACHABLE_NO    0
+#define GUARD_REACHABLE_YES   1
+#define GUARD_REACHABLE_MAYBE 2
+
 /* Information about a guard's pathbias status.
  * These fields are used in circpathbias.c to try to detect entry
  * nodes that are failing circuits at a suspicious frequency.
@@ -61,6 +65,43 @@ typedef struct guard_pathbias_t {
 struct entry_guard_t {
   char nickname[MAX_NICKNAME_LEN+1];
   char identity[DIGEST_LEN];
+  ed25519_public_key_t ed_id;
+
+  /* XXXX prop271 DOCDOC document all these fields better */
+
+  /* Persistent fields, present for all sampled guards. */
+  time_t sampled_on_date;
+  time_t unlisted_since_date;
+  char *sampled_by_version;
+  unsigned currently_listed : 1;
+
+  /* Persistent fields, for confirmed guards. */
+  time_t confirmed_on_date; /* 0 if not confirmed */
+  int confirmed_idx; /* -1 if not confirmed; otherwise the order that this
+                      * item should occur in the CONFIRMED_GUARDS ordered
+                      * list */
+
+  /* ==== Non-persistent fields. */
+  /* == These are used by sampled guards */
+  time_t last_tried_to_connect;
+  unsigned is_reachable : 2; /* One of GUARD_REACHABLE_{NO,YES,MAYBE} */
+  unsigned is_pending : 1;
+  time_t failing_since;
+
+  /* These determine presence in filtered guards and usable-filtered-guards
+   * respectively. */
+  unsigned is_filtered_guard : 1;
+  unsigned is_usable_filtered_guard : 1;
+
+  /**
+   * @name legacy guard selection algorithm fields
+   *
+   * These are used and maintained by the legacy (pre-prop271) entry guard
+   * algorithm.  Most of them we will remove as prop271 gets implemented.
+   * The rest we'll migrate over, if they are 100% semantically identical to
+   * their prop271 equivalents. XXXXprop271
+   */
+  /**@{*/
   time_t chosen_on_date; /**< Approximately when was this guard added?
                           * "0" if we don't know. */
   char *chosen_by_version; /**< What tor version added this guard? NULL
@@ -79,6 +120,8 @@ struct entry_guard_t {
   time_t last_attempted; /**< 0 if we can connect to this guard, or the time
                           * at which we last failed to connect to it. */
 
+  /**}@*/
+
   /** Path bias information for this guard. */
   guard_pathbias_t pb;
 };



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits