mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-14 07:03:44 +01:00
Remove prop271 "spec deviation" comments -- the spec has been updated
In some cases, replace those comments with better ones.
This commit is contained in:
parent
088cc3604b
commit
ead934e61e
@ -367,9 +367,6 @@ get_max_sample_size_absolute(void)
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* We always try to make our sample contain at least this many guards.
|
* 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
|
STATIC int
|
||||||
get_min_filtered_sample_size(void)
|
get_min_filtered_sample_size(void)
|
||||||
@ -562,8 +559,8 @@ choose_guard_selection(const or_options_t *options,
|
|||||||
}
|
}
|
||||||
} SMARTLIST_FOREACH_END(node);
|
} SMARTLIST_FOREACH_END(node);
|
||||||
|
|
||||||
/* XXXX prop271 spec deviation -- separate 'high' and 'low' thresholds
|
/* We use separate 'high' and 'low' thresholds here to prevent flapping
|
||||||
* to prevent flapping */
|
* back and forth */
|
||||||
const int meaningful_threshold_high =
|
const int meaningful_threshold_high =
|
||||||
(int)(n_guards * get_meaningful_restriction_threshold() * 1.05);
|
(int)(n_guards * get_meaningful_restriction_threshold() * 1.05);
|
||||||
const int meaningful_threshold_mid =
|
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
|
/* The "GUARDS" set is all nodes in the nodelist for which this predicate
|
||||||
* holds. */
|
* holds. */
|
||||||
|
|
||||||
/* XXXX -- prop271 spec deviation. We require node_is_dir() here. */
|
|
||||||
tor_assert(node);
|
tor_assert(node);
|
||||||
return (node->is_possible_guard &&
|
return (node->is_possible_guard &&
|
||||||
node->is_stable &&
|
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 using_bridges = (gs->type == GS_TYPE_BRIDGE);
|
||||||
const int min_sample = get_min_filtered_sample_size();
|
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)
|
if (using_bridges)
|
||||||
return n_guards;
|
return n_guards;
|
||||||
|
|
||||||
const int max_sample_by_pct = (int)(n_guards * get_max_sample_threshold());
|
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_absolute = get_max_sample_size_absolute();
|
||||||
const int max_sample = MIN(max_sample_by_pct, max_sample_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;
|
return min_sample;
|
||||||
else
|
else
|
||||||
return max_sample;
|
return max_sample;
|
||||||
@ -1302,7 +1298,6 @@ node_passes_guard_filter(const or_options_t *options,
|
|||||||
if (routerset_contains_node(options->ExcludeNodes, node))
|
if (routerset_contains_node(options->ExcludeNodes, node))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* XXXX -- prop271 spec deviation -- add entrynodes to spec. */
|
|
||||||
if (options->EntryNodes &&
|
if (options->EntryNodes &&
|
||||||
!routerset_contains_node(options->EntryNodes, node))
|
!routerset_contains_node(options->EntryNodes, node))
|
||||||
return 0;
|
return 0;
|
||||||
@ -2310,6 +2305,13 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
|
|||||||
|
|
||||||
/* First look at the complete circuits: Do any block this circuit? */
|
/* First look at the complete circuits: Do any block this circuit? */
|
||||||
SMARTLIST_FOREACH_BEGIN(all_circuits, origin_circuit_t *, circ) {
|
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);
|
circuit_guard_state_t *state = origin_circuit_get_guard_state(circ);
|
||||||
if BUG((state == NULL))
|
if BUG((state == NULL))
|
||||||
continue;
|
continue;
|
||||||
@ -2322,9 +2324,6 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
|
|||||||
} SMARTLIST_FOREACH_END(circ);
|
} SMARTLIST_FOREACH_END(circ);
|
||||||
|
|
||||||
if (n_complete_blocking) {
|
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 "
|
log_debug(LD_GUARD, "Considered upgrading guard-stalled circuits: found "
|
||||||
"%d complete and %d guard-stalled. At least one complete "
|
"%d complete and %d guard-stalled. At least one complete "
|
||||||
"circuit had higher priority, so not upgrading.",
|
"circuit had higher priority, so not upgrading.",
|
||||||
@ -2332,14 +2331,10 @@ entry_guards_upgrade_waiting_circuits(guard_selection_t *gs,
|
|||||||
goto no_change;
|
goto no_change;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "If any circuit is <waiting_for_better_guard>, and every currently
|
/* " * If any circuit C1 is <waiting_for_better_guard>, AND:
|
||||||
{is_pending} circuit whose guard has higher priority has been in
|
* All primary guards have reachable status of <no>.
|
||||||
state <usable_if_no_better_guard> for at least
|
* There is no circuit C2 that "blocks" C1.
|
||||||
{NONPRIMARY_GUARD_CONNECT_TIMEOUT} seconds, and all primary guards
|
Then, upgrade C1 to <complete>.""
|
||||||
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.
|
|
||||||
*/
|
*/
|
||||||
int n_blockers_found = 0;
|
int n_blockers_found = 0;
|
||||||
const time_t state_set_at_cutoff =
|
const time_t state_set_at_cutoff =
|
||||||
@ -2687,7 +2682,6 @@ entry_guard_parse_from_state(const char *s)
|
|||||||
/* Take sampled_by_version verbatim. */
|
/* Take sampled_by_version verbatim. */
|
||||||
guard->sampled_by_version = sampled_by;
|
guard->sampled_by_version = sampled_by;
|
||||||
sampled_by = NULL; /* prevent free */
|
sampled_by = NULL; /* prevent free */
|
||||||
// XXXX -- prop271 spec deviation -- we do not require sampled_by_version
|
|
||||||
|
|
||||||
/* Listed is a boolean */
|
/* Listed is a boolean */
|
||||||
if (listed && strcmp(listed, "0"))
|
if (listed && strcmp(listed, "0"))
|
||||||
@ -3235,10 +3229,10 @@ guards_choose_guard(cpath_build_state_t *state,
|
|||||||
const node_t *r = NULL;
|
const node_t *r = NULL;
|
||||||
const uint8_t *exit_id = NULL;
|
const uint8_t *exit_id = NULL;
|
||||||
entry_guard_restriction_t *rst = 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))) {
|
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
|
/* 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));
|
rst = tor_malloc_zero(sizeof(entry_guard_restriction_t));
|
||||||
memcpy(rst->exclude_id, exit_id, DIGEST_LEN);
|
memcpy(rst->exclude_id, exit_id, DIGEST_LEN);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user