mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Remove UseDeprecatedGuardAlgorithm.
This commit is contained in:
parent
472b277207
commit
a31a5581ee
@ -761,20 +761,13 @@ learned_bridge_descriptor(routerinfo_t *ri, int from_cache)
|
|||||||
fmt_and_decorate_addr(&bridge->addr),
|
fmt_and_decorate_addr(&bridge->addr),
|
||||||
(int) bridge->port);
|
(int) bridge->port);
|
||||||
}
|
}
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm) {
|
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
} else {
|
|
||||||
entry_guard_learned_bridge_identity(&bridge->addrport_configured,
|
entry_guard_learned_bridge_identity(&bridge->addrport_configured,
|
||||||
(const uint8_t*)ri->cache_info.identity_digest);
|
(const uint8_t*)ri->cache_info.identity_digest);
|
||||||
}
|
|
||||||
|
|
||||||
log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s", ri->nickname,
|
log_notice(LD_DIR, "new bridge descriptor '%s' (%s): %s", ri->nickname,
|
||||||
from_cache ? "cached" : "fresh", router_describe(ri));
|
from_cache ? "cached" : "fresh", router_describe(ri));
|
||||||
/* set entry->made_contact so if it goes down we don't drop it from
|
/* set entry->made_contact so if it goes down we don't drop it from
|
||||||
* our entry node list */
|
* our entry node list */
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm) {
|
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
}
|
|
||||||
if (first) {
|
if (first) {
|
||||||
routerlist_retry_directory_downloads(now);
|
routerlist_retry_directory_downloads(now);
|
||||||
}
|
}
|
||||||
|
@ -967,10 +967,7 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
|
|||||||
if (!hop) {
|
if (!hop) {
|
||||||
/* done building the circuit. whew. */
|
/* done building the circuit. whew. */
|
||||||
guard_usable_t r;
|
guard_usable_t r;
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm) {
|
if (! circ->guard_state) {
|
||||||
// The circuit is usable; we already marked the guard as okay.
|
|
||||||
r = GUARD_USABLE_NOW;
|
|
||||||
} else if (! circ->guard_state) {
|
|
||||||
if (circuit_get_cpath_len(circ) != 1 &&
|
if (circuit_get_cpath_len(circ) != 1 &&
|
||||||
circ->base_.purpose != CIRCUIT_PURPOSE_TESTING &&
|
circ->base_.purpose != CIRCUIT_PURPOSE_TESTING &&
|
||||||
get_options()->UseEntryGuards) {
|
get_options()->UseEntryGuards) {
|
||||||
|
@ -308,9 +308,6 @@ static config_var_t option_vars_[] = {
|
|||||||
V(ExtraInfoStatistics, BOOL, "1"),
|
V(ExtraInfoStatistics, BOOL, "1"),
|
||||||
V(ExtendByEd25519ID, AUTOBOOL, "auto"),
|
V(ExtendByEd25519ID, AUTOBOOL, "auto"),
|
||||||
V(FallbackDir, LINELIST, NULL),
|
V(FallbackDir, LINELIST, NULL),
|
||||||
/* XXXX prop271 -- this has an ugly name to remind us to remove it. */
|
|
||||||
VAR("UseDeprecatedGuardAlgorithm_", BOOL,
|
|
||||||
UseDeprecatedGuardAlgorithm, "0"),
|
|
||||||
|
|
||||||
V(UseDefaultFallbackDirs, BOOL, "1"),
|
V(UseDefaultFallbackDirs, BOOL, "1"),
|
||||||
|
|
||||||
@ -1578,7 +1575,6 @@ options_transition_affects_guards(const or_options_t *old,
|
|||||||
|
|
||||||
return
|
return
|
||||||
(old->UseEntryGuards != new->UseEntryGuards ||
|
(old->UseEntryGuards != new->UseEntryGuards ||
|
||||||
old->UseDeprecatedGuardAlgorithm != new->UseDeprecatedGuardAlgorithm ||
|
|
||||||
old->UseBridges != new->UseBridges ||
|
old->UseBridges != new->UseBridges ||
|
||||||
old->UseEntryGuards != new->UseEntryGuards ||
|
old->UseEntryGuards != new->UseEntryGuards ||
|
||||||
old->ClientUseIPv4 != new->ClientUseIPv4 ||
|
old->ClientUseIPv4 != new->ClientUseIPv4 ||
|
||||||
|
@ -546,10 +546,6 @@ choose_guard_selection(const or_options_t *options,
|
|||||||
{
|
{
|
||||||
tor_assert(options);
|
tor_assert(options);
|
||||||
tor_assert(type_out);
|
tor_assert(type_out);
|
||||||
if (options->UseDeprecatedGuardAlgorithm) {
|
|
||||||
*type_out = GS_TYPE_LEGACY;
|
|
||||||
return "legacy";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options->UseBridges) {
|
if (options->UseBridges) {
|
||||||
*type_out = GS_TYPE_BRIDGE;
|
*type_out = GS_TYPE_BRIDGE;
|
||||||
@ -2113,9 +2109,6 @@ entry_guard_pick_for_circuit(guard_selection_t *gs,
|
|||||||
guard_usable_t
|
guard_usable_t
|
||||||
entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
|
entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
|
||||||
{
|
{
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm)
|
|
||||||
return GUARD_USABLE_NOW;
|
|
||||||
|
|
||||||
if (BUG(*guard_state_p == NULL))
|
if (BUG(*guard_state_p == NULL))
|
||||||
return GUARD_USABLE_NEVER;
|
return GUARD_USABLE_NEVER;
|
||||||
|
|
||||||
@ -2143,8 +2136,6 @@ entry_guard_succeeded(circuit_guard_state_t **guard_state_p)
|
|||||||
void
|
void
|
||||||
entry_guard_cancel(circuit_guard_state_t **guard_state_p)
|
entry_guard_cancel(circuit_guard_state_t **guard_state_p)
|
||||||
{
|
{
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm)
|
|
||||||
return;
|
|
||||||
if (BUG(*guard_state_p == NULL))
|
if (BUG(*guard_state_p == NULL))
|
||||||
return;
|
return;
|
||||||
entry_guard_t *guard = entry_guard_handle_get((*guard_state_p)->guard);
|
entry_guard_t *guard = entry_guard_handle_get((*guard_state_p)->guard);
|
||||||
@ -2166,9 +2157,6 @@ entry_guard_cancel(circuit_guard_state_t **guard_state_p)
|
|||||||
void
|
void
|
||||||
entry_guard_failed(circuit_guard_state_t **guard_state_p)
|
entry_guard_failed(circuit_guard_state_t **guard_state_p)
|
||||||
{
|
{
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (BUG(*guard_state_p == NULL))
|
if (BUG(*guard_state_p == NULL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -2191,8 +2179,6 @@ entry_guard_chan_failed(channel_t *chan)
|
|||||||
{
|
{
|
||||||
if (!chan)
|
if (!chan)
|
||||||
return;
|
return;
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm)
|
|
||||||
return;
|
|
||||||
|
|
||||||
smartlist_t *pending = smartlist_new();
|
smartlist_t *pending = smartlist_new();
|
||||||
circuit_get_all_pending_on_channel(pending, chan);
|
circuit_get_all_pending_on_channel(pending, chan);
|
||||||
@ -3278,10 +3264,7 @@ const node_t *
|
|||||||
guards_choose_guard(cpath_build_state_t *state,
|
guards_choose_guard(cpath_build_state_t *state,
|
||||||
circuit_guard_state_t **guard_state_out)
|
circuit_guard_state_t **guard_state_out)
|
||||||
{
|
{
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm) {
|
if (1) {
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
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;
|
||||||
@ -3308,11 +3291,7 @@ const node_t *
|
|||||||
guards_choose_dirguard(dirinfo_type_t info,
|
guards_choose_dirguard(dirinfo_type_t info,
|
||||||
circuit_guard_state_t **guard_state_out)
|
circuit_guard_state_t **guard_state_out)
|
||||||
{
|
{
|
||||||
if (get_options()->UseDeprecatedGuardAlgorithm) {
|
if (1) {
|
||||||
(void)info;
|
|
||||||
tor_assert_nonfatal_unreached();
|
|
||||||
return NULL;
|
|
||||||
} else {
|
|
||||||
/* XXXX prop271 We don't need to look at the dirinfo_type_t here,
|
/* XXXX prop271 We don't need to look at the dirinfo_type_t here,
|
||||||
* apparently. If you look at the old implementation, and you follow info
|
* apparently. If you look at the old implementation, and you follow info
|
||||||
* downwards through choose_random_dirguard(), into
|
* downwards through choose_random_dirguard(), into
|
||||||
@ -3320,6 +3299,7 @@ guards_choose_dirguard(dirinfo_type_t info,
|
|||||||
* find out that it isn't even used, and hasn't been since 0.2.7.1-alpha,
|
* find out that it isn't even used, and hasn't been since 0.2.7.1-alpha,
|
||||||
* when we realized that every Tor on the network would support
|
* when we realized that every Tor on the network would support
|
||||||
* microdescriptors. -NM */
|
* microdescriptors. -NM */
|
||||||
|
(void) info;
|
||||||
const node_t *r = NULL;
|
const node_t *r = NULL;
|
||||||
if (entry_guard_pick_for_circuit(get_guard_selection_info(),
|
if (entry_guard_pick_for_circuit(get_guard_selection_info(),
|
||||||
GUARD_USAGE_DIRGUARD,
|
GUARD_USAGE_DIRGUARD,
|
||||||
|
@ -4574,14 +4574,6 @@ typedef struct {
|
|||||||
* do we enforce Ed25519 identity match? */
|
* do we enforce Ed25519 identity match? */
|
||||||
/* NOTE: remove this option someday. */
|
/* NOTE: remove this option someday. */
|
||||||
int AuthDirTestEd25519LinkKeys;
|
int AuthDirTestEd25519LinkKeys;
|
||||||
|
|
||||||
/** If 1, we use the old (pre-prop271) guard selection algorithm.
|
|
||||||
*
|
|
||||||
* XXXX prop271 This option is only here as a stopgap while we're
|
|
||||||
* XXXX tuning and debugging the new (post-prop271) algorithm. Eventually
|
|
||||||
* we should remove it entirely.
|
|
||||||
*/
|
|
||||||
int UseDeprecatedGuardAlgorithm;
|
|
||||||
} or_options_t;
|
} or_options_t;
|
||||||
|
|
||||||
/** Persistent state for an onion router, as saved to disk. */
|
/** Persistent state for an onion router, as saved to disk. */
|
||||||
|
@ -789,17 +789,6 @@ test_entry_guard_get_guard_selection_by_name(void *arg)
|
|||||||
tt_assert(gs3 != gs1);
|
tt_assert(gs3 != gs1);
|
||||||
tt_assert(gs3 == get_guard_selection_info());
|
tt_assert(gs3 == get_guard_selection_info());
|
||||||
|
|
||||||
or_options_t *options = get_options_mutable();
|
|
||||||
options->UseDeprecatedGuardAlgorithm = 1;
|
|
||||||
update_guard_selection_choice(options);
|
|
||||||
guard_selection_t *gs4 = get_guard_selection_info();
|
|
||||||
tt_assert(gs4 != gs3);
|
|
||||||
tt_assert(gs4 == get_guard_selection_by_name("legacy", GS_TYPE_LEGACY, 1));
|
|
||||||
|
|
||||||
options->UseDeprecatedGuardAlgorithm = 0;
|
|
||||||
update_guard_selection_choice(options);
|
|
||||||
tt_assert(gs3 == get_guard_selection_info());
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
entry_guards_free_all();
|
entry_guards_free_all();
|
||||||
}
|
}
|
||||||
@ -824,14 +813,6 @@ test_entry_guard_choose_selection_initial(void *arg)
|
|||||||
tt_int_op(type, OP_EQ, GS_TYPE_BRIDGE);
|
tt_int_op(type, OP_EQ, GS_TYPE_BRIDGE);
|
||||||
get_options_mutable()->UseBridges = 0;
|
get_options_mutable()->UseBridges = 0;
|
||||||
|
|
||||||
/* If we're using legacy guards, we get the legacy selection */
|
|
||||||
get_options_mutable()->UseDeprecatedGuardAlgorithm = 1;
|
|
||||||
name = choose_guard_selection(get_options(),
|
|
||||||
dummy_consensus, NULL, &type);
|
|
||||||
tt_str_op(name, OP_EQ, "legacy");
|
|
||||||
tt_int_op(type, OP_EQ, GS_TYPE_LEGACY);
|
|
||||||
get_options_mutable()->UseDeprecatedGuardAlgorithm = 0;
|
|
||||||
|
|
||||||
/* If we discard >99% of our guards, though, we should be in the restricted
|
/* If we discard >99% of our guards, though, we should be in the restricted
|
||||||
* set. */
|
* set. */
|
||||||
tt_assert(get_options_mutable()->EntryNodes == NULL);
|
tt_assert(get_options_mutable()->EntryNodes == NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user