tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit b365179ee0061db2981f09025041a1065d0b283c
parent bc9979a670026004bf0a516bd38a25251ca6d9bb
Author: Nick Mathewson <nickm@torproject.org>
Date:   Tue, 23 Jun 2020 11:20:05 -0400

reachability_warnings_callback: simplify v4/v6_ok logic

Since "skip orport check" is the "and" of v4_ok and v6_ok, we can
just compute v4_ok and v6_ok once, to clarify that we don't enter
this block of code if they're both true.

Diffstat:
Msrc/feature/relay/relay_periodic.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/feature/relay/relay_periodic.c b/src/feature/relay/relay_periodic.c @@ -201,15 +201,15 @@ reachability_warnings_callback(time_t now, const or_options_t *options) have_completed_a_circuit()) { /* 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)) { + 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 (me && !(v4_ok && v6_ok)) { /* 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)