38 STMT_BEGIN *msg = tor_strdup(arg); return -1; STMT_END
39 #if defined(__GNUC__) && __GNUC__ <= 3
40 #define COMPLAIN(args...) \
41 STMT_BEGIN log_warn(LD_CONFIG, args); STMT_END
43 #define COMPLAIN(args, ...) \
44 STMT_BEGIN log_warn(LD_CONFIG, args, ##__VA_ARGS__); STMT_END
47 #define YES_IF_CHANGED_INT(opt) \
48 if (!CFG_EQ_INT(old_options, new_options, opt)) return 1;
82 REJECT(
"Failed to resolve/guess local address. See logs for details.");
85 REJECT(
"Authoritative directory servers must set ContactInfo");
88 log_info(
LD_CONFIG,
"Authoritative directory servers can't set "
89 "UseEntryGuards. Disabling.");
93 log_info(
LD_CONFIG,
"Authoritative directories always try to download "
94 "extra-info documents. Setting DownloadExtraInfo.");
99 REJECT(
"AuthoritativeDir is set, but none of "
100 "(Bridge/V3)AuthoritativeDir is set.");
112 if (!options->DirPort_set)
113 REJECT(
"Running as authoritative directory, but no DirPort set.");
115 if (!options->ORPort_set)
116 REJECT(
"Running as authoritative directory, but no ORPort set.");
119 REJECT(
"Running as authoritative directory, but ClientOnly also set.");
144 if (!authdir_mode_v3(options))
149 REJECT(
"V3AuthVoteDelay plus V3AuthDistDelay must be less than half "
150 "V3AuthVotingInterval");
156 REJECT(
"V3AuthVoteDelay is way too low.");
158 COMPLAIN(
"V3AuthVoteDelay is very low. "
159 "This may lead to failure to vote for a consensus.");
162 REJECT(
"V3AuthVoteDelay is way too low.");
169 REJECT(
"V3AuthDistDelay is way too low.");
171 COMPLAIN(
"V3AuthDistDelay is very low. "
172 "This may lead to missing votes in a consensus.");
175 REJECT(
"V3AuthDistDelay is way too low.");
180 REJECT(
"V3AuthNIntervalsValid must be at least 2.");
186 REJECT(
"V3AuthVotingInterval is insanely low.");
188 COMPLAIN(
"V3AuthVotingInterval is very low. "
189 "This may lead to failure to synchronise for a consensus.");
192 REJECT(
"V3AuthVotingInterval is insanely low.");
195 REJECT(
"V3AuthVotingInterval is insanely high.");
197 COMPLAIN(
"V3AuthVotingInterval does not divide evenly into 24 hours.");
226 if (!authdir_mode_v3(options))
230 < MIN_VOTE_INTERVAL_TESTING_INITIAL) {
231 REJECT(
"TestingV3AuthInitialVotingInterval is insanely low.");
233 REJECT(
"TestingV3AuthInitialVotingInterval does not divide evenly into "
238 REJECT(
"TestingV3AuthInitialVoteDelay is way too low.");
242 REJECT(
"TestingV3AuthInitialDistDelay is way too low.");
248 REJECT(
"TestingV3AuthInitialVoteDelay plus TestingV3AuthInitialDistDelay "
249 "must be less than TestingV3AuthInitialVotingInterval");
255 REJECT(
"TestingV3AuthVotingStartOffset is higher than the voting "
258 REJECT(
"TestingV3AuthVotingStartOffset must be non-negative.");
275 if (authdir_mode_v3(old_options) != authdir_mode_v3(new_options))
277 if (! authdir_mode_v3(new_options))
280 YES_IF_CHANGED_INT(V3AuthVotingInterval);
281 YES_IF_CHANGED_INT(V3AuthVoteDelay);
282 YES_IF_CHANGED_INT(V3AuthDistDelay);
283 YES_IF_CHANGED_INT(TestingV3AuthInitialVotingInterval);
284 YES_IF_CHANGED_INT(TestingV3AuthInitialVoteDelay);
285 YES_IF_CHANGED_INT(TestingV3AuthInitialDistDelay);
286 YES_IF_CHANGED_INT(TestingV3AuthVotingStartOffset);
363 bool *print_notice_out)
365 if (BUG(!print_notice_out))
371 time_t now = time(NULL);
372 int print_notice = 0;
379 *print_notice_out = 1;
410 "AuthDirFastGuarantee", msg_out) < 0)
413 "AuthDirGuardBWGuarantee", msg_out) < 0)
433 REJECT(
"Versioning authoritative dir servers must set "
434 "Recommended*Versions.");
445 COMPLAIN(
"TestingAuthDirTimeToLearnReachability is insanely high.");
452 #define CONF_CONTEXT TABLE
457 #define DIRAUTH_OPTIONS_MAGIC 0x41757448
464 .magic = {
"dirauth_options_t",
467 .vars = dirauth_options_t_vars,
int authdir_mode(const or_options_t *options)
int authdir_mode_bridge(const or_options_t *options)
Header file for directory authority mode.
int dirserv_read_measured_bandwidths(const char *from_file, smartlist_t *routerstatuses, smartlist_t *bw_file_headers, uint8_t *digest_out)
Header file for bwauth.c.
Macros for generating a configuration struct from a list of its individual fields.
int config_ensure_bandwidth_cap(uint64_t *value, const char *desc, char **msg)
const or_options_t * get_options(void)
Header file for config.c.
config_line_t * config_lines_dup(const config_line_t *inp)
int options_act_dirauth_mtbf(const or_options_t *old_options)
static int dirauth_options_validate(const void *arg, char **msg)
const config_format_t dirauth_options_fmt
bool dirauth_should_reject_requests_under_load(void)
int options_act_dirauth_stats(const or_options_t *old_options, bool *print_notice_out)
int options_validate_dirauth_mode(const or_options_t *old_options, or_options_t *options, char **msg)
static int options_transition_affects_dirauth_timing(const or_options_t *old_options, const or_options_t *new_options)
static int dirauth_options_pre_normalize(void *arg, char **msg_out)
int options_act_dirauth(const or_options_t *old_options)
#define DIRAUTH_OPTIONS_MAGIC
int options_validate_dirauth_testing(const or_options_t *old_options, or_options_t *options, char **msg)
int options_validate_dirauth_schedule(const or_options_t *old_options, or_options_t *options, char **msg)
Header for feature/dirauth/dirauth_config.c.
Declare configuration options for the crypto_ops module.
Structure dirauth_options_t to hold directory authority options.
void reschedule_dirvote(const or_options_t *options)
Header for dirauth_periodic.c.
Header for dirauth_sys.c.
char * format_recommended_version_list(const config_line_t *ln, int warn)
Header file for dirvote.c.
#define MIN_DIST_SECONDS_TESTING
#define MIN_VOTE_INTERVAL_TESTING
#define MIN_VOTE_INTERVAL
#define MIN_VOTE_SECONDS_TESTING
Header file for guardfraction.c.
int dirserv_read_guardfraction_file(const char *fname, smartlist_t *vote_routerstatuses)
Master header file for Tor-specific functionality.
void rep_hist_desc_stats_term(void)
int rep_hist_load_mtbf_data(time_t now)
void rep_hist_desc_stats_init(time_t now)
Header file for rephist.c.
bool find_my_address(const or_options_t *options, int family, int warn_severity, tor_addr_t *addr_out, resolved_addr_method_t *method_out, char **hostname_out)
Attempt to find our IP address that can be used as our external reachable address.
Header file for resolve_addr.c.
MEMUNIT AuthDirFastGuarantee
MEMUNIT AuthDirGuardBWGuarantee
INTERVAL TestingAuthDirTimeToLearnReachability
LINELIST RecommendedServerVersions
BOOL VersioningAuthoritativeDirectory
LINELIST RecommendedClientVersions
LINELIST RecommendedVersions
BOOL AuthDirRejectRequestsUnderLoad
int TestingV3AuthInitialDistDelay
int V3AuthNIntervalsValid
int TestingV3AuthInitialVotingInterval
int TestingV3AuthInitialVoteDelay
tor_cmdline_mode_t command
int BridgeAuthoritativeDir
int TestingV3AuthVotingStartOffset
void dirauth_sched_recalculate_timing(const or_options_t *options, time_t now)
Header file for voting_schedule.c.