diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-06-18 16:05:16 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-06-18 16:05:16 -0400 |
commit | bc9979a670026004bf0a516bd38a25251ca6d9bb (patch) | |
tree | 73fde4834208dbd9209bad0f589244b5be74f9a2 /src/feature/relay/relay_periodic.c | |
parent | 6c3897826a21734d2ab4f621df62e337d8bb8391 (diff) | |
download | tor-bc9979a670026004bf0a516bd38a25251ca6d9bb.tar.gz tor-bc9979a670026004bf0a516bd38a25251ca6d9bb.zip |
Split "can reach ipv4 orport" from "can reach ipv6 orport".
I've managed to keep this change mainly contained to our
self-testing module. The changes here are:
* There are two different variables for tracking "is our orport
reachable".
* We have a new function that says whether we can skip a single
family's orport reachability test; the old function for this now
tells whether we can skip _all_ orport reachability testing.
(The name, router_should_skip_orport_reachability_test, is not
so good. I will rename it later if I can think of a good
replacement.)
* The function that launches orport reachability tests now only
launches the ones that haven't completed.
* The function that notes that we're reachable on an ORPort now
takes a family.
* Various log messages are cleaned up.
Diffstat (limited to 'src/feature/relay/relay_periodic.c')
-rw-r--r-- | src/feature/relay/relay_periodic.c | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c index 6a92f49d2e..3171dffa5b 100644 --- a/src/feature/relay/relay_periodic.c +++ b/src/feature/relay/relay_periodic.c @@ -202,19 +202,45 @@ reachability_warnings_callback(time_t now, const or_options_t *options) /* every 20 minutes, check and complain if necessary */ const routerinfo_t *me = router_get_my_routerinfo(); if (me && !router_should_skip_orport_reachability_check(options)) { - char *address = tor_dup_ip(me->addr); - if (address) { + /* We need to warn that one or more of our ORPorts isn't reachable. + * Determine which, and give a reasonable warning. */ + char *address4 = tor_dup_ip(me->addr); + char *address6 = tor_addr_to_str_dup(&me->ipv6_addr); + bool v4_ok = + router_should_skip_orport_reachability_check_family(options,AF_INET); + bool v6_ok = + router_should_skip_orport_reachability_check_family(options,AF_INET6); + if (address4 || address6) { + char *where4=NULL, *where6=NULL; + if (!v4_ok) + tor_asprintf(&where4, "%s:%d", address4, me->or_port); + if (!v6_ok) + tor_asprintf(&where6, "[%s]:%d", address6, me->or_port); + const char *opt_and = (!v4_ok && !v6_ok) ? "and" : ""; + log_warn(LD_CONFIG, - "Your server (%s:%d) has not managed to confirm that " - "its ORPort is reachable. Relays do not publish descriptors " + "Your server has not managed to confirm reachability for " + "its ORPort(s) at %s%s%s. Relays do not publish descriptors " "until their ORPort and DirPort are reachable. Please check " "your firewalls, ports, address, /etc/hosts file, etc.", - address, me->or_port); - control_event_server_status(LOG_WARN, - "REACHABILITY_FAILED ORADDRESS=%s:%d", - address, me->or_port); - tor_free(address); + where4?where4:"", + opt_and, + where6?where6:""); + tor_free(where4); + tor_free(where6); + if (!v4_ok) { + control_event_server_status(LOG_WARN, + "REACHABILITY_FAILED ORADDRESS=%s:%d", + address4, me->or_port); + } + if (!v6_ok) { + control_event_server_status(LOG_WARN, + "REACHABILITY_FAILED ORADDRESS=[%s]:%d", + address6, me->ipv6_orport); + } } + tor_free(address4); + tor_free(address6); } if (me && !router_should_skip_dirport_reachability_check(options)) { |