summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/or/control.c2
-rw-r--r--src/or/entrynodes.c43
-rw-r--r--src/or/entrynodes.h4
-rw-r--r--src/test/test_entrynodes.c4
4 files changed, 18 insertions, 35 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 857b7325ae..2c71ea5bb9 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -2598,7 +2598,7 @@ getinfo_helper_events(control_connection_t *control_conn,
if (circ->base_.state == CIRCUIT_STATE_OPEN)
state = "BUILT";
else if (circ->base_.state == CIRCUIT_STATE_GUARD_WAIT)
- state = "GUARD_WAIT"; // XXXX prop271 spec deviation-- specify this.
+ state = "GUARD_WAIT";
else if (circ->cpath)
state = "EXTENDED";
else
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 63b54f41f0..c5fb92e35a 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -367,9 +367,6 @@ get_max_sample_size_absolute(void)
}
/**
* We always try to make our sample contain at least this many guards.
- *
- * XXXX prop271 spec deviation There was a MIN_SAMPLE_THRESHOLD in the
- * proposal, but I removed it in favor of MIN_FILTERED_SAMPLE_SIZE. -NM
*/
STATIC int
get_min_filtered_sample_size(void)
@@ -562,8 +559,8 @@ choose_guard_selection(const or_options_t *options,
}
} SMARTLIST_FOREACH_END(node);
- /* XXXX prop271 spec deviation -- separate 'high' and 'low' thresholds
- * to prevent flapping */
+ /* We use separate 'high' and 'low' thresholds here to prevent flapping
+ * back and forth */
const int meaningful_threshold_high =
(int)(n_guards * get_meaningful_restriction_threshold() * 1.05);
const int meaningful_threshold_mid =
@@ -682,7 +679,6 @@ node_is_possible_guard(const node_t *node)
/* The "GUARDS" set is all nodes in the nodelist for which this predicate
* holds. */
- /* XXXX -- prop271 spec deviation. We require node_is_dir() here. */
tor_assert(node);
return (node->is_possible_guard &&
node->is_stable &&
@@ -936,14 +932,14 @@ get_max_sample_size(guard_selection_t *gs,
const int using_bridges = (gs->type == GS_TYPE_BRIDGE);
const int min_sample = get_min_filtered_sample_size();
- /* XXXX prop271 spec deviation with bridges, max_sample is "all of them" */
+ /* With bridges, max_sample is "all of them" */
if (using_bridges)
return n_guards;
const int max_sample_by_pct = (int)(n_guards * get_max_sample_threshold());
const int max_sample_absolute = get_max_sample_size_absolute();
const int max_sample = MIN(max_sample_by_pct, max_sample_absolute);
- if (max_sample < min_sample) // XXXX prop271 spec deviation
+ if (max_sample < min_sample)
return min_sample;
else
return max_sample;
@@ -1161,7 +1157,6 @@ entry_guard_is_listed,(guard_selection_t *gs, const entry_guard_t *guard))
STATIC void
sampled_guards_update_from_consensus(guard_selection_t *gs)
{
- /*XXXX prop271 consider splitting this function up. */
tor_assert(gs);
const int REMOVE_UNLISTED_GUARDS_AFTER =
(get_remove_unlisted_guards_after_days() * 86400);
@@ -1302,7 +1297,6 @@ node_passes_guard_filter(const or_options_t *options,
if (routerset_contains_node(options->ExcludeNodes, node))
return 0;
- /* XXXX -- prop271 spec deviation -- add entrynodes to spec. */
if (options->EntryNodes &&
!routerset_contains_node(options->EntryNodes, node))
return 0;
@@ -1586,7 +1580,6 @@ make_guard_confirmed(guard_selection_t *gs, entry_guard_t *guard)
STATIC void
entry_guards_update_primary(guard_selection_t *gs)
{
- /*XXXX prop271 consider splitting this function up. */
tor_assert(gs);
// prevent recursion. Recursion is potentially very bad here.
@@ -1784,7 +1777,6 @@ select_entry_guard_for_circuit(guard_selection_t *gs,
const entry_guard_restriction_t *rst,
unsigned *state_out)
{
- /*XXXX prop271 consider splitting this function up. */
tor_assert(gs);
tor_assert(state_out);
@@ -2310,6 +2302,13 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
/* First look at the complete circuits: Do any block this circuit? */
SMARTLIST_FOREACH_BEGIN(all_circuits, origin_circuit_t *, circ) {
+ /* "C2 "blocks" C1 if:
+ * C2 obeys all the restrictions that C1 had to obey, AND
+ * C2 has higher priority than C1, AND
+ * Either C2 is <complete>, or C2 is <waiting_for_better_guard>,
+ or C2 has been <usable_if_no_better_guard> for no more than
+ {NONPRIMARY_GUARD_CONNECT_TIMEOUT} seconds."
+ */
circuit_guard_state_t *state = origin_circuit_get_guard_state(circ);
if BUG((state == NULL))
continue;
@@ -2322,9 +2321,6 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
} SMARTLIST_FOREACH_END(circ);
if (n_complete_blocking) {
- /* "If any circuit is <complete>, then do not use any
- <waiting_for_better_guard> or <usable_if_no_better_guard> circuits
- circuits whose guards have lower priority." */
log_debug(LD_GUARD, "Considered upgrading guard-stalled circuits: found "
"%d complete and %d guard-stalled. At least one complete "
"circuit had higher priority, so not upgrading.",
@@ -2332,14 +2328,10 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
goto no_change;
}
- /* "If any circuit is <waiting_for_better_guard>, and every currently
- {is_pending} circuit whose guard has higher priority has been in
- state <usable_if_no_better_guard> for at least
- {NONPRIMARY_GUARD_CONNECT_TIMEOUT} seconds, and all primary guards
- have reachable status of <no>, then call that circuit <complete>."
-
- XXXX --- prop271 deviation. there's no such thing in the spec as
- an {is_pending circuit}; fix the spec.
+ /* " * If any circuit C1 is <waiting_for_better_guard>, AND:
+ * All primary guards have reachable status of <no>.
+ * There is no circuit C2 that "blocks" C1.
+ Then, upgrade C1 to <complete>.""
*/
int n_blockers_found = 0;
const time_t state_set_at_cutoff =
@@ -2687,7 +2679,6 @@ entry_guard_parse_from_state(const char *s)
/* Take sampled_by_version verbatim. */
guard->sampled_by_version = sampled_by;
sampled_by = NULL; /* prevent free */
- // XXXX -- prop271 spec deviation -- we do not require sampled_by_version
/* Listed is a boolean */
if (listed && strcmp(listed, "0"))
@@ -3235,10 +3226,10 @@ guards_choose_guard(cpath_build_state_t *state,
const node_t *r = NULL;
const uint8_t *exit_id = NULL;
entry_guard_restriction_t *rst = NULL;
- // XXXX prop271 spec deviation -- use of restriction here.
if (state && (exit_id = build_state_get_exit_rsa_id(state))) {
/* We're building to a targeted exit node, so that node can't be
- * chosen as our guard for this circuit. */
+ * chosen as our guard for this circuit. Remember that fact in a
+ * restriction. */
rst = tor_malloc_zero(sizeof(entry_guard_restriction_t));
memcpy(rst->exclude_id, exit_id, DIGEST_LEN);
}
diff --git a/src/or/entrynodes.h b/src/or/entrynodes.h
index bd501d001f..d469df7e3d 100644
--- a/src/or/entrynodes.h
+++ b/src/or/entrynodes.h
@@ -392,9 +392,6 @@ int num_bridges_usable(void);
#define DFLT_MAX_SAMPLE_SIZE 60
/**
* We always try to make our sample contain at least this many guards.
- *
- * XXXX prop271 There was a MIN_SAMPLE_THRESHOLD in the proposal, but I
- * removed it in favor of MIN_FILTERED_SAMPLE_SIZE. -NM
*/
#define DFLT_MIN_FILTERED_SAMPLE_SIZE 20
/**
@@ -466,7 +463,6 @@ STATIC int get_nonprimary_guard_idle_timeout(void);
STATIC double get_meaningful_restriction_threshold(void);
STATIC double get_extreme_restriction_threshold(void);
-// ---------- XXXX these functions and definitions are post-prop271.
HANDLE_DECL(entry_guard, entry_guard_t, STATIC)
STATIC guard_selection_type_t guard_selection_infer_type(
guard_selection_type_t type_in,
diff --git a/src/test/test_entrynodes.c b/src/test/test_entrynodes.c
index bcb56e3a6b..249fd1f973 100644
--- a/src/test/test_entrynodes.c
+++ b/src/test/test_entrynodes.c
@@ -2044,7 +2044,6 @@ test_entry_guard_select_for_circuit_highlevel_confirm_other(void *arg)
u = entry_guard_succeeded(&guard);
/* We're on the internet (by fiat), so this guard will get called "confirmed"
* and should immediately become primary.
- * XXXX prop271 -- I don't like that behavior, but it's what is specified
*/
tt_int_op(guard->state, OP_EQ, GUARD_CIRC_STATE_COMPLETE);
tt_assert(u == GUARD_USABLE_NOW);
@@ -2338,9 +2337,6 @@ test_entry_guard_upgrade_a_circuit(void *arg)
* primary guards are down, we have two WAITING circuits: one will
* get upgraded to COMPLETED! (The one that started first.)
*/
- /* XXXX prop271 -- perhaps the one that started first should
- * also wind up in confirmed_entry_guards earlier?
- */
smartlist_t *result = smartlist_new();
int r;