Tor  0.4.7.0-alpha-dev
Enumerations | Functions
relay_find_addr.h File Reference

Header file for relay_find_addr.c. More...

Go to the source code of this file.

Enumerations

enum  relay_find_addr_flags_t { RELAY_FIND_ADDR_NO_FLAG = (1U << 0) , RELAY_FIND_ADDR_CACHE_ONLY = (1U << 1) }
 

Functions

void relay_address_new_suggestion (const tor_addr_t *suggested_addr, const tor_addr_t *peer_addr, const char *identity_digest)
 
bool relay_find_addr_to_publish (const or_options_t *options, int family, int flags, tor_addr_t *addr_out)
 
void relay_addr_learn_from_dirauth (void)
 

Detailed Description

Header file for relay_find_addr.c.

Definition in file relay_find_addr.h.

Function Documentation

◆ relay_address_new_suggestion()

void relay_address_new_suggestion ( const tor_addr_t suggested_addr,
const tor_addr_t peer_addr,
const char *  identity_digest 
)

Consider the address suggestion suggested_addr as a possible one to use as our address.

This is called when a valid NETINFO cell is received containing a candidate for our address or when a directory sends us back the X-Your-Address-Is header.

The suggested address is ignored if it does NOT come from a trusted source. At the moment, we only look a trusted directory authorities.

The suggested address is ignored if it is internal or it is the same as the given peer_addr which is the address from the endpoint that sent the NETINFO cell.

The identity_digest is NULL if this is an address suggested by a directory since this is a plaintext connection.

The suggested address is set in our suggested address cache if everything passes.

Definition at line 49 of file relay_find_addr.c.

◆ relay_find_addr_to_publish()

bool relay_find_addr_to_publish ( const or_options_t options,
int  family,
int  flags,
tor_addr_t addr_out 
)

Find our address to be published in our descriptor. Three places are looked at:

  1. Resolved cache. Populated by find_my_address() during the relay periodic event that attempts to learn if our address has changed.
  2. If flags is set with RELAY_FIND_ADDR_CACHE_ONLY, only the resolved and suggested cache are looked at. No address discovery will be done.
  3. Finally, if all fails, use the suggested address cache which is populated by the NETINFO cell content or HTTP header from a directory.

The AddressDisableIPv6 is checked here for IPv6 address discovery and if set, false is returned and addr_out is UNSPEC.

Before doing any discovery, the configuration is checked for an ORPort of the given family. If none can be found, false is returned and addr_out is UNSPEC.

Return true on success and addr_out contains the address to use for the given family. On failure to find the address, false is returned and addr_out is set to an AF_UNSPEC address.

Definition at line 114 of file relay_find_addr.c.

Referenced by pt_get_extra_info_descriptor_string().