tor  0.4.0.1-alpha
Macros | Enumerations | Functions
nodelist.h File Reference

Go to the source code of this file.

Macros

#define node_assert_ok(n)
 
#define NNF_NO_WARN_UNNAMED   (1u<<0)
 
#define node_is_bridge(node)   (node_get_purpose((node)) == ROUTER_PURPOSE_BRIDGE)
 
#define node_ipv6_preferred(node)   node_ipv6_or_preferred(node)
 
#define node_get_addr_ipv4h(n)   node_get_prim_addr_ipv4h((n))
 

Enumerations

enum  consensus_path_type_t { CONSENSUS_PATH_UNKNOWN = -1, CONSENSUS_PATH_INTERNAL = 0, CONSENSUS_PATH_EXIT = 1 }
 

Functions

 MOCK_DECL (node_t *, node_get_mutable_by_id,(const char *identity_digest))
 
 MOCK_DECL (const node_t *, node_get_by_id,(const char *identity_digest))
 
node_tnode_get_mutable_by_ed25519_id (const struct ed25519_public_key_t *ed_id)
 
 MOCK_DECL (const node_t *, node_get_by_ed25519_id,(const struct ed25519_public_key_t *ed_id))
 
const node_tnode_get_by_hex_id (const char *identity_digest, unsigned flags)
 
node_tnodelist_set_routerinfo (routerinfo_t *ri, routerinfo_t **ri_old_out)
 
node_tnodelist_add_microdesc (microdesc_t *md)
 
void nodelist_set_consensus (networkstatus_t *ns)
 
void nodelist_ensure_freshness (networkstatus_t *ns)
 
int nodelist_probably_contains_address (const tor_addr_t *addr)
 
void nodelist_remove_microdesc (const char *identity_digest, microdesc_t *md)
 
void nodelist_remove_routerinfo (routerinfo_t *ri)
 
void nodelist_purge (void)
 
smartlist_tnodelist_find_nodes_with_microdesc (const microdesc_t *md)
 
void nodelist_free_all (void)
 
void nodelist_assert_ok (void)
 
 MOCK_DECL (const node_t *, node_get_by_nickname,(const char *nickname, unsigned flags))
 
void node_get_verbose_nickname (const node_t *node, char *verbose_name_out)
 
void node_get_verbose_nickname_by_id (const char *id_digest, char *verbose_name_out)
 
int node_is_dir (const node_t *node)
 
int node_is_good_exit (const node_t *node)
 
int node_has_any_descriptor (const node_t *node)
 
int node_has_preferred_descriptor (const node_t *node, int for_direct_connect)
 
int node_get_purpose (const node_t *node)
 
int node_is_me (const node_t *node)
 
int node_exit_policy_rejects_all (const node_t *node)
 
int node_exit_policy_is_exact (const node_t *node, sa_family_t family)
 
smartlist_tnode_get_all_orports (const node_t *node)
 
int node_allows_single_hop_exits (const node_t *node)
 
const char * node_get_nickname (const node_t *node)
 
const char * node_get_platform (const node_t *node)
 
uint32_t node_get_prim_addr_ipv4h (const node_t *node)
 
void node_get_address_string (const node_t *node, char *cp, size_t len)
 
long node_get_declared_uptime (const node_t *node)
 
const struct ed25519_public_key_tnode_get_ed25519_id (const node_t *node)
 
int node_ed25519_id_matches (const node_t *node, const struct ed25519_public_key_t *id)
 
int node_supports_ed25519_link_authentication (const node_t *node, int compatible_with_us)
 
int node_supports_v3_hsdir (const node_t *node)
 
int node_supports_ed25519_hs_intro (const node_t *node)
 
int node_supports_v3_rendezvous_point (const node_t *node)
 
const uint8_t * node_get_rsa_id_digest (const node_t *node)
 
int node_has_ipv6_addr (const node_t *node)
 
int node_has_ipv6_orport (const node_t *node)
 
int node_has_ipv6_dirport (const node_t *node)
 
int node_ipv6_or_preferred (const node_t *node)
 
void node_get_prim_orport (const node_t *node, tor_addr_port_t *ap_out)
 
void node_get_pref_orport (const node_t *node, tor_addr_port_t *ap_out)
 
void node_get_pref_ipv6_orport (const node_t *node, tor_addr_port_t *ap_out)
 
int node_ipv6_dir_preferred (const node_t *node)
 
void node_get_prim_dirport (const node_t *node, tor_addr_port_t *ap_out)
 
void node_get_pref_dirport (const node_t *node, tor_addr_port_t *ap_out)
 
void node_get_pref_ipv6_dirport (const node_t *node, tor_addr_port_t *ap_out)
 
int node_has_curve25519_onion_key (const node_t *node)
 
const struct curve25519_public_key_tnode_get_curve25519_onion_key (const node_t *node)
 
crypto_pk_tnode_get_rsa_onion_key (const node_t *node)
 
 MOCK_DECL (smartlist_t *, nodelist_get_list,(void))
 
void node_get_addr (const node_t *node, tor_addr_t *addr_out)
 
void nodelist_refresh_countries (void)
 
void node_set_country (node_t *node)
 
void nodelist_add_node_and_family (smartlist_t *nodes, const node_t *node)
 
int nodes_in_same_family (const node_t *node1, const node_t *node2)
 
const node_trouter_find_exact_exit_enclave (const char *address, uint16_t port)
 
int node_is_unreliable (const node_t *router, int need_uptime, int need_capacity, int need_guard)
 
int router_exit_policy_all_nodes_reject (const tor_addr_t *addr, uint16_t port, int need_uptime)
 
void router_set_status (const char *digest, int up)
 
int addrs_in_same_network_family (const tor_addr_t *a1, const tor_addr_t *a2)
 
 MOCK_DECL (int, router_have_minimum_dir_info,(void))
 
 MOCK_DECL (consensus_path_type_t, router_have_consensus_path,(void))
 
void router_dir_info_changed (void)
 
const char * get_dir_info_status_string (void)
 
int count_loading_descriptors_progress (void)
 
 MOCK_DECL (int, get_estimated_address_per_node,(void))
 

Detailed Description

Header file for nodelist.c.

Definition in file nodelist.h.

Macro Definition Documentation

◆ node_assert_ok

#define node_assert_ok (   n)
Value:
STMT_BEGIN { \
tor_assert((n)->ri || (n)->rs); \
} STMT_END

Definition at line 18 of file nodelist.h.

Enumeration Type Documentation

◆ consensus_path_type_t

Set to CONSENSUS_PATH_EXIT if there is at least one exit node in the consensus. We update this flag in compute_frac_paths_available if there is at least one relay that has an Exit flag in the consensus. Used to avoid building exit circuits when they will almost certainly fail. Set to CONSENSUS_PATH_INTERNAL if there are no exits in the consensus. (This situation typically occurs during bootstrap of a test network.) Set to CONSENSUS_PATH_UNKNOWN if we have never checked, or have reason to believe our last known value was invalid or has expired.

Definition at line 138 of file nodelist.h.

Function Documentation

◆ addrs_in_same_network_family()

int addrs_in_same_network_family ( const tor_addr_t a1,
const tor_addr_t a2 
)

Return true iff router1 and router2 have similar enough network addresses that we should treat them as being in the same family

Definition at line 1854 of file nodelist.c.

References tor_addr_compare_masked(), tor_addr_family(), and tor_addr_is_null().

Referenced by guard_in_node_family(), nodelist_add_node_and_family(), and nodes_in_same_family().

◆ count_loading_descriptors_progress()

int count_loading_descriptors_progress ( void  )

We just fetched a new set of descriptors. Compute how far through the "loading descriptors" bootstrapping phase we are, so we can inform the controller of our progress.

Definition at line 2529 of file nodelist.c.

References compute_frac_paths_available(), and get_frac_paths_needed_for_circs().

◆ get_dir_info_status_string()

const char* get_dir_info_status_string ( void  )

Return a string describing what we're missing before we have enough directory info.

Definition at line 2245 of file nodelist.c.

References dir_info_status.

Referenced by directory_info_has_arrived().

◆ MOCK_DECL()

MOCK_DECL ( int  ,
router_have_minimum_dir_info  ,
(void)   
)

router_have_minimum_dir_info tests to see if we have enough descriptor information to create circuits. If there are exits in the consensus, we wait until we have enough info to create exit paths before creating any circuits. If there are no exits in the consensus, we wait for enough info to create internal paths, and should avoid creating exit paths, as they will simply fail. We make sure we create all available circuit types at the same time.

◆ node_allows_single_hop_exits()

int node_allows_single_hop_exits ( const node_t node)

Return true iff it seems that node allows circuits to exit through it directlry from the client.

Definition at line 1312 of file nodelist.c.

References routerinfo_t::allow_single_hop_exits.

◆ node_exit_policy_is_exact()

int node_exit_policy_is_exact ( const node_t node,
sa_family_t  family 
)

Return true iff the exit policy for node is such that we can treat rejecting an address of type family unexpectedly as a sign of that node's failure.

Definition at line 1341 of file nodelist.c.

References tor_fragile_assert.

Referenced by adjust_exit_policy_from_exitpolicy_failure().

◆ node_exit_policy_rejects_all()

int node_exit_policy_rejects_all ( const node_t node)

Return true iff it seems that node has an exit policy that doesn't actually permit anything to exit, or we don't know its exit policy

Definition at line 1323 of file nodelist.c.

References microdesc_t::exit_policy, routerinfo_t::policy_is_reject_star, node_t::rejects_all, and short_policy_is_reject_star().

◆ node_get_addr()

void node_get_addr ( const node_t node,
tor_addr_t addr_out 
)

Wrapper around node_get_prim_orport for backward compatibility.

Definition at line 1436 of file nodelist.c.

References node_get_prim_orport(), and tor_addr_copy().

Referenced by guard_in_node_family(), nodelist_add_node_and_family(), and nodes_in_same_family().

◆ node_get_address_string()

void node_get_address_string ( const node_t node,
char *  buf,
size_t  len 
)

Copy a string representation of an IP address for node into the len-byte buffer at buf.

Definition at line 1463 of file nodelist.c.

References node_get_prim_addr_ipv4h().

◆ node_get_all_orports()

smartlist_t* node_get_all_orports ( const node_t node)

Return list of tor_addr_port_t with all OR ports (in the sense IP addr + TCP port) for node. Caller must free all elements using tor_free() and free the list using smartlist_free().

XXX this is potentially a memory fragmentation hog – if on critical path consider the option of having the caller allocate the memory

Definition at line 1398 of file nodelist.c.

Referenced by router_get_all_orports().

◆ node_get_by_hex_id()

const node_t* node_get_by_hex_id ( const char *  hex_id,
unsigned  flags 
)

Given a hex-encoded nickname of the format DIGEST, $DIGEST, $DIGEST=name, or $DIGEST~name, return the node with the matching identity digest and nickname (if any). Return NULL if no such node exists, or if hex_id is not well-formed. DOCDOC flags

Definition at line 959 of file nodelist.c.

References DIGEST_LEN, hex_digest_nickname_decode(), and MAX_NICKNAME_LEN.

Referenced by getinfo_helper_dir().

◆ node_get_curve25519_onion_key()

const struct curve25519_public_key_t* node_get_curve25519_onion_key ( const node_t node)

Return the curve25519 key of node, or NULL if none.

Definition at line 1783 of file nodelist.c.

Referenced by node_has_curve25519_onion_key(), and node_supports_v3_rendezvous_point().

◆ node_get_declared_uptime()

long node_get_declared_uptime ( const node_t node)

Return node's declared uptime, or -1 if it doesn't seem to have one.

Definition at line 1479 of file nodelist.c.

References routerinfo_t::uptime.

◆ node_get_ed25519_id()

const struct ed25519_public_key_t* node_get_ed25519_id ( const node_t node)

Return the Ed25519 identity key for the provided node, or NULL if it doesn't have one.

Definition at line 1051 of file nodelist.c.

References tor_cert_st::signing_key, and signed_descriptor_t::signing_key_cert.

Referenced by node_add_to_ed25519_map(), node_ed25519_id_matches(), node_supports_ed25519_link_authentication(), and nodelist_remove_microdesc().

◆ node_get_nickname()

const char* node_get_nickname ( const node_t node)

Return the nickname of node, or NULL if we can't find one.

Definition at line 1194 of file nodelist.c.

References routerstatus_t::nickname, routerinfo_t::nickname, and tor_assert().

Referenced by node_get_verbose_nickname(), node_nickname_matches(), nodefamily_contains_node(), and rep_hist_dump_stats().

◆ node_get_platform()

const char* node_get_platform ( const node_t node)

Return node's platform string, or NULL if we don't know it.

Definition at line 1489 of file nodelist.c.

References routerinfo_t::platform.

◆ node_get_pref_dirport()

void node_get_pref_dirport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the preferred Dir port (IP address and TCP port) for node into *ap_out.

Definition at line 1712 of file nodelist.c.

References node_get_pref_ipv6_dirport(), node_get_prim_dirport(), node_ipv6_dir_preferred(), and tor_assert().

◆ node_get_pref_ipv6_dirport()

void node_get_pref_ipv6_dirport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the preferred IPv6 Dir port (IP address and TCP port) for node into *ap_out.

Definition at line 1727 of file nodelist.c.

Referenced by node_get_pref_dirport().

◆ node_get_pref_ipv6_orport()

void node_get_pref_ipv6_orport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the preferred IPv6 OR port (IP address and TCP port) for node into *ap_out.

Definition at line 1624 of file nodelist.c.

Referenced by node_get_pref_orport(), nodelist_add_node_and_family(), and nodes_in_same_family().

◆ node_get_pref_orport()

void node_get_pref_orport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the preferred OR port (IP address and TCP port) for node into *ap_out.

Definition at line 1609 of file nodelist.c.

References node_get_pref_ipv6_orport(), node_get_prim_orport(), node_ipv6_or_preferred(), and tor_assert().

◆ node_get_prim_addr_ipv4h()

uint32_t node_get_prim_addr_ipv4h ( const node_t node)

Return the host-order IPv4 address for node, or 0 if it doesn't seem to have one.

Definition at line 1446 of file nodelist.c.

Referenced by node_get_address_string().

◆ node_get_prim_dirport()

void node_get_prim_dirport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the primary (IPv4) Dir port (IP address and TCP port) for node into *ap_out.

Definition at line 1689 of file nodelist.c.

Referenced by node_get_pref_dirport().

◆ node_get_prim_orport()

void node_get_prim_orport ( const node_t node,
tor_addr_port_t ap_out 
)

Copy the primary (IPv4) OR port (IP address and TCP port) for node into *ap_out.

Definition at line 1588 of file nodelist.c.

Referenced by node_get_addr(), and node_get_pref_orport().

◆ node_get_purpose()

int node_get_purpose ( const node_t node)

Return the router_purpose of node.

Definition at line 1265 of file nodelist.c.

References routerinfo_t::purpose.

◆ node_get_rsa_id_digest()

const uint8_t* node_get_rsa_id_digest ( const node_t node)

Return the RSA ID key's SHA1 digest for the provided node.

Definition at line 1186 of file nodelist.c.

References node_t::identity, and tor_assert().

Referenced by nodefamily_contains_node().

◆ node_get_verbose_nickname()

void node_get_verbose_nickname ( const node_t node,
char *  verbose_name_out 
)

Compute the verbose ("extended") nickname of node and store it into the MAX_VERBOSE_NICKNAME_LEN+1 character buffer at verbose_name_out

Definition at line 1277 of file nodelist.c.

References base16_encode(), DIGEST_LEN, HEX_DIGEST_LEN, node_t::identity, and node_get_nickname().

Referenced by node_get_verbose_nickname_by_id().

◆ node_get_verbose_nickname_by_id()

void node_get_verbose_nickname_by_id ( const char *  id_digest,
char *  verbose_name_out 
)

Compute the verbose ("extended") nickname of node with given id_digest and store it into the MAX_VERBOSE_NICKNAME_LEN+1 character buffer at verbose_name_out

If node_get_by_id() returns NULL, base 16 encoding of id_digest is returned instead.

Definition at line 1297 of file nodelist.c.

References base16_encode(), DIGEST_LEN, HEX_DIGEST_LEN, and node_get_verbose_nickname().

Referenced by MOCK_IMPL().

◆ node_has_any_descriptor()

int node_has_any_descriptor ( const node_t node)

Return true iff node has either kind of descriptor – that is, a routerdescriptor or a microdescriptor.

You should probably use node_has_preferred_descriptor() instead.

Definition at line 1231 of file nodelist.c.

◆ node_has_curve25519_onion_key()

int node_has_curve25519_onion_key ( const node_t node)

Return true iff node has a curve25519 onion key.

Definition at line 1776 of file nodelist.c.

References node_get_curve25519_onion_key().

◆ node_has_preferred_descriptor()

int node_has_preferred_descriptor ( const node_t node,
int  for_direct_connect 
)

Return true iff node has the kind of descriptor we would prefer to use for it, given our configuration and how we intend to use the node.

If for_direct_connect is true, we intend to connect to the node directly, as the first hop of a circuit; otherwise, we intend to connect to it indirectly, or use it as if we were connecting to it indirectly.

Definition at line 1244 of file nodelist.c.

References node_is_a_configured_bridge(), and we_use_microdescriptors_for_circuits().

Referenced by extend_info_from_node(), guard_has_descriptor(), hs_pick_hsdir(), and node_has_hsdir_index().

◆ node_ipv6_dir_preferred()

int node_ipv6_dir_preferred ( const node_t node)

Return 1 if we prefer the IPv6 address and Dir TCP port of node, else 0.

We prefer the IPv6 address if the router has an IPv6 address, and we can use IPv6 addresses, and: i) the router has no IPv4 Dir address. or ii) our preference is for IPv6 Dir addresses.

If there is no node, use fascist_firewall_prefer_ipv6_dirport().

Definition at line 1666 of file nodelist.c.

Referenced by node_get_pref_dirport().

◆ node_ipv6_or_preferred()

int node_ipv6_or_preferred ( const node_t node)

Return 1 if we prefer the IPv6 address and OR TCP port of node, else 0.

We prefer the IPv6 address if the router has an IPv6 address, and we can use IPv6 addresses, and: i) the node_t says that it prefers IPv6 or ii) the router has no IPv4 OR address.

If you don't have a node, consider looking it up. If there is no node, use fascist_firewall_prefer_ipv6_orport().

Definition at line 1558 of file nodelist.c.

Referenced by node_get_pref_orport().

◆ node_is_dir()

int node_is_dir ( const node_t node)

Return true iff node appears to be a directory authority or directory cache

Definition at line 1208 of file nodelist.c.

References routerinfo_t::supports_tunnelled_dir_requests.

Referenced by node_is_possible_guard().

◆ node_is_good_exit()

int node_is_good_exit ( const node_t node)

Return 1 iff node has Exit flag and no BadExit flag. Otherwise, return 0.

Definition at line 698 of file nodelist.c.

References node_t::is_bad_exit, and node_t::is_exit.

◆ node_is_me()

int node_is_me ( const node_t node)

Return true iff node is one representing this router.

Definition at line 1502 of file nodelist.c.

References node_t::identity, and router_digest_is_me().

◆ node_is_unreliable()

int node_is_unreliable ( const node_t node,
int  need_uptime,
int  need_capacity,
int  need_guard 
)

Return 1 if router is not suitable for these parameters, else 0. If need_uptime is non-zero, we require a minimum uptime. If need_capacity is non-zero, we require a minimum advertised bandwidth. If need_guard, we require that the router is a possible entry guard.

Definition at line 2099 of file nodelist.c.

References node_t::is_possible_guard, and node_t::is_stable.

Referenced by router_exit_policy_all_nodes_reject().

◆ node_set_country()

void node_set_country ( node_t node)

Refresh the country code of ri. This function MUST be called on each router when the GeoIP database is reloaded, and on all new routers.

Definition at line 1829 of file nodelist.c.

Referenced by nodelist_refresh_countries(), and nodelist_set_routerinfo().

◆ node_supports_ed25519_hs_intro()

int node_supports_ed25519_hs_intro ( const node_t node)

Return true iff node supports ed25519 authentication as an hidden service introduction point.

Definition at line 1162 of file nodelist.c.

References node_get_protover_summary_flags(), protover_summary_flags_t::supports_ed25519_hs_intro, and tor_assert().

◆ node_supports_ed25519_link_authentication()

int node_supports_ed25519_link_authentication ( const node_t node,
int  compatible_with_us 
)

Return true iff node supports authenticating itself by ed25519 ID during the link handshake. If compatible_with_us, it needs to be using a link authentication method that we understand. If not, any plausible link authentication method will do.

Definition at line 1135 of file nodelist.c.

References node_get_ed25519_id(), node_get_protover_summary_flags(), protover_summary_flags_t::supports_ed25519_link_handshake_any, and protover_summary_flags_t::supports_ed25519_link_handshake_compat.

Referenced by dirserv_orconn_tls_done(), and dirserv_single_reachability_test().

◆ node_supports_v3_hsdir()

int node_supports_v3_hsdir ( const node_t node)

Return true iff node supports the hidden service directory version 3 protocol (proposal 224).

Definition at line 1152 of file nodelist.c.

References node_get_protover_summary_flags(), protover_summary_flags_t::supports_v3_hsdir, and tor_assert().

Referenced by node_has_hsdir_index().

◆ node_supports_v3_rendezvous_point()

int node_supports_v3_rendezvous_point ( const node_t node)

Return true iff node supports to be a rendezvous point for hidden service version 3 (HSRend=2).

Definition at line 1172 of file nodelist.c.

References node_get_curve25519_onion_key(), node_get_protover_summary_flags(), protover_summary_flags_t::supports_v3_rendezvous_point, and tor_assert().

◆ nodelist_add_microdesc()

node_t* nodelist_add_microdesc ( microdesc_t md)

Set the appropriate node_t to use md as its microdescriptor.

Called when a new microdesc has arrived and the usable consensus flavor is "microdesc".

Definition at line 549 of file nodelist.c.

◆ nodelist_add_node_and_family()

void nodelist_add_node_and_family ( smartlist_t sl,
const node_t node 
)

Add all the family of node, including node itself, to the smartlist sl.

This is used to make sure we don't pick siblings in a single path, or pick more than one relay from a family for our entry guard list. Note that a node may be added to sl more than once if it is part of node's family for more than one reason.

Definition at line 2003 of file nodelist.c.

References addrs_in_same_network_family(), or_options_t::EnforceDistinctSubnets, node_t::identity, node_get_addr(), node_get_pref_ipv6_orport(), smartlist_add(), SMARTLIST_FOREACH_BEGIN, and tor_assert().

Referenced by build_middle_exclude_list(), and routerlist_add_node_and_family().

◆ nodelist_assert_ok()

void nodelist_assert_ok ( void  )

Check that the nodelist is internally consistent, and consistent with the directory info it's derived from.

Definition at line 851 of file nodelist.c.

References router_get_routerlist(), routerlist_t::routers, SMARTLIST_FOREACH_BEGIN, and tor_assert().

Referenced by dirserv_compute_performance_thresholds().

◆ nodelist_ensure_freshness()

void nodelist_ensure_freshness ( networkstatus_t ns)

Ensure that the nodelist has been created with the most recent consensus. If that's not the case, make it so.

Definition at line 928 of file nodelist.c.

References tor_assert(), and networkstatus_t::valid_after.

◆ nodelist_find_nodes_with_microdesc()

smartlist_t* nodelist_find_nodes_with_microdesc ( const microdesc_t md)

Return a newly allocated smartlist of the nodes that have md as their microdescriptor.

Definition at line 767 of file nodelist.c.

References smartlist_add(), and SMARTLIST_FOREACH_BEGIN.

◆ nodelist_free_all()

void nodelist_free_all ( void  )

Release all storage held by the nodelist.

Definition at line 827 of file nodelist.c.

◆ nodelist_probably_contains_address()

int nodelist_probably_contains_address ( const tor_addr_t addr)

Return true if addr is the address of some node in the nodelist. If not, probably return false.

Definition at line 477 of file nodelist.c.

◆ nodelist_purge()

void nodelist_purge ( void  )

Remove all entries from the nodelist that don't have enough info to be usable for anything.

Definition at line 798 of file nodelist.c.

◆ nodelist_refresh_countries()

void nodelist_refresh_countries ( void  )

Set the country code of all routers in the routerlist.

Definition at line 1844 of file nodelist.c.

References node_set_country(), and SMARTLIST_FOREACH.

Referenced by refresh_all_country_info().

◆ nodelist_remove_microdesc()

void nodelist_remove_microdesc ( const char *  identity_digest,
microdesc_t md 
)

Tell the nodelist that md is no longer a microdescriptor for the node with identity_digest.

Definition at line 713 of file nodelist.c.

References microdesc_t::held_by_nodes, node_get_ed25519_id(), and node_remove_from_ed25519_map().

◆ nodelist_remove_routerinfo()

void nodelist_remove_routerinfo ( routerinfo_t ri)

Tell the nodelist that ri is no longer in the routerlist.

Definition at line 727 of file nodelist.c.

References signed_descriptor_t::identity_digest, node_is_usable(), and nodelist_drop_node().

◆ nodelist_set_consensus()

void nodelist_set_consensus ( networkstatus_t ns)

Tell the nodelist that the current usable consensus is ns. This makes the nodelist change all of the routerstatus entries for the nodes, drop nodes that no longer have enough info to get used, and grab microdescriptors into nodes as appropriate.

Definition at line 603 of file nodelist.c.

◆ nodelist_set_routerinfo()

node_t* nodelist_set_routerinfo ( routerinfo_t ri,
routerinfo_t **  ri_old_out 
)

Add ri to an appropriate node in the nodelist. If we replace an old routerinfo, and ri_old_out is not NULL, set *ri_old_out to the previous routerinfo.

Definition at line 493 of file nodelist.c.

References authdir_mode(), node_t::country, signed_descriptor_t::identity_digest, node_add_to_ed25519_map(), node_addrs_changed(), node_get_or_create(), node_remove_from_ed25519_map(), node_set_country(), routers_have_same_or_addrs(), and tor_assert().

◆ nodes_in_same_family()

int nodes_in_same_family ( const node_t node1,
const node_t node2 
)

Return true iff r1 and r2 are in the same family, but not the same router.

Definition at line 1956 of file nodelist.c.

References addrs_in_same_network_family(), or_options_t::EnforceDistinctSubnets, node_family_contains(), node_get_addr(), node_get_pref_ipv6_orport(), or_options_t::NodeFamilySets, and SMARTLIST_FOREACH.

Referenced by guard_in_node_family().

◆ router_dir_info_changed()

void router_dir_info_changed ( void  )

Called when our internal view of the directory has changed. This can be when the authorities change, networkstatuses change, the list of routerdescs changes, or number of running routers changes.

Definition at line 2234 of file nodelist.c.

References need_to_update_have_min_dir_info, and rend_hsdir_routers_changed().

Referenced by check_expired_networkstatus_callback(), and dir_server_add().

◆ router_exit_policy_all_nodes_reject()

int router_exit_policy_all_nodes_reject ( const tor_addr_t addr,
uint16_t  port,
int  need_uptime 
)

Return 1 if all running sufficiently-stable routers we can use will reject addr:port. Return 0 if any might accept it.

Definition at line 2114 of file nodelist.c.

References ADDR_POLICY_PROBABLY_REJECTED, ADDR_POLICY_REJECTED, compare_tor_addr_to_node_policy(), node_t::is_running, node_is_unreliable(), and SMARTLIST_FOREACH_BEGIN.

◆ router_find_exact_exit_enclave()

const node_t* router_find_exact_exit_enclave ( const char *  address,
uint16_t  port 
)

Find a router that's up, that has this IP address, and that allows exit to this address:port, or return NULL if there isn't a good one. Don't exit enclave to excluded relays – it wouldn't actually hurt anything, but this way there are fewer confused users.

Definition at line 2068 of file nodelist.c.

References SMARTLIST_FOREACH, tor_addr_from_ipv4h, and tor_inet_aton().

◆ router_set_status()

void router_set_status ( const char *  digest,
int  up 
)

Mark the router with ID digest as running or non-running in our routerlist.

Definition at line 2135 of file nodelist.c.

References SMARTLIST_FOREACH, and tor_assert().

Referenced by channel_do_open_actions(), connection_dir_client_request_failed(), and learned_bridge_descriptor().