diff options
author | Nick Mathewson <nickm@torproject.org> | 2020-06-23 11:24:20 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2020-06-23 11:24:20 -0400 |
commit | ac648fa3070b9fea5628540cbea4876e4d0745b4 (patch) | |
tree | ed864d6c03e75dfaa6040c34880847bd4e8c0e46 /src/feature/relay/selftest.c | |
parent | b365179ee0061db2981f09025041a1065d0b283c (diff) | |
download | tor-ac648fa3070b9fea5628540cbea4876e4d0745b4.tar.gz tor-ac648fa3070b9fea5628540cbea4876e4d0745b4.zip |
Clarify logic in router_should_skip_orport_reachability_check_family()
The '!=' checks were confusing the issue of what the code was really
doing.
Diffstat (limited to 'src/feature/relay/selftest.c')
-rw-r--r-- | src/feature/relay/selftest.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c index 7dc579c19a..12ce8e8bfd 100644 --- a/src/feature/relay/selftest.c +++ b/src/feature/relay/selftest.c @@ -96,12 +96,16 @@ router_should_skip_orport_reachability_check_family( return true; } - if (family != AF_INET6) { + // 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); + + if (checking_ipv4) { if (have_orport_for_family(AF_INET) && !can_reach_or_port_ipv4) { return false; } } - if (family != AF_INET) { + if (checking_ipv6) { if (have_orport_for_family(AF_INET6) && !can_reach_or_port_ipv6) { return false; } |