[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Clarify logic in router_should_skip_orport_reachability_check_family()



commit ac648fa3070b9fea5628540cbea4876e4d0745b4
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Tue Jun 23 11:24:20 2020 -0400

    Clarify logic in router_should_skip_orport_reachability_check_family()
    
    The '!=' checks were confusing the issue of what the code was really
    doing.
---
 src/feature/relay/selftest.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/feature/relay/selftest.c b/src/feature/relay/selftest.c
index 7dc579c19..12ce8e8bf 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;
     }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits