commit 354f085e5f14c2bb4918b015e36cdc72748e0ea6 Merge: eaae5625c 1df451aba Author: Nick Mathewson nickm@torproject.org Date: Tue Jun 9 15:44:58 2020 -0400
Merge remote-tracking branch 'tor-github/pr/1888/head'
changes/bug34248 | 4 + changes/bug34251 | 4 + changes/ticket33222 | 8 + changes/ticket34200 | 3 + doc/tor.1.txt | 6 +- scripts/maint/practracker/exceptions.txt | 14 +- src/core/or/circuitbuild.c | 190 +++++++++------- src/core/or/circuitbuild.h | 4 + src/core/or/circuitlist.c | 2 +- src/core/or/circuituse.c | 22 +- src/core/or/circuituse.h | 16 +- src/core/or/cpath_build_state_st.h | 2 + src/core/or/or.h | 21 +- src/core/or/protover.c | 11 +- src/core/or/protover.h | 24 +- src/core/or/versions.c | 55 ++++- src/feature/control/control_getinfo.c | 17 +- src/feature/nodelist/node_select.c | 152 ++++++------- src/feature/nodelist/node_select.h | 28 ++- src/feature/nodelist/node_st.h | 5 +- src/feature/nodelist/nodelist.c | 76 +++++-- src/feature/nodelist/nodelist.h | 16 +- src/feature/nodelist/routerinfo.c | 35 ++- src/feature/nodelist/routerinfo.h | 5 +- src/feature/nodelist/routerlist.c | 150 +++++++++--- src/feature/nodelist/routerlist.h | 14 +- src/feature/relay/relay_periodic.c | 4 +- src/feature/relay/router.c | 21 +- src/feature/relay/selftest.c | 231 +++++++++++++------ src/feature/relay/selftest.h | 10 +- src/feature/stats/predict_ports.c | 4 +- src/lib/net/address.c | 36 ++- src/lib/net/address.h | 2 + src/rust/protover/ffi.rs | 10 +- src/rust/protover/protover.rs | 8 +- src/test/test_circuitbuild.c | 377 ++++++++++++++++++++++++++++++- src/test/test_circuitstats.c | 95 ++++---- src/test/test_helpers.c | 62 ++++- src/test/test_helpers.h | 5 + src/test/test_protover.c | 331 ++++++++++++++++++++++++--- 40 files changed, 1595 insertions(+), 485 deletions(-)
diff --cc src/feature/relay/relay_periodic.c index 08ad110cf,2b6be1ce1..6a92f49d2 --- a/src/feature/relay/relay_periodic.c +++ b/src/feature/relay/relay_periodic.c @@@ -201,36 -201,31 +201,36 @@@ reachability_warnings_callback(time_t n have_completed_a_circuit()) { /* every 20 minutes, check and complain if necessary */ const routerinfo_t *me = router_get_my_routerinfo(); - if (me && !check_whether_orport_reachable(options)) { + if (me && !router_should_skip_orport_reachability_check(options)) { char *address = tor_dup_ip(me->addr); - log_warn(LD_CONFIG,"Your server (%s:%d) has not managed to confirm that " - "its ORPort is reachable. Relays do not publish descriptors " - "until their ORPort and DirPort are reachable. Please check " - "your firewalls, ports, address, /etc/hosts file, etc.", - address, me->or_port); - control_event_server_status(LOG_WARN, - "REACHABILITY_FAILED ORADDRESS=%s:%d", - address, me->or_port); - tor_free(address); + if (address) { + log_warn(LD_CONFIG, + "Your server (%s:%d) has not managed to confirm that " + "its ORPort is reachable. Relays do not publish descriptors " + "until their ORPort and DirPort are reachable. Please check " + "your firewalls, ports, address, /etc/hosts file, etc.", + address, me->or_port); + control_event_server_status(LOG_WARN, + "REACHABILITY_FAILED ORADDRESS=%s:%d", + address, me->or_port); + tor_free(address); + } }
- if (me && !check_whether_dirport_reachable(options)) { + if (me && !router_should_skip_dirport_reachability_check(options)) { char *address = tor_dup_ip(me->addr); - log_warn(LD_CONFIG, - "Your server (%s:%d) has not managed to confirm that its " - "DirPort is reachable. Relays do not publish descriptors " - "until their ORPort and DirPort are reachable. Please check " - "your firewalls, ports, address, /etc/hosts file, etc.", - address, me->dir_port); - control_event_server_status(LOG_WARN, - "REACHABILITY_FAILED DIRADDRESS=%s:%d", - address, me->dir_port); - tor_free(address); + if (address) { + log_warn(LD_CONFIG, + "Your server (%s:%d) has not managed to confirm that its " + "DirPort is reachable. Relays do not publish descriptors " + "until their ORPort and DirPort are reachable. Please check " + "your firewalls, ports, address, /etc/hosts file, etc.", + address, me->dir_port); + control_event_server_status(LOG_WARN, + "REACHABILITY_FAILED DIRADDRESS=%s:%d", + address, me->dir_port); + tor_free(address); + } } }
diff --cc src/feature/relay/selftest.c index 18fe25b98,ae5633bfb..2b0fc951b --- a/src/feature/relay/selftest.c +++ b/src/feature/relay/selftest.c @@@ -224,30 -303,40 +303,41 @@@ inform_testing_reachability(void const routerinfo_t *me = router_get_my_routerinfo(); if (!me) return 0; + - address = tor_dup_ip(me->addr); - if (!address) - return 0; - + /* IPv4 ORPort */ + strlcpy(ipv4_or_buf, fmt_addr32_port(me->addr, me->or_port), + sizeof(ipv4_or_buf)); control_event_server_status(LOG_NOTICE, - "CHECKING_REACHABILITY ORADDRESS=%s:%d", - address, me->or_port); + "CHECKING_REACHABILITY ORADDRESS=%s", + ipv4_or_buf); + /* IPv6 ORPort */ + const bool has_ipv6 = tor_addr_port_is_valid(&me->ipv6_addr, + me->ipv6_orport, 0); + if (has_ipv6) { + strlcpy(ipv6_or_buf, fmt_addrport(&me->ipv6_addr, me->ipv6_orport), + sizeof(ipv6_or_buf)); + /* We'll add an IPv6 control event in #34068. */ + } + /* IPv4 DirPort (there are no advertised IPv6 DirPorts) */ if (me->dir_port) { - tor_snprintf(dirbuf, sizeof(dirbuf), " and DirPort %s:%d", - address, me->dir_port); + strlcpy(ipv4_dir_buf, fmt_addr32_port(me->addr, me->dir_port), + sizeof(ipv4_dir_buf)); control_event_server_status(LOG_NOTICE, - "CHECKING_REACHABILITY DIRADDRESS=%s:%d", - address, me->dir_port); + "CHECKING_REACHABILITY DIRADDRESS=%s", + ipv4_dir_buf); } - log_notice(LD_OR, "Now checking whether ORPort %s:%d%s %s reachable... " - "(this may take up to %d minutes -- look for log " - "messages indicating success)", - address, me->or_port, - me->dir_port ? dirbuf : "", - me->dir_port ? "are" : "is", - TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT/60); - - tor_free(address); + log_notice(LD_OR, "Now checking whether ORPort%s %s%s%s%s%s %s reachable... " + "(this may take up to %d minutes -- look for log " + "messages indicating success)", + has_ipv6 ? "s" : "", + ipv4_or_buf, + has_ipv6 ? " and " : "", + has_ipv6 ? ipv6_or_buf : "", + me->dir_port ? " and DirPort " : "", + me->dir_port ? ipv4_dir_buf : "", + has_ipv6 || me->dir_port ? "are" : "is", + TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT/60); + return 1; }
tor-commits@lists.torproject.org