Commit caab67d0 authored by teor's avatar teor
Browse files

nodelist: Distinguish client and relay reachability

Change some function names to distinguish between:
* client first hop reachability (ReachableAddresses)
* relay port reachability self-tests

This is an automated commit, generated by this command:

./scripts/maint/rename_c_identifier.py \
        router_skip_or_reachability router_connect_assume_or_reachable \
        router_skip_dir_reachability router_connect_assume_dir_reachable

It was generated with --no-verify, so it probably breaks some commit hooks.
The commiter should be sure to fix them up in a subsequent commit.

Part of 33222.
parent efcae919
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -321,8 +321,8 @@ router_pick_directory_server_impl(dirinfo_type_t type, int flags,
  overloaded_direct = smartlist_new();
  overloaded_tunnel = smartlist_new();

  const int skip_or_fw = router_skip_or_reachability(options, try_ip_pref);
  const int skip_dir_fw = router_skip_dir_reachability(options, try_ip_pref);
  const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref);
  const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref);
  const int must_have_or = dirclient_must_use_begindir(options);

  /* Find all the running dirservers we know about. */
@@ -1120,8 +1120,8 @@ router_pick_trusteddirserver_impl(const smartlist_t *sourcelist,
  overloaded_direct = smartlist_new();
  overloaded_tunnel = smartlist_new();

  const int skip_or_fw = router_skip_or_reachability(options, try_ip_pref);
  const int skip_dir_fw = router_skip_dir_reachability(options, try_ip_pref);
  const int skip_or_fw = router_connect_assume_or_reachable(options, try_ip_pref);
  const int skip_dir_fw = router_connect_assume_dir_reachable(options, try_ip_pref);
  const int must_have_or = dirclient_must_use_begindir(options);

  SMARTLIST_FOREACH_BEGIN(sourcelist, const dir_server_t *, d)
+3 −3
Original line number Diff line number Diff line
@@ -469,7 +469,7 @@ router_reload_router_list(void)
 * and reachability checks be skipped?
 */
int
router_skip_or_reachability(const or_options_t *options, int try_ip_pref)
router_connect_assume_or_reachable(const or_options_t *options, int try_ip_pref)
{
  /* Servers always have and prefer IPv4.
   * And if clients are checking against the firewall for reachability only,
@@ -481,7 +481,7 @@ router_skip_or_reachability(const or_options_t *options, int try_ip_pref)
 * and reachability checks be skipped?
 */
int
router_skip_dir_reachability(const or_options_t *options, int try_ip_pref)
router_connect_assume_dir_reachable(const or_options_t *options, int try_ip_pref)
{
  /* Servers always have and prefer IPv4.
   * And if clients are checking against the firewall for reachability only,
@@ -507,7 +507,7 @@ router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,
                                      int need_desc, int pref_addr,
                                      int direct_conn)
{
  const int check_reach = !router_skip_or_reachability(get_options(),
  const int check_reach = !router_connect_assume_or_reachable(get_options(),
                                                       pref_addr);
  /* XXXX MOVE */
  SMARTLIST_FOREACH_BEGIN(nodelist_get_list(), const node_t *, node) {
+2 −2
Original line number Diff line number Diff line
@@ -50,8 +50,8 @@ typedef enum was_router_added_t {

int router_reload_router_list(void);

int router_skip_or_reachability(const or_options_t *options, int try_ip_pref);
int router_skip_dir_reachability(const or_options_t *options, int try_ip_pref);
int router_connect_assume_or_reachable(const or_options_t *options, int try_ip_pref);
int router_connect_assume_dir_reachable(const or_options_t *options, int try_ip_pref);
void router_reset_status_download_failures(void);
int routers_have_same_or_addrs(const routerinfo_t *r1, const routerinfo_t *r2);
void router_add_running_nodes_to_smartlist(smartlist_t *sl, int need_uptime,
+1 −1
Original line number Diff line number Diff line
@@ -137,7 +137,7 @@ extend_info_from_router(const routerinfo_t *r)
  tor_assert(r);

  /* Make sure we don't need to check address reachability */
  tor_assert_nonfatal(router_skip_or_reachability(get_options(), 0));
  tor_assert_nonfatal(router_connect_assume_or_reachable(get_options(), 0));

  const ed25519_public_key_t *ed_id_key;
  if (r->cache_info.signing_key_cert)