summaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-06-24 15:12:57 -0400
committerNick Mathewson <nickm@torproject.org>2020-06-24 15:25:34 -0400
commitedb023b1e74dd3b900af399126bd985fc4064857 (patch)
treea40593ce97d20070ac79fe5dd557832b03e6b607 /src/feature
parent6edf7f6710600962f95e7f5458787dbc5e5c7411 (diff)
downloadtor-edb023b1e74dd3b900af399126bd985fc4064857.tar.gz
tor-edb023b1e74dd3b900af399126bd985fc4064857.zip
Add an AssumeReachableIPv6 autobool option.
This option tells Tor that our IPv6 orport is reachable, and doesn't need to be checked. Closes the rest of 33224.
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/relay/router.c4
-rw-r--r--src/feature/relay/selftest.c12
2 files changed, 10 insertions, 6 deletions
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 97b630add7..d32d03fc1c 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -1374,13 +1374,13 @@ decide_if_publishable_server(void)
return 1;
if (!router_get_advertised_or_port(options))
return 0;
- if (!router_orport_seems_reachable(AF_INET)) {
+ if (!router_orport_seems_reachable(options, AF_INET)) {
// We have an ipv4 orport, and it doesn't seem reachable.
if (!publish_even_when_ipv4_orport_unreachable) {
return 0;
}
}
- if (!router_orport_seems_reachable(AF_INET6)) {
+ if (!router_orport_seems_reachable(options, AF_INET6)) {
// We have an ipv6 orport, and it doesn't seem reachable.
if (!publish_even_when_ipv6_orport_unreachable) {
return 0;
diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c
index 64b8578bac..ae24a04401 100644
--- a/src/feature/relay/selftest.c
+++ b/src/feature/relay/selftest.c
@@ -86,9 +86,8 @@ router_reachability_checks_disabled(const or_options_t *options)
* orport checks.
*/
int
-router_orport_seems_reachable(
- const or_options_t *options,
- int family)
+router_orport_seems_reachable(const or_options_t *options,
+ int family)
{
tor_assert_nonfatal(family == AF_INET || family == AF_INET6 || family == 0);
int reach_checks_disabled = router_reachability_checks_disabled(options);
@@ -96,6 +95,11 @@ router_orport_seems_reachable(
return true;
}
+ // Note that we do a == 1 here, not just a boolean check. This value
+ // is also an autobool, so CFG_AUTO does not mean that we should
+ // assume IPv6 ports are reachable.
+ const bool ipv6_assume_reachable = (options->AssumeReachableIPv6 == 1);
+
// Which reachability flags should we look at?
const bool checking_ipv4 = (family == AF_INET || family == 0);
const bool checking_ipv6 = (family == AF_INET6 || family == 0);
@@ -105,7 +109,7 @@ router_orport_seems_reachable(
return false;
}
}
- if (checking_ipv6) {
+ if (checking_ipv6 && !ipv6_assume_reachable) {
if (have_orport_for_family(AF_INET6) && !can_reach_or_port_ipv6) {
return false;
}