[tor-commits] [tor/master] Merge remote-tracking branch 'tor-gitlab/mr/21'

nickm at torproject.org nickm at torproject.org
Thu Jul 9 18:31:12 UTC 2020


commit 7207b4f2e4bb7d481b29855b432aa7265d79382b
Merge: 97a9966b0 7bc54ccba
Author: Nick Mathewson <nickm at torproject.org>
Date:   Thu Jul 9 14:30:15 2020 -0400

    Merge remote-tracking branch 'tor-gitlab/mr/21'

 changes/ticket40022                 |   4 ++
 src/app/config/resolve_addr.c       |  49 +++++++++++--
 src/app/config/resolve_addr.h       |   5 ++
 src/core/or/channeltls.c            | 133 ++++++++++++++++++++++++++----------
 src/feature/nodelist/dirlist.c      |  28 ++++++++
 src/feature/nodelist/dirlist.h      |   5 ++
 src/feature/relay/relay_find_addr.c |  57 ++++++++++++++++
 src/feature/relay/relay_find_addr.h |   4 ++
 8 files changed, 241 insertions(+), 44 deletions(-)

diff --cc src/app/config/resolve_addr.c
index caca5a37d,fb5cb2ed6..172f69854
--- a/src/app/config/resolve_addr.c
+++ b/src/app/config/resolve_addr.c
@@@ -370,64 -403,7 +403,64 @@@ get_address_from_interface(const or_opt
    return FN_RET_OK;
  }
  
 +/** @brief Get IP address from the ORPort (if any).
 + *
 + * @param options Global configuration options.
 + * @param warn_severity Log level that should be used on error.
 + * @param family IP address family. Only AF_INET and AF_INET6 are supported.
 + * @param method_out OUT: Always "CONFIGURED_ORPORT" on success which is
 + *                   detailed in the control-spec.txt as actions
 + *                   for "STATUS_SERVER".
 + * @param hostname_out OUT: String containing the ORPort hostname if any.
 + * @param addr_out OUT: Tor address found if any.
 + *
 + * @return Return 0 on success that is an address has been found. Return
 + *         error code ERR_* found at the top of the file.
 + */
 +static fn_address_ret_t
 +get_address_from_orport(const or_options_t *options, int warn_severity,
 +                        int family, const char **method_out,
 +                        char **hostname_out, tor_addr_t *addr_out)
 +{
 +  int ret;
 +  const tor_addr_t *addr;
 +
 +  tor_assert(method_out);
 +  tor_assert(hostname_out);
 +  tor_assert(addr_out);
 +
 +  log_debug(LD_CONFIG, "Attempting to get address from ORPort");
 +
 +  if (!options->ORPort_set) {
 +    log_info(LD_CONFIG, "No ORPort found in configuration.");
 +    /* No ORPort statement, inform caller to try next method. */
 +    return FN_RET_NEXT;
 +  }
 +
 +  /* Get ORPort for requested family. */
 +  addr = get_orport_addr(family);
 +  if (!addr) {
 +    /* No address configured for the ORPort. Ignore. */
 +    return FN_RET_NEXT;
 +  }
 +
 +  /* We found the ORPort address. Just make sure it can be used. */
 +  ret = address_can_be_used(addr, options, warn_severity, true);
 +  if (ret < 0) {
 +    /* Unable to use address. Inform caller to try next method. */
 +    return FN_RET_NEXT;
 +  }
 +
 +  /* Found it! */
 +  *method_out = "CONFIGURED_ORPORT";
 +  tor_addr_copy(addr_out, addr);
 +
 +  log_fn(warn_severity, LD_CONFIG, "Address found from ORPort: %s",
 +         fmt_addr(addr_out));
 +  return FN_RET_OK;
 +}
 +
- /** @brief Update the last resolved address cache using the given address.
+ /** @brief Set the last resolved address cache using the given address.
   *
   * A log notice is emitted if the given address has changed from before. Not
   * emitted on first resolve.



More information about the tor-commits mailing list