OBSOLETE("NoPublish"),
VAR("NodeFamily", LINELIST, NodeFamilies, NULL),
V(NumCPUs, UINT, "0"),
+ V(NumDirectoryGuards, UINT, "3"),
V(NumEntryGuards, UINT, "3"),
V(ORListenAddress, LINELIST, NULL),
VPORT(ORPort, LINELIST, NULL),
V(UpdateBridgesFromAuthority, BOOL, "0"),
V(UseBridges, BOOL, "0"),
V(UseEntryGuards, BOOL, "1"),
+ V(UseEntryGuardsAsDirGuards, BOOL, "1"),
V(UseMicrodescriptors, AUTOBOOL, "auto"),
V(User, STRING, NULL),
V(UserspaceIOCPBuffers, BOOL, "0"),
/* If guards are disabled, or directory guards are disabled, we can't
* use directory guards.
*/
- if (!options->UseEntryGuards)
+ if (!options->UseEntryGuards || !options->UseEntryGuardsAsDirGuards)
return 0;
/* If we're configured to fetch directory info aggressively or of a
* nonstandard type, don't use directory guards. */
pick_entry_guards(const or_options_t *options, int for_directory)
{
int changed = 0;
+ const int num_needed = for_directory ? options->NumDirectoryGuards :
+ options->NumEntryGuards;
tor_assert(entry_guards);
- while (num_live_entry_guards(for_directory) < options->NumEntryGuards) {
+ while (num_live_entry_guards(for_directory) < num_needed) {
if (!add_an_entry_guard(NULL, 0, 0, for_directory))
break;
changed = 1;
int need_capacity = state ? state->need_capacity : 0;
int preferred_min, consider_exit_family = 0;
int need_descriptor = !for_directory;
+ const int num_needed = for_directory ? options->NumDirectoryGuards :
+ options->NumEntryGuards;
/* Checking dirinfo_type isn't required yet, since we only choose directory
guards that can support microdescs, routerinfos, and networkstatuses, AND
entry_guards_set_from_config(options);
if (!entry_list_is_constrained(options) &&
- smartlist_len(entry_guards) < options->NumEntryGuards)
+ smartlist_len(entry_guards) < num_needed)
pick_entry_guards(options, for_directory);
retry:
* guard list without needing to. */
goto choose_and_finish;
}
- if (smartlist_len(live_entry_guards) >= options->NumEntryGuards)
+ if (smartlist_len(live_entry_guards) >= num_needed)
goto choose_and_finish; /* we have enough */
} SMARTLIST_FOREACH_END(entry);
int UseEntryGuards; /**< Boolean: Do we try to enter from a smallish number
* of fixed nodes? */
int NumEntryGuards; /**< How many entry guards do we try to establish? */
+ int UseEntryGuardsAsDirGuards; /** Boolean: Do we try to get directory info
+ * from a smallish number of fixed nodes? */
+ int NumDirectoryGuards; /**< How many dir guards do we try to establish? */
int RephistTrackTime; /**< How many seconds do we keep rephist info? */
int FastFirstHopPK; /**< If Tor believes it is safe, should we save a third
* of our PK time by sending CREATE_FAST cells? */