diff options
author | Neel Chauhan <neel@neelc.org> | 2019-02-22 13:36:02 -0500 |
---|---|---|
committer | Neel Chauhan <neel@neelc.org> | 2019-02-22 13:36:02 -0500 |
commit | df8ad6473575e217fe69de7d0d12341a1162b95e (patch) | |
tree | baacce6fc67c31da5d305d45e8b847b6a400ce70 /src/feature/dirauth | |
parent | 9ac8c854354eac7178eb8e99384f34c5a7abd5f4 (diff) | |
download | tor-df8ad6473575e217fe69de7d0d12341a1162b95e.tar.gz tor-df8ad6473575e217fe69de7d0d12341a1162b95e.zip |
When a DirAuth checks reachability on itself and has IPv6, mark it as reachable
Diffstat (limited to 'src/feature/dirauth')
-rw-r--r-- | src/feature/dirauth/voteflags.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/feature/dirauth/voteflags.c b/src/feature/dirauth/voteflags.c index 4f7593a3e1..0a53c588d6 100644 --- a/src/feature/dirauth/voteflags.c +++ b/src/feature/dirauth/voteflags.c @@ -531,6 +531,20 @@ dirserv_set_router_is_running(routerinfo_t *router, time_t now) node->is_running = answer; } +/* Check <b>node</b> and <b>ri</b> on whether or not we should publish a + * relay's IPv6 addresses. */ +static int +should_publish_node_ipv6(const node_t *node, const routerinfo_t *ri, + time_t now) +{ + const or_options_t *options = get_options(); + + return options->AuthDirHasIPv6Connectivity == 1 && + !tor_addr_is_null(&ri->ipv6_addr) && + ((node->last_reachable6 >= now - REACHABLE_TIMEOUT) || + router_is_me(ri)); +} + /** Extract status information from <b>ri</b> and from other authority * functions and store it in <b>rs</b>. <b>rs</b> is zeroed out before it is * set. @@ -597,9 +611,7 @@ set_routerstatus_from_routerinfo(routerstatus_t *rs, rs->is_staledesc = (ri->cache_info.published_on + DESC_IS_STALE_INTERVAL) < now; - if (options->AuthDirHasIPv6Connectivity == 1 && - !tor_addr_is_null(&ri->ipv6_addr) && - node->last_reachable6 >= now - REACHABLE_TIMEOUT) { + if (should_publish_node_ipv6(node, ri, now)) { /* We're configured as having IPv6 connectivity. There's an IPv6 OR port and it's reachable so copy it to the routerstatus. */ tor_addr_copy(&rs->ipv6_addr, &ri->ipv6_addr); |