diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-12-19 09:07:01 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-12-19 09:19:02 -0500 |
commit | eedab30a7bd5663984264bb5f9ef43cf57450143 (patch) | |
tree | 1c64f572b7daf364b21bdbd410d599b206b51fd4 | |
parent | bc0f1076d53e57d1a4ba19170a1c27d9eaee34e8 (diff) | |
download | tor-eedab30a7bd5663984264bb5f9ef43cf57450143.tar.gz tor-eedab30a7bd5663984264bb5f9ef43cf57450143.zip |
Move AuthDirHasIPv6Connectivity into dirauth module.
-rw-r--r-- | src/app/config/config.c | 1 | ||||
-rw-r--r-- | src/app/config/or_options_st.h | 1 | ||||
-rw-r--r-- | src/feature/dirauth/dirauth_options.inc | 3 | ||||
-rw-r--r-- | src/feature/dirauth/reachability.c | 4 | ||||
-rw-r--r-- | src/feature/dirauth/voteflags.c | 5 | ||||
-rw-r--r-- | src/test/test_voting_flags.c | 4 |
6 files changed, 12 insertions, 6 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index f3d889edb6..2d1d09e185 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -336,7 +336,6 @@ static const config_var_t option_vars_[] = { OBSOLETE("AuthDirListBadDirs"), V(AuthDirListBadExits, BOOL, "0"), OBSOLETE("AuthDirMaxServersPerAuthAddr"), - V(AuthDirHasIPv6Connectivity, BOOL, "0"), VAR("AuthoritativeDirectory", BOOL, AuthoritativeDir, "0"), V(AutomapHostsOnResolve, BOOL, "0"), V(AutomapHostsSuffixes, CSV, ".onion,.exit"), diff --git a/src/app/config/or_options_st.h b/src/app/config/or_options_st.h index 9d58633aab..b8da3cdd09 100644 --- a/src/app/config/or_options_st.h +++ b/src/app/config/or_options_st.h @@ -459,7 +459,6 @@ struct or_options_t { int AuthDirListBadExits; /**< True iff we should list bad exits, * and vote for all other exits as good. */ - int AuthDirHasIPv6Connectivity; /**< Boolean: are we on IPv6? */ int AuthDirPinKeys; /**< Boolean: Do we enforce key-pinning? */ char *AccountingStart; /**< How long is the accounting interval, and when diff --git a/src/feature/dirauth/dirauth_options.inc b/src/feature/dirauth/dirauth_options.inc index 1870f46511..ea1c59e83c 100644 --- a/src/feature/dirauth/dirauth_options.inc +++ b/src/feature/dirauth/dirauth_options.inc @@ -20,6 +20,9 @@ CONF_VAR(AuthDirFastGuarantee, MEMUNIT, 0, "100 KB") * to satisfy the bandwidth requirement for the Guard flag. */ CONF_VAR(AuthDirGuardBWGuarantee, MEMUNIT, 0, "2 MB") +/** Boolean: are we on IPv6? */ +CONF_VAR(AuthDirHasIPv6Connectivity, BOOL, 0, "0") + /** Do not permit more than this number of servers per IP address. */ CONF_VAR(AuthDirMaxServersPerAddr, POSINT, 0, "2") diff --git a/src/feature/dirauth/reachability.c b/src/feature/dirauth/reachability.c index 883b692cbb..2f883d5034 100644 --- a/src/feature/dirauth/reachability.c +++ b/src/feature/dirauth/reachability.c @@ -17,6 +17,7 @@ #include "core/or/channeltls.h" #include "core/or/command.h" #include "feature/dirauth/authmode.h" +#include "feature/dirauth/dirauth_sys.h" #include "feature/nodelist/describe.h" #include "feature/nodelist/nodelist.h" #include "feature/nodelist/routerinfo.h" @@ -24,6 +25,7 @@ #include "feature/nodelist/torcert.h" #include "feature/stats/rephist.h" +#include "feature/dirauth/dirauth_options_st.h" #include "feature/nodelist/node_st.h" #include "feature/nodelist/routerinfo_st.h" #include "feature/nodelist/routerlist_st.h" @@ -154,7 +156,7 @@ dirserv_single_reachability_test(time_t now, routerinfo_t *router) if (chan) command_setup_channel(chan); /* Possible IPv6. */ - if (get_options()->AuthDirHasIPv6Connectivity == 1 && + if (dirauth_get_options()->AuthDirHasIPv6Connectivity == 1 && !tor_addr_is_null(&router->ipv6_addr)) { char addrstr[TOR_ADDR_BUF_LEN]; log_debug(LD_OR, "Testing reachability of %s at %s:%u.", diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 7129418a0a..8b9b8bc5c1 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -485,6 +485,7 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now) */ int answer; const or_options_t *options = get_options(); + const dirauth_options_t *dirauth_options = dirauth_get_options(); node_t *node = node_get_mutable_by_id(router->cache_info.identity_digest); tor_assert(node); @@ -511,7 +512,7 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now) IPv6 OR port since that'd kill all dual stack relays until a majority of the dir auths have IPv6 connectivity. */ answer = (now < node->last_reachable + REACHABLE_TIMEOUT && - (options->AuthDirHasIPv6Connectivity != 1 || + (dirauth_options->AuthDirHasIPv6Connectivity != 1 || tor_addr_is_null(&router->ipv6_addr) || now < node->last_reachable6 + REACHABLE_TIMEOUT)); } @@ -542,7 +543,7 @@ static int should_publish_node_ipv6(const node_t *node, const routerinfo_t *ri, time_t now) { - const or_options_t *options = get_options(); + const dirauth_options_t *options = dirauth_get_options(); return options->AuthDirHasIPv6Connectivity == 1 && !tor_addr_is_null(&ri->ipv6_addr) && diff --git a/src/test/test_voting_flags.c b/src/test/test_voting_flags.c index c8111ea5df..510531fbcd 100644 --- a/src/test/test_voting_flags.c +++ b/src/test/test_voting_flags.c @@ -8,6 +8,7 @@ #include "core/or/or.h" #include "feature/dirauth/voteflags.h" +#include "feature/dirauth/dirauth_options_st.h" #include "feature/nodelist/node_st.h" #include "feature/nodelist/routerstatus_st.h" #include "feature/nodelist/routerinfo_st.h" @@ -15,6 +16,7 @@ #include "app/config/config.h" #include "test/test.h" +#include "test/opts_test_helpers.h" typedef struct { time_t now; @@ -119,7 +121,7 @@ test_voting_flags_ipv6(void *arg) if (!check_result(cfg)) goto done; - get_options_mutable()->AuthDirHasIPv6Connectivity = 1; + get_dirauth_options(get_options_mutable())->AuthDirHasIPv6Connectivity = 1; // no change in expected results, since last_reachable6 won't be set. if (!check_result(cfg)) goto done; |