mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Simplify CHECK_DEFAULT() logic a little further.
Since each of these tests only applies to testing networks, put them all into a single block that checks for testing networks. (I recommend reviewing with the "diff -b" option, since the change is mostly indentation.)
This commit is contained in:
parent
8d84e10e87
commit
4413b030f2
@ -4487,41 +4487,42 @@ options_validate(or_options_t *old_options, or_options_t *options,
|
||||
"AlternateDirAuthority and AlternateBridgeAuthority configured.");
|
||||
}
|
||||
|
||||
/* Check for options that can only be changed from the defaults in testing
|
||||
networks. */
|
||||
or_options_t *dflt_options = options_new();
|
||||
options_init(dflt_options);
|
||||
#define CHECK_DEFAULT(arg) \
|
||||
STMT_BEGIN \
|
||||
if (!options->TestingTorNetwork && \
|
||||
!options->UsingTestNetworkDefaults_ && \
|
||||
!config_is_same(get_options_mgr(),options, \
|
||||
if (!config_is_same(get_options_mgr(),options, \
|
||||
dflt_options,#arg)) { \
|
||||
or_options_free(dflt_options); \
|
||||
REJECT(#arg " may only be changed in testing Tor " \
|
||||
"networks!"); \
|
||||
} STMT_END
|
||||
CHECK_DEFAULT(TestingV3AuthInitialVotingInterval);
|
||||
CHECK_DEFAULT(TestingV3AuthInitialVoteDelay);
|
||||
CHECK_DEFAULT(TestingV3AuthInitialDistDelay);
|
||||
CHECK_DEFAULT(TestingV3AuthVotingStartOffset);
|
||||
CHECK_DEFAULT(TestingAuthDirTimeToLearnReachability);
|
||||
CHECK_DEFAULT(TestingEstimatedDescriptorPropagationTime);
|
||||
CHECK_DEFAULT(TestingServerDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingServerConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeBootstrapDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientMaxIntervalWithoutRequest);
|
||||
CHECK_DEFAULT(TestingDirConnectionMaxStall);
|
||||
CHECK_DEFAULT(TestingAuthKeyLifetime);
|
||||
CHECK_DEFAULT(TestingLinkCertLifetime);
|
||||
CHECK_DEFAULT(TestingSigningKeySlop);
|
||||
CHECK_DEFAULT(TestingAuthKeySlop);
|
||||
CHECK_DEFAULT(TestingLinkKeySlop);
|
||||
} STMT_END
|
||||
|
||||
/* Check for options that can only be changed from the defaults in testing
|
||||
networks. */
|
||||
if (! options->TestingTorNetwork && !options->UsingTestNetworkDefaults_) {
|
||||
or_options_t *dflt_options = options_new();
|
||||
options_init(dflt_options);
|
||||
CHECK_DEFAULT(TestingV3AuthInitialVotingInterval);
|
||||
CHECK_DEFAULT(TestingV3AuthInitialVoteDelay);
|
||||
CHECK_DEFAULT(TestingV3AuthInitialDistDelay);
|
||||
CHECK_DEFAULT(TestingV3AuthVotingStartOffset);
|
||||
CHECK_DEFAULT(TestingAuthDirTimeToLearnReachability);
|
||||
CHECK_DEFAULT(TestingEstimatedDescriptorPropagationTime);
|
||||
CHECK_DEFAULT(TestingServerDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingServerConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientConsensusDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingBridgeBootstrapDownloadInitialDelay);
|
||||
CHECK_DEFAULT(TestingClientMaxIntervalWithoutRequest);
|
||||
CHECK_DEFAULT(TestingDirConnectionMaxStall);
|
||||
CHECK_DEFAULT(TestingAuthKeyLifetime);
|
||||
CHECK_DEFAULT(TestingLinkCertLifetime);
|
||||
CHECK_DEFAULT(TestingSigningKeySlop);
|
||||
CHECK_DEFAULT(TestingAuthKeySlop);
|
||||
CHECK_DEFAULT(TestingLinkKeySlop);
|
||||
or_options_free(dflt_options);
|
||||
}
|
||||
#undef CHECK_DEFAULT
|
||||
or_options_free(dflt_options);
|
||||
|
||||
if (!options->ClientDNSRejectInternalAddresses &&
|
||||
!(options->DirAuthorities ||
|
||||
|
Loading…
Reference in New Issue
Block a user