summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-11-27 13:19:54 -0500
committerNick Mathewson <nickm@torproject.org>2016-12-16 11:06:17 -0500
commit9493711077a0de1a704657b9645f0127e77455ed (patch)
tree426ed7ca1c6bdb88eda33ec18c7f5f629eeeb56e
parentd2af9826fd0a75efee8612b96709c39f24196f53 (diff)
downloadtor-9493711077a0de1a704657b9645f0127e77455ed.tar.gz
tor-9493711077a0de1a704657b9645f0127e77455ed.zip
Mark confirmed guards primary as appropriate.
If a guard becomes primary as a result of confirming it, consider the circuit through that guard as a primary circuit. Also, note open questions on behavior when confirming nonprimary guards
-rw-r--r--src/or/entrynodes.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index f1fe9f13c1..0650cbe963 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -1384,6 +1384,8 @@ entry_guards_note_guard_success(guard_selection_t *gs,
if (guard->confirmed_idx < 0) {
make_guard_confirmed(gs, guard);
+ if (!gs->primary_guards_up_to_date)
+ entry_guards_update_primary(gs);
}
unsigned new_state;
@@ -1392,7 +1394,19 @@ entry_guards_note_guard_success(guard_selection_t *gs,
} else {
tor_assert_nonfatal(
old_state == GUARD_CIRC_STATE_USABLE_IF_NO_BETTER_GUARD);
- new_state = GUARD_CIRC_STATE_WAITING_FOR_BETTER_GUARD;
+
+ if (guard->is_primary) {
+ /* XXXX prop271 -- I don't actually like this logic. It seems to make us
+ * a little more susceptible to evil-ISP attacks. The mitigations I'm
+ * thinking of, however, aren't local to this point, so I'll leave it
+ * alone. */
+ /* This guard may have become primary by virtue of being confirmed.
+ If so, the circuit for it is now complete.
+ */
+ new_state = GUARD_CIRC_STATE_COMPLETE;
+ } else {
+ new_state = GUARD_CIRC_STATE_WAITING_FOR_BETTER_GUARD;
+ }
if (last_time_on_internet + get_internet_likely_down_interval()
< approx_time()) {