From ea91edff15014eb24458cb0309e22d761cb170c1 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 19 Dec 2019 08:24:46 -0500 Subject: Dirauth options: move versioning options to dirauth module This commit moves VersioningAuthoritativeDirectory, RecommendedClientVersions, and RecommendedServerVersions. --- src/test/test_options.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/test/test_options.c') diff --git a/src/test/test_options.c b/src/test/test_options.c index e3b86c81ad..fe21cc96fd 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -10,6 +10,8 @@ #include "lib/confmgt/confmgt.h" #include "app/config/config.h" #include "feature/dirauth/dirauth_config.h" +#include "feature/dirauth/dirauth_options_st.h" +#include "feature/dirauth/dirauth_sys.h" #include "feature/relay/relay_config.h" #include "test/test.h" #include "lib/geoip/geoip.h" @@ -752,6 +754,14 @@ test_options_validate__logs(void *ignored) /* return config_line; */ /* } */ +static dirauth_options_t * +get_dirauth_options(or_options_t *opt) +{ + int idx = subsystems_get_options_idx(&sys_dirauth); + tor_assert(idx >= 0); + return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); +} + static void test_options_validate__authdir(void *ignored) { @@ -762,6 +772,7 @@ test_options_validate__authdir(void *ignored) options_test_data_t *tdata = get_options_test_data( ENABLE_AUTHORITY_V3_MIN "Address this.should.not!exist!.example.org"); + const dirauth_options_t *da_opt; sandbox_disable_getaddrinfo_cache(); @@ -820,8 +831,9 @@ test_options_validate__authdir(void *ignored) "RecommendedVersions 1.2, 3.14\n"); mock_clean_saved_logs(); options_validate(NULL, tdata->opt, &msg); - tt_str_op(tdata->opt->RecommendedClientVersions->value, OP_EQ, "1.2, 3.14"); - tt_str_op(tdata->opt->RecommendedServerVersions->value, OP_EQ, "1.2, 3.14"); + da_opt = get_dirauth_options(tdata->opt); + tt_str_op(da_opt->RecommendedClientVersions->value, OP_EQ, "1.2, 3.14"); + tt_str_op(da_opt->RecommendedServerVersions->value, OP_EQ, "1.2, 3.14"); tor_free(msg); free_options_test_data(tdata); @@ -831,8 +843,9 @@ test_options_validate__authdir(void *ignored) "RecommendedServerVersions 4.18\n"); mock_clean_saved_logs(); options_validate(NULL, tdata->opt, &msg); - tt_str_op(tdata->opt->RecommendedClientVersions->value, OP_EQ, "25"); - tt_str_op(tdata->opt->RecommendedServerVersions->value, OP_EQ, "4.18"); + da_opt = get_dirauth_options(tdata->opt); + tt_str_op(da_opt->RecommendedClientVersions->value, OP_EQ, "25"); + tt_str_op(da_opt->RecommendedServerVersions->value, OP_EQ, "4.18"); tor_free(msg); free_options_test_data(tdata); @@ -843,6 +856,7 @@ test_options_validate__authdir(void *ignored) "RecommendedServerVersions 4.18\n"); mock_clean_saved_logs(); options_validate(NULL, tdata->opt, &msg); + da_opt = get_dirauth_options(tdata->opt); tt_str_op(msg, OP_EQ, "AuthoritativeDir is set, but none of (Bridge/V3)" "AuthoritativeDir is set."); tor_free(msg); @@ -853,6 +867,7 @@ test_options_validate__authdir(void *ignored) "RecommendedServerVersions 4.18\n"); mock_clean_saved_logs(); options_validate(NULL, tdata->opt, &msg); + da_opt = get_dirauth_options(tdata->opt); tt_str_op(msg, OP_EQ, "Versioning authoritative dir servers must set " "Recommended*Versions."); tor_free(msg); @@ -863,9 +878,11 @@ test_options_validate__authdir(void *ignored) "RecommendedClientVersions 4.18\n"); mock_clean_saved_logs(); options_validate(NULL, tdata->opt, &msg); + da_opt = get_dirauth_options(tdata->opt); tt_str_op(msg, OP_EQ, "Versioning authoritative dir servers must set " "Recommended*Versions."); tor_free(msg); + da_opt = NULL; free_options_test_data(tdata); tdata = get_options_test_data(ENABLE_AUTHORITY_V3 -- cgit v1.2.3-54-g00ecf From bc0f1076d53e57d1a4ba19170a1c27d9eaee34e8 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 19 Dec 2019 09:18:03 -0500 Subject: Move get_foo_options() test helpers into a new test module. Some of these helpers will be needed in multiple places in the unit tests, so we should move them now. --- src/test/include.am | 2 ++ src/test/opts_test_helpers.c | 38 ++++++++++++++++++++++++++++++++++++++ src/test/opts_test_helpers.h | 22 ++++++++++++++++++++++ src/test/test_options.c | 17 +---------------- 4 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 src/test/opts_test_helpers.c create mode 100644 src/test/opts_test_helpers.h (limited to 'src/test/test_options.c') diff --git a/src/test/include.am b/src/test/include.am index 94352c8644..210f575db0 100644 --- a/src/test/include.am +++ b/src/test/include.am @@ -107,6 +107,7 @@ src_test_test_SOURCES += \ src/test/fakecircs.c \ src/test/log_test_helpers.c \ src/test/hs_test_helpers.c \ + src/test/opts_test_helpers.c \ src/test/rend_test_helpers.c \ src/test/resolve_test_helpers.c \ src/test/rng_test_helpers.c \ @@ -351,6 +352,7 @@ noinst_HEADERS+= \ src/test/fakecircs.h \ src/test/hs_test_helpers.h \ src/test/log_test_helpers.h \ + src/test/opts_test_helpers.h \ src/test/rend_test_helpers.h \ src/test/resolve_test_helpers.h \ src/test/rng_test_helpers.h \ diff --git a/src/test/opts_test_helpers.c b/src/test/opts_test_helpers.c new file mode 100644 index 0000000000..619ca40733 --- /dev/null +++ b/src/test/opts_test_helpers.c @@ -0,0 +1,38 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2019, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * @file opts_testing_helpers.c + * @brief Helper functions to access module-specific config options. + **/ + +#include "orconfig.h" +#include "test/opts_test_helpers.h" + +#define CONFIG_PRIVATE +#include "core/or/or.h" +#include "lib/confmgt/confmgt.h" +#include "app/main/subsysmgr.h" +#include "app/config/config.h" + +#include "lib/crypt_ops/crypto_sys.h" +#include "feature/dirauth/dirauth_sys.h" + +struct dirauth_options_t * +get_dirauth_options(struct or_options_t *opt) +{ + int idx = subsystems_get_options_idx(&sys_dirauth); + tor_assert(idx >= 0); + return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); +} + +struct crypto_options_t * +get_crypto_options(struct or_options_t *opt) +{ + int idx = subsystems_get_options_idx(&sys_crypto); + tor_assert(idx >= 0); + return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); +} diff --git a/src/test/opts_test_helpers.h b/src/test/opts_test_helpers.h new file mode 100644 index 0000000000..f925194e63 --- /dev/null +++ b/src/test/opts_test_helpers.h @@ -0,0 +1,22 @@ +/* Copyright (c) 2001 Matej Pfajfar. + * Copyright (c) 2001-2004, Roger Dingledine. + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson. + * Copyright (c) 2007-2019, The Tor Project, Inc. */ +/* See LICENSE for licensing information */ + +/** + * @file opts_testing_helpers.h + * @brief Header for test/opts_test_helpers.c + **/ + +#ifndef TOR_TEST_OPTS_TESTING_HELPERS_H +#define TOR_TEST_OPTS_TESTING_HELPERS_H + +struct crypto_options_t; +struct dirauth_options_t; +struct or_options_t; + +struct crypto_options_t *get_crypto_options(struct or_options_t *opt); +struct dirauth_options_t *get_dirauth_options(struct or_options_t *opt); + +#endif /* !defined(TOR_TEST_OPTS_TESTING_HELPERS_H) */ diff --git a/src/test/test_options.c b/src/test/test_options.c index fe21cc96fd..1649a25861 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -31,6 +31,7 @@ #include "lib/encoding/confline.h" #include "core/or/policies.h" #include "test/test_helpers.h" +#include "test/opts_test_helpers.h" #include "lib/net/resolve.h" #ifdef HAVE_SYS_PARAM_H @@ -754,14 +755,6 @@ test_options_validate__logs(void *ignored) /* return config_line; */ /* } */ -static dirauth_options_t * -get_dirauth_options(or_options_t *opt) -{ - int idx = subsystems_get_options_idx(&sys_dirauth); - tor_assert(idx >= 0); - return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); -} - static void test_options_validate__authdir(void *ignored) { @@ -4005,14 +3998,6 @@ test_options_validate__testing_options(void *ignored) tor_free(msg); } -static crypto_options_t * -get_crypto_options(or_options_t *opt) -{ - int idx = subsystems_get_options_idx(&sys_crypto); - tor_assert(idx >= 0); - return config_mgr_get_obj_mutable(get_options_mgr(), opt, idx); -} - static void test_options_validate__accel(void *ignored) { -- cgit v1.2.3-54-g00ecf From 77dea66e19404a4c07f0e738efb7710f542037ed Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 19 Dec 2019 09:43:25 -0500 Subject: Move MinUptimeHidServDirectoryV2 to dirauth module. --- src/app/config/config.c | 1 - src/app/config/or_options_st.h | 3 --- src/feature/dirauth/dirauth_config.c | 12 ++++++------ src/feature/dirauth/dirauth_options.inc | 4 ++++ src/feature/dirauth/voteflags.c | 6 +++--- src/test/test_options.c | 5 +++-- 6 files changed, 16 insertions(+), 15 deletions(-) (limited to 'src/test/test_options.c') diff --git a/src/app/config/config.c b/src/app/config/config.c index 06a0110e4a..4b47894cc1 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -712,7 +712,6 @@ static const config_var_t option_vars_[] = { OwningControllerProcess, NULL), VAR_NODUMP_IMMUTABLE("__OwningControllerFD", UINT64, OwningControllerFD, UINT64_MAX_STRING), - V(MinUptimeHidServDirectoryV2, INTERVAL, "96 hours"), V(TestingServerDownloadInitialDelay, CSV_INTERVAL, "0"), V(TestingClientDownloadInitialDelay, CSV_INTERVAL, "0"), V(TestingServerConsensusDownloadInitialDelay, CSV_INTERVAL, "0"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 46c709622d..09edc21a79 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -257,9 +257,6 @@ struct or_options_t { int FetchServerDescriptors; /**< Do we fetch server descriptors as normal? */ int FetchHidServDescriptors; /**< and hidden service descriptors? */ - int MinUptimeHidServDirectoryV2; /**< As directory authority, accept hidden - * service directories after what time? */ - int FetchUselessDescriptors; /**< Do we fetch non-running descriptors too? */ int AllDirActionsPrivate; /**< Should every directory action be sent * through a Tor circuit? */ diff --git a/src/feature/dirauth/dirauth_config.c b/src/feature/dirauth/dirauth_config.c index ccece9721d..e3f06e9e8a 100644 --- a/src/feature/dirauth/dirauth_config.c +++ b/src/feature/dirauth/dirauth_config.c @@ -108,12 +108,6 @@ options_validate_dirauth_mode(const or_options_t *old_options, if (options->ClientOnly) REJECT("Running as authoritative directory, but ClientOnly also set."); - if (options->MinUptimeHidServDirectoryV2 < 0) { - log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at " - "least 0 seconds. Changing to 0."); - options->MinUptimeHidServDirectoryV2 = 0; - } - return 0; } @@ -415,6 +409,12 @@ dirauth_options_pre_normalize(void *arg, char **msg_out) "AuthDirGuardBWGuarantee", msg_out) < 0) return -1; + if (options->MinUptimeHidServDirectoryV2 < 0) { + log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at " + "least 0 seconds. Changing to 0."); + options->MinUptimeHidServDirectoryV2 = 0; + } + return 0; } diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc index ca70a51b9e..f0aadb006f 100644 --- a/src/feature/dirauth/dirauth_options.inc +++ b/src/feature/dirauth/dirauth_options.inc @@ -44,6 +44,10 @@ CONF_VAR(AuthDirSharedRandomness, BOOL, 0, "1") /* NOTE: remove this option someday. */ CONF_VAR(AuthDirTestEd25519LinkKeys, BOOL, 0, "1") +/** As directory authority, accept hidden service directories after what + * time? */ +CONF_VAR(MinUptimeHidServDirectoryV2, INTERVAL, 0, "96 hours") + /** Which versions of tor should we tell users to run? */ CONF_VAR(RecommendedVersions, LINELIST, 0, NULL) diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 8b9b8bc5c1..d0bc30d4c9 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -177,14 +177,14 @@ dirserv_thinks_router_is_hs_dir(const routerinfo_t *router, long uptime; /* If we haven't been running for at least - * get_options()->MinUptimeHidServDirectoryV2 seconds, we can't + * MinUptimeHidServDirectoryV2 seconds, we can't * have accurate data telling us a relay has been up for at least * that long. We also want to allow a bit of slack: Reachability * tests aren't instant. If we haven't been running long enough, * trust the relay. */ if (get_uptime() > - get_options()->MinUptimeHidServDirectoryV2 * 1.1) + dirauth_get_options()->MinUptimeHidServDirectoryV2 * 1.1) uptime = MIN(rep_hist_get_uptime(router->cache_info.identity_digest, now), real_uptime(router, now)); else @@ -193,7 +193,7 @@ dirserv_thinks_router_is_hs_dir(const routerinfo_t *router, return (router->wants_to_be_hs_dir && router->supports_tunnelled_dir_requests && node->is_stable && node->is_fast && - uptime >= get_options()->MinUptimeHidServDirectoryV2 && + uptime >= dirauth_get_options()->MinUptimeHidServDirectoryV2 && router_is_active(router, node, now)); } diff --git a/src/test/test_options.c b/src/test/test_options.c index 1649a25861..3465207166 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -994,13 +994,14 @@ test_options_validate__authdir(void *ignored) free_options_test_data(tdata); tdata = get_options_test_data(ENABLE_AUTHORITY_V3); /* We have to set this value manually, because it won't parse */ - tdata->opt->MinUptimeHidServDirectoryV2 = -1; + get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2 = -1; mock_clean_saved_logs(); ret = options_validate(NULL, tdata->opt, &msg); tt_int_op(ret, OP_EQ, 0); expect_log_msg("MinUptimeHidServDirectoryV2 " "option must be at least 0 seconds. Changing to 0.\n"); - tt_int_op(tdata->opt->MinUptimeHidServDirectoryV2, OP_EQ, 0); + tt_int_op(get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2, + OP_EQ, 0); tor_free(msg); done: -- cgit v1.2.3-54-g00ecf From cde5abfdc6381e618f9649dd00f74d91d65848d7 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 19 Dec 2019 10:00:25 -0500 Subject: Move TestingDirAuthTimeToLearnReachability into dirauth module. --- src/app/config/config.c | 1 - src/app/config/or_options_st.h | 5 ----- src/feature/dirauth/dirauth_config.c | 12 ++++++------ src/feature/dirauth/dirauth_options.inc | 5 +++++ src/feature/dirauth/voteflags.c | 5 +++-- src/test/test_options.c | 31 +++++++++++++++++-------------- 6 files changed, 31 insertions(+), 28 deletions(-) (limited to 'src/test/test_options.c') diff --git a/src/app/config/config.c b/src/app/config/config.c index 262013de4c..3e1549b705 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -392,7 +392,6 @@ static const config_var_t option_vars_[] = { V(DisableOOSCheck, BOOL, "1"), V(DisableNetwork, BOOL, "0"), V(DirAllowPrivateAddresses, BOOL, "0"), - V(TestingAuthDirTimeToLearnReachability, INTERVAL, "30 minutes"), OBSOLETE("DirListenAddress"), V(DirPolicy, LINELIST, NULL), VPORT(DirPort), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 2796aaba78..a38eae40f6 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -686,11 +686,6 @@ struct or_options_t { voting. Only altered on testing networks. */ int TestingV3AuthVotingStartOffset; - /** If an authority has been around for less than this amount of time, it - * does not believe its reachability information is accurate. Only - * altered on testing networks. */ - int TestingAuthDirTimeToLearnReachability; - /** Clients don't download any descriptor this recent, since it will * probably not have propagated to enough caches. Only altered on testing * networks. */ diff --git a/src/feature/dirauth/dirauth_config.c b/src/feature/dirauth/dirauth_config.c index e3f06e9e8a..4a3f569966 100644 --- a/src/feature/dirauth/dirauth_config.c +++ b/src/feature/dirauth/dirauth_config.c @@ -213,12 +213,6 @@ options_validate_dirauth_testing(const or_options_t *old_options, if (!authdir_mode(options)) return 0; - if (options->TestingAuthDirTimeToLearnReachability < 0) { - REJECT("TestingAuthDirTimeToLearnReachability must be non-negative."); - } else if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) { - COMPLAIN("TestingAuthDirTimeToLearnReachability is insanely high."); - } - if (!authdir_mode_v3(options)) return 0; @@ -443,6 +437,12 @@ dirauth_options_validate(const void *arg, char **msg) t = format_recommended_version_list(options->RecommendedServerVersions, 1); tor_free(t); + if (options->TestingAuthDirTimeToLearnReachability < 0) { + REJECT("TestingAuthDirTimeToLearnReachability must be non-negative."); + } else if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) { + COMPLAIN("TestingAuthDirTimeToLearnReachability is insanely high."); + } + return 0; } diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc index d5ae09cf27..e1550a6e90 100644 --- a/src/feature/dirauth/dirauth_options.inc +++ b/src/feature/dirauth/dirauth_options.inc @@ -65,6 +65,11 @@ CONF_VAR(RecommendedClientVersions, LINELIST, 0, NULL) /** Which versions of tor should we tell users to run on relays? */ CONF_VAR(RecommendedServerVersions, LINELIST, 0, NULL) +/** If an authority has been around for less than this amount of time, it + * does not believe its reachability information is accurate. Only + * altered on testing networks. */ +CONF_VAR(TestingAuthDirTimeToLearnReachability, INTERVAL, 0, "30 minutes") + /** Boolean: is this an authoritative directory that's willing to recommend * versions? */ CONF_VAR(VersioningAuthoritativeDirectory, BOOL, 0, "0") diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 97cb2eb726..757bc35941 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -460,8 +460,9 @@ dirserv_get_flag_thresholds_line(void) int running_long_enough_to_decide_unreachable(void) { - return time_of_process_start - + get_options()->TestingAuthDirTimeToLearnReachability < approx_time(); + const dirauth_options_t *opts = dirauth_get_options(); + return time_of_process_start + + opts->TestingAuthDirTimeToLearnReachability < approx_time(); } /** Each server needs to have passed a reachability test no more diff --git a/src/test/test_options.c b/src/test/test_options.c index 3465207166..10e79c48d8 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -3851,14 +3851,15 @@ test_options_validate__testing_options(void *ignored) options_test_data_t *tdata = NULL; setup_capture_of_logs(LOG_WARN); -#define TEST_TESTING_OPTION(name, low_val, high_val, err_low, EXTRA_OPT_STR) \ +#define TEST_TESTING_OPTION(name, accessor, \ + low_val, high_val, err_low, EXTRA_OPT_STR) \ STMT_BEGIN \ free_options_test_data(tdata); \ tdata = get_options_test_data(EXTRA_OPT_STR \ VALID_DIR_AUTH \ "TestingTorNetwork 1\n" \ ); \ - tdata->opt-> name = low_val; \ + accessor(tdata->opt)->name = low_val; \ ret = options_validate(NULL, tdata->opt, &msg); \ tt_int_op(ret, OP_EQ, -1); \ tt_str_op(msg, OP_EQ, #name " " err_low); \ @@ -3869,7 +3870,7 @@ test_options_validate__testing_options(void *ignored) VALID_DIR_AUTH \ "TestingTorNetwork 1\n" \ ); \ - tdata->opt-> name = high_val; \ + accessor(tdata->opt)->name = high_val; \ mock_clean_saved_logs(); \ ret = options_validate(NULL, tdata->opt, &msg); \ tt_int_op(ret, OP_EQ, 0); \ @@ -3878,30 +3879,32 @@ test_options_validate__testing_options(void *ignored) tor_free(msg); \ STMT_END - TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, -1, 8000, + TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, + get_dirauth_options, -1, 8000, "must be non-negative.", ENABLE_AUTHORITY_V3); - TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, -1, 8000, + TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, + get_dirauth_options, -1, 8000, "must be non-negative.", ENABLE_AUTHORITY_BRIDGE); - TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, -1, 3601, + TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, , -1, 3601, "must be non-negative.", ""); - TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, -1, 3601, + TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, , -1, 3601, "is way too low.", ""); - TEST_TESTING_OPTION(TestingDirConnectionMaxStall, 1, 3601, + TEST_TESTING_OPTION(TestingDirConnectionMaxStall, , 1, 3601, "is way too low.", ""); - TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, -1, 3601, + TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, , -1, 3601, "must be non-negative.", ENABLE_AUTHORITY_V3); - TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, -1, 3601, + TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, , -1, 3601, "is way too low.", ENABLE_AUTHORITY_V3); - TEST_TESTING_OPTION(TestingDirConnectionMaxStall, 1, 3601, + TEST_TESTING_OPTION(TestingDirConnectionMaxStall, , 1, 3601, "is way too low.", ENABLE_AUTHORITY_V3); - TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, -1, 3601, + TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, , -1, 3601, "must be non-negative.", ENABLE_AUTHORITY_BRIDGE); - TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, -1, 3601, + TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, , -1, 3601, "is way too low.", ENABLE_AUTHORITY_BRIDGE); - TEST_TESTING_OPTION(TestingDirConnectionMaxStall, 1, 3601, + TEST_TESTING_OPTION(TestingDirConnectionMaxStall, , 1, 3601, "is way too low.", ENABLE_AUTHORITY_BRIDGE); free_options_test_data(tdata); -- cgit v1.2.3-54-g00ecf From 3210598c30c46ea0f192a20d96e2f10f481c2366 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Thu, 19 Dec 2019 10:42:44 -0500 Subject: Move TestingDirVote{Exit,Guard,HSdir}{,IsStrict} to dirauth module --- src/app/config/config.c | 6 -- src/app/config/or_options_st.h | 15 ----- src/feature/dirauth/dirauth_options.inc | 15 +++++ src/feature/dirauth/dirauth_options_st.h | 2 + src/feature/dirauth/dirauth_sys.c | 3 +- src/feature/dirauth/dirauth_sys.h | 4 ++ src/feature/dirauth/voteflags.c | 4 +- src/test/test_dir.c | 102 ++++++++++++++++--------------- src/test/test_options.c | 2 +- 9 files changed, 79 insertions(+), 74 deletions(-) (limited to 'src/test/test_options.c') diff --git a/src/app/config/config.c b/src/app/config/config.c index 81e5e6a8ed..1bfb41f48f 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -752,12 +752,6 @@ static const config_var_t option_vars_[] = { OBSOLETE("TestingDescriptorMaxDownloadTries"), OBSOLETE("TestingMicrodescMaxDownloadTries"), OBSOLETE("TestingCertMaxDownloadTries"), - V_D(TestingDirAuthVoteExit, ROUTERSET, NULL), - V(TestingDirAuthVoteExitIsStrict, BOOL, "0"), - V_D(TestingDirAuthVoteGuard, ROUTERSET, NULL), - V(TestingDirAuthVoteGuardIsStrict, BOOL, "0"), - V_D(TestingDirAuthVoteHSDir, ROUTERSET, NULL), - V(TestingDirAuthVoteHSDirIsStrict, BOOL, "0"), VAR_INVIS("___UsingTestNetworkDefaults", BOOL, UsingTestNetworkDefaults_, "0"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index f9aa0e5cd0..0e6e825854 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -764,21 +764,6 @@ struct or_options_t { * of certain configuration options. */ int TestingTorNetwork; - /** Relays in a testing network which should be voted Exit - * regardless of exit policy. */ - routerset_t *TestingDirAuthVoteExit; - int TestingDirAuthVoteExitIsStrict; - - /** Relays in a testing network which should be voted Guard - * regardless of uptime and bandwidth. */ - routerset_t *TestingDirAuthVoteGuard; - int TestingDirAuthVoteGuardIsStrict; - - /** Relays in a testing network which should be voted HSDir - * regardless of uptime and DirPort. */ - routerset_t *TestingDirAuthVoteHSDir; - int TestingDirAuthVoteHSDirIsStrict; - /** Enable CONN_BW events. Only altered on testing networks. */ int TestingEnableConnBwEvent; diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc index 82954a9920..575151733f 100644 --- a/src/feature/dirauth/dirauth_options.inc +++ b/src/feature/dirauth/dirauth_options.inc @@ -70,6 +70,21 @@ CONF_VAR(RecommendedServerVersions, LINELIST, 0, NULL) * altered on testing networks. */ CONF_VAR(TestingAuthDirTimeToLearnReachability, INTERVAL, 0, "30 minutes") + /** Relays in a testing network which should be voted Exit + * regardless of exit policy. */ +CONF_VAR(TestingDirAuthVoteExit, ROUTERSET, 0, NULL) +CONF_VAR(TestingDirAuthVoteExitIsStrict, BOOL, 0, "0") + +/** Relays in a testing network which should be voted Guard + * regardless of uptime and bandwidth. */ +CONF_VAR(TestingDirAuthVoteGuard, ROUTERSET, 0, NULL) +CONF_VAR(TestingDirAuthVoteGuardIsStrict, BOOL, 0, "0") + +/** Relays in a testing network which should be voted HSDir + * regardless of uptime and DirPort. */ +CONF_VAR(TestingDirAuthVoteHSDir, ROUTERSET, 0, NULL) +CONF_VAR(TestingDirAuthVoteHSDirIsStrict, BOOL, 0, "0") + /** Minimum value for the Exit flag threshold on testing networks. */ CONF_VAR(TestingMinExitFlagThreshold, MEMUNIT, 0, "0") diff --git a/src/feature/dirauth/dirauth_options_st.h b/src/feature/dirauth/dirauth_options_st.h index 93b9cb45bc..d48ecbe3aa 100644 --- a/src/feature/dirauth/dirauth_options_st.h +++ b/src/feature/dirauth/dirauth_options_st.h @@ -13,6 +13,8 @@ #define TOR_FEATURE_DIRAUTH_DIRAUTH_OPTIONS_ST_H #include "lib/conf/confdecl.h" +#include "feature/nodelist/routerset.h" + #define CONF_CONTEXT STRUCT #include "feature/dirauth/dirauth_options.inc" #undef CONF_CONTEXT diff --git a/src/feature/dirauth/dirauth_sys.c b/src/feature/dirauth/dirauth_sys.c index 6ec25681e7..b24e8b5774 100644 --- a/src/feature/dirauth/dirauth_sys.c +++ b/src/feature/dirauth/dirauth_sys.c @@ -11,6 +11,7 @@ #include "core/or/or.h" +#define DIRAUTH_SYS_PRIVATE #include "feature/dirauth/bwauth.h" #include "feature/dirauth/dirauth_sys.h" #include "feature/dirauth/dirvote.h" @@ -49,7 +50,7 @@ dirauth_get_options(void) return global_dirauth_options; } -static int +STATIC int dirauth_set_options(void *arg) { dirauth_options_t *opts = arg; diff --git a/src/feature/dirauth/dirauth_sys.h b/src/feature/dirauth/dirauth_sys.h index 6f116855df..243605dc63 100644 --- a/src/feature/dirauth/dirauth_sys.h +++ b/src/feature/dirauth/dirauth_sys.h @@ -25,4 +25,8 @@ extern const struct subsys_fns_t sys_dirauth; **/ #define DIRAUTH_SUBSYS_LEVEL 70 +#ifdef DIRAUTH_SYS_PRIVATE +STATIC int dirauth_set_options(void *arg); +#endif + #endif /* !defined(DIRAUTH_SYS_H) */ diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 975b3e2cff..e0a037718a 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -620,9 +620,9 @@ dirauth_set_routerstatus_from_routerinfo(routerstatus_t *rs, STATIC void dirserv_set_routerstatus_testing(routerstatus_t *rs) { - const or_options_t *options = get_options(); + const dirauth_options_t *options = dirauth_get_options(); - tor_assert(options->TestingTorNetwork); + tor_assert(get_options()->TestingTorNetwork); if (routerset_contains_routerstatus(options->TestingDirAuthVoteExit, rs, 0)) { diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 02465b07f0..d929cfb274 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -9,6 +9,7 @@ #define BWAUTH_PRIVATE #define CONFIG_PRIVATE #define CONTROL_GETINFO_PRIVATE +#define DIRAUTH_SYS_PRIVATE #define DIRCACHE_PRIVATE #define DIRCLIENT_PRIVATE #define DIRSERV_PRIVATE @@ -34,6 +35,7 @@ #include "feature/client/entrynodes.h" #include "feature/control/control_getinfo.h" #include "feature/dirauth/bwauth.h" +#include "feature/dirauth/dirauth_sys.h" #include "feature/dirauth/dirvote.h" #include "feature/dirauth/dsigs_parse.h" #include "feature/dirauth/process_descs.h" @@ -71,10 +73,12 @@ #include "lib/memarea/memarea.h" #include "lib/osinfo/uname.h" #include "test/log_test_helpers.h" +#include "test/opts_test_helpers.h" #include "test/test.h" #include "test/test_dir_common.h" #include "core/or/addr_policy_st.h" +#include "feature/dirauth/dirauth_options_st.h" #include "feature/nodelist/authority_cert_st.h" #include "feature/nodelist/document_signature_st.h" #include "feature/nodelist/extrainfo_st.h" @@ -4690,10 +4694,13 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) (void)arg; /* Init options */ + dirauth_options_t *dirauth_options = + tor_malloc_zero(sizeof(dirauth_options_t)); + mock_options = tor_malloc(sizeof(or_options_t)); reset_options(mock_options, &mock_get_options_calls); - MOCK(get_options, mock_get_options); + dirauth_set_options(dirauth_options); /* Init routersets */ routerset_t *routerset_all = routerset_new(); @@ -4733,16 +4740,15 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check that "*" sets flags on all routers: Exit * Check the flags aren't being confused with each other */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_a, ROUTER_A_ID_STR, ROUTER_A_IPV4); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_all; - mock_options->TestingDirAuthVoteExitIsStrict = 0; + dirauth_options->TestingDirAuthVoteExit = routerset_all; + dirauth_options->TestingDirAuthVoteExitIsStrict = 0; dirserv_set_routerstatus_testing(rs_a); - tt_int_op(mock_get_options_calls, OP_EQ, 1); dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 2); tt_uint_op(rs_a->is_exit, OP_EQ, 1); tt_uint_op(rs_b->is_exit, OP_EQ, 1); @@ -4755,18 +4761,17 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check that "*" sets flags on all routers: Guard & HSDir * Cover the remaining flags in one test */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_a, ROUTER_A_ID_STR, ROUTER_A_IPV4); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteGuard = routerset_all; - mock_options->TestingDirAuthVoteGuardIsStrict = 0; - mock_options->TestingDirAuthVoteHSDir = routerset_all; - mock_options->TestingDirAuthVoteHSDirIsStrict = 0; + dirauth_options->TestingDirAuthVoteGuard = routerset_all; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 0; + dirauth_options->TestingDirAuthVoteHSDir = routerset_all; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 0; dirserv_set_routerstatus_testing(rs_a); - tt_int_op(mock_get_options_calls, OP_EQ, 1); dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 2); tt_uint_op(rs_a->is_possible_guard, OP_EQ, 1); tt_uint_op(rs_b->is_possible_guard, OP_EQ, 1); @@ -4779,20 +4784,19 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check routerset A sets all flags on router A, * but leaves router B unmodified */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_a, ROUTER_A_ID_STR, ROUTER_A_IPV4); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_a; - mock_options->TestingDirAuthVoteExitIsStrict = 0; - mock_options->TestingDirAuthVoteGuard = routerset_a; - mock_options->TestingDirAuthVoteGuardIsStrict = 0; - mock_options->TestingDirAuthVoteHSDir = routerset_a; - mock_options->TestingDirAuthVoteHSDirIsStrict = 0; + dirauth_options->TestingDirAuthVoteExit = routerset_a; + dirauth_options->TestingDirAuthVoteExitIsStrict = 0; + dirauth_options->TestingDirAuthVoteGuard = routerset_a; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 0; + dirauth_options->TestingDirAuthVoteHSDir = routerset_a; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 0; dirserv_set_routerstatus_testing(rs_a); - tt_int_op(mock_get_options_calls, OP_EQ, 1); dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 2); tt_uint_op(rs_a->is_exit, OP_EQ, 1); tt_uint_op(rs_b->is_exit, OP_EQ, 0); @@ -4803,21 +4807,21 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check routerset A unsets all flags on router B when Strict is set */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_a; - mock_options->TestingDirAuthVoteExitIsStrict = 1; - mock_options->TestingDirAuthVoteGuard = routerset_a; - mock_options->TestingDirAuthVoteGuardIsStrict = 1; - mock_options->TestingDirAuthVoteHSDir = routerset_a; - mock_options->TestingDirAuthVoteHSDirIsStrict = 1; + dirauth_options->TestingDirAuthVoteExit = routerset_a; + dirauth_options->TestingDirAuthVoteExitIsStrict = 1; + dirauth_options->TestingDirAuthVoteGuard = routerset_a; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 1; + dirauth_options->TestingDirAuthVoteHSDir = routerset_a; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 1; rs_b->is_exit = 1; rs_b->is_possible_guard = 1; rs_b->is_hs_dir = 1; dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 1); tt_uint_op(rs_b->is_exit, OP_EQ, 0); tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0); @@ -4825,21 +4829,21 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check routerset A doesn't modify flags on router B without Strict set */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_a; - mock_options->TestingDirAuthVoteExitIsStrict = 0; - mock_options->TestingDirAuthVoteGuard = routerset_a; - mock_options->TestingDirAuthVoteGuardIsStrict = 0; - mock_options->TestingDirAuthVoteHSDir = routerset_a; - mock_options->TestingDirAuthVoteHSDirIsStrict = 0; + dirauth_options->TestingDirAuthVoteExit = routerset_a; + dirauth_options->TestingDirAuthVoteExitIsStrict = 0; + dirauth_options->TestingDirAuthVoteGuard = routerset_a; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 0; + dirauth_options->TestingDirAuthVoteHSDir = routerset_a; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 0; rs_b->is_exit = 1; rs_b->is_possible_guard = 1; rs_b->is_hs_dir = 1; dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 1); tt_uint_op(rs_b->is_exit, OP_EQ, 1); tt_uint_op(rs_b->is_possible_guard, OP_EQ, 1); @@ -4848,21 +4852,21 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check the empty routerset zeroes all flags * on routers A & B with Strict set */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_none; - mock_options->TestingDirAuthVoteExitIsStrict = 1; - mock_options->TestingDirAuthVoteGuard = routerset_none; - mock_options->TestingDirAuthVoteGuardIsStrict = 1; - mock_options->TestingDirAuthVoteHSDir = routerset_none; - mock_options->TestingDirAuthVoteHSDirIsStrict = 1; + dirauth_options->TestingDirAuthVoteExit = routerset_none; + dirauth_options->TestingDirAuthVoteExitIsStrict = 1; + dirauth_options->TestingDirAuthVoteGuard = routerset_none; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 1; + dirauth_options->TestingDirAuthVoteHSDir = routerset_none; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 1; rs_b->is_exit = 1; rs_b->is_possible_guard = 1; rs_b->is_hs_dir = 1; dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 1); tt_uint_op(rs_b->is_exit, OP_EQ, 0); tt_uint_op(rs_b->is_possible_guard, OP_EQ, 0); @@ -4871,24 +4875,23 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) /* Check the empty routerset doesn't modify any flags * on A or B without Strict set */ reset_options(mock_options, &mock_get_options_calls); + memset(dirauth_options, 0, sizeof(*dirauth_options)); reset_routerstatus(rs_a, ROUTER_A_ID_STR, ROUTER_A_IPV4); reset_routerstatus(rs_b, ROUTER_B_ID_STR, ROUTER_B_IPV4); - mock_options->TestingDirAuthVoteExit = routerset_none; - mock_options->TestingDirAuthVoteExitIsStrict = 0; - mock_options->TestingDirAuthVoteGuard = routerset_none; - mock_options->TestingDirAuthVoteGuardIsStrict = 0; - mock_options->TestingDirAuthVoteHSDir = routerset_none; - mock_options->TestingDirAuthVoteHSDirIsStrict = 0; + dirauth_options->TestingDirAuthVoteExit = routerset_none; + dirauth_options->TestingDirAuthVoteExitIsStrict = 0; + dirauth_options->TestingDirAuthVoteGuard = routerset_none; + dirauth_options->TestingDirAuthVoteGuardIsStrict = 0; + dirauth_options->TestingDirAuthVoteHSDir = routerset_none; + dirauth_options->TestingDirAuthVoteHSDirIsStrict = 0; rs_b->is_exit = 1; rs_b->is_possible_guard = 1; rs_b->is_hs_dir = 1; dirserv_set_routerstatus_testing(rs_a); - tt_int_op(mock_get_options_calls, OP_EQ, 1); dirserv_set_routerstatus_testing(rs_b); - tt_int_op(mock_get_options_calls, OP_EQ, 2); tt_uint_op(rs_a->is_exit, OP_EQ, 0); tt_uint_op(rs_a->is_possible_guard, OP_EQ, 0); @@ -4899,6 +4902,7 @@ test_dir_dirserv_set_routerstatus_testing(void *arg) done: tor_free(mock_options); + tor_free(dirauth_options); mock_options = NULL; UNMOCK(get_options); @@ -7261,7 +7265,7 @@ struct testcase_t dir_tests[] = { DIR_LEGACY(clip_unmeasured_bw_kb), DIR_LEGACY(clip_unmeasured_bw_kb_alt), DIR(fmt_control_ns, 0), - DIR(dirserv_set_routerstatus_testing, 0), + DIR(dirserv_set_routerstatus_testing, TT_FORK), DIR(http_handling, 0), DIR(purpose_needs_anonymity_returns_true_for_bridges, 0), DIR(purpose_needs_anonymity_returns_false_for_own_bridge_desc, 0), diff --git a/src/test/test_options.c b/src/test/test_options.c index 10e79c48d8..bdcdba8028 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -6,6 +6,7 @@ #define CONFIG_PRIVATE #define RELAY_CONFIG_PRIVATE #define LOG_PRIVATE +#define ROUTERSET_PRIVATE #include "core/or/or.h" #include "lib/confmgt/confmgt.h" #include "app/config/config.h" @@ -16,7 +17,6 @@ #include "test/test.h" #include "lib/geoip/geoip.h" -#define ROUTERSET_PRIVATE #include "feature/nodelist/routerset.h" #include "core/mainloop/mainloop.h" #include "app/main/subsysmgr.h" -- cgit v1.2.3-54-g00ecf From 6d2b9c963100dab56f61786b65d8629faaada7ad Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 17 Jan 2020 08:31:18 -0500 Subject: Remove some dead checks The only code that could set these options to be negative was in the unit tests. --- src/feature/dirauth/dirauth_config.c | 10 +--------- src/test/test_options.c | 20 -------------------- 2 files changed, 1 insertion(+), 29 deletions(-) (limited to 'src/test/test_options.c') diff --git a/src/feature/dirauth/dirauth_config.c b/src/feature/dirauth/dirauth_config.c index 4a3f569966..7895e3817f 100644 --- a/src/feature/dirauth/dirauth_config.c +++ b/src/feature/dirauth/dirauth_config.c @@ -403,12 +403,6 @@ dirauth_options_pre_normalize(void *arg, char **msg_out) "AuthDirGuardBWGuarantee", msg_out) < 0) return -1; - if (options->MinUptimeHidServDirectoryV2 < 0) { - log_warn(LD_CONFIG, "MinUptimeHidServDirectoryV2 option must be at " - "least 0 seconds. Changing to 0."); - options->MinUptimeHidServDirectoryV2 = 0; - } - return 0; } @@ -437,9 +431,7 @@ dirauth_options_validate(const void *arg, char **msg) t = format_recommended_version_list(options->RecommendedServerVersions, 1); tor_free(t); - if (options->TestingAuthDirTimeToLearnReachability < 0) { - REJECT("TestingAuthDirTimeToLearnReachability must be non-negative."); - } else if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) { + if (options->TestingAuthDirTimeToLearnReachability > 2*60*60) { COMPLAIN("TestingAuthDirTimeToLearnReachability is insanely high."); } diff --git a/src/test/test_options.c b/src/test/test_options.c index bdcdba8028..119b2a54a4 100644 --- a/src/test/test_options.c +++ b/src/test/test_options.c @@ -991,19 +991,6 @@ test_options_validate__authdir(void *ignored) "but ClientOnly also set."); tor_free(msg); - free_options_test_data(tdata); - tdata = get_options_test_data(ENABLE_AUTHORITY_V3); - /* We have to set this value manually, because it won't parse */ - get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2 = -1; - mock_clean_saved_logs(); - ret = options_validate(NULL, tdata->opt, &msg); - tt_int_op(ret, OP_EQ, 0); - expect_log_msg("MinUptimeHidServDirectoryV2 " - "option must be at least 0 seconds. Changing to 0.\n"); - tt_int_op(get_dirauth_options(tdata->opt)->MinUptimeHidServDirectoryV2, - OP_EQ, 0); - tor_free(msg); - done: teardown_capture_of_logs(); // sandbox_free_getaddrinfo_cache(); @@ -3879,13 +3866,6 @@ test_options_validate__testing_options(void *ignored) tor_free(msg); \ STMT_END - TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, - get_dirauth_options, -1, 8000, - "must be non-negative.", ENABLE_AUTHORITY_V3); - TEST_TESTING_OPTION(TestingAuthDirTimeToLearnReachability, - get_dirauth_options, -1, 8000, - "must be non-negative.", ENABLE_AUTHORITY_BRIDGE); - TEST_TESTING_OPTION(TestingEstimatedDescriptorPropagationTime, , -1, 3601, "must be non-negative.", ""); TEST_TESTING_OPTION(TestingClientMaxIntervalWithoutRequest, , -1, 3601, -- cgit v1.2.3-54-g00ecf