aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/relay_periodic.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2020-07-24 09:11:16 -0400
committerDavid Goulet <dgoulet@torproject.org>2020-07-24 12:18:07 -0400
commitad9806b5390f099a51ca8c8d34eff91e432da3f4 (patch)
tree7c3431dfb7edca4c4ffba46a366e19f6aa802a5f /src/feature/relay/relay_periodic.c
parentfda0fa02bfcf2faef4a973d24877dc7966f6d428 (diff)
downloadtor-ad9806b5390f099a51ca8c8d34eff91e432da3f4.tar.gz
tor-ad9806b5390f099a51ca8c8d34eff91e432da3f4.zip
relay: Publish IPv4 descriptor on guessed IPv6 reachability failure
On an IPv6 reachability failure test, if the address was configured, don't publish the descriptor and log warn. If the address was auto discovered, still publish the descriptor. Closes #33247. Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/feature/relay/relay_periodic.c')
-rw-r--r--src/feature/relay/relay_periodic.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c
index cc346bc3fc..adff2c6a23 100644
--- a/src/feature/relay/relay_periodic.c
+++ b/src/feature/relay/relay_periodic.c
@@ -12,6 +12,8 @@
#include "orconfig.h"
#include "core/or/or.h"
+#include "app/config/resolve_addr.h"
+
#include "core/mainloop/periodic.h"
#include "core/mainloop/cpuworker.h" // XXXX use a pubsub event.
#include "core/mainloop/mainloop.h"
@@ -218,14 +220,31 @@ reachability_warnings_callback(time_t now, const or_options_t *options)
tor_asprintf(&where6, "[%s]:%d", address6, me->ipv6_orport);
const char *opt_and = (!v4_ok && !v6_ok) ? "and" : "";
- log_warn(LD_CONFIG,
- "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.",
- where4?where4:"",
- opt_and,
- where6?where6:"");
+ /* IPv4 reachability test worked but not the IPv6. We will _not_
+ * publish the descriptor if our IPv6 was configured. We will if it
+ * was auto discovered. */
+ if (v4_ok && !v6_ok && !resolved_addr_is_configured(AF_INET6)) {
+ static ratelim_t rlim = RATELIM_INIT(3600);
+ log_fn_ratelim(&rlim, LOG_NOTICE, LD_CONFIG,
+ "Auto-discovered IPv6 address %s has not been found "
+ "reachable. However, IPv4 address is reachable. "
+ "Publishing server descriptor without IPv6 address.",
+ where6 ? where6 : "");
+ /* Indicate we want to publish even if reachability test failed. */
+ mark_my_descriptor_if_omit_ipv6_changes("IPv4 is reachable. "
+ "IPv6 is not but was "
+ "auto-discovered", true);
+ } else {
+ log_warn(LD_CONFIG,
+ "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.",
+ where4?where4:"",
+ opt_and,
+ where6?where6:"");
+ }
tor_free(where4);
tor_free(where6);
if (!v4_ok) {