Tor 0.4.9.0-alpha-dev
Macros | Functions
relay_find_addr.c File Reference

Implement mechanism for a relay to find its address. More...

#include "core/or/or.h"
#include "app/config/config.h"
#include "app/config/resolve_addr.h"
#include "core/mainloop/mainloop.h"
#include "core/or/circuitlist.h"
#include "core/or/circuituse.h"
#include "core/or/extendinfo.h"
#include "feature/control/control_events.h"
#include "feature/dircommon/dir_connection_st.h"
#include "feature/nodelist/dirlist.h"
#include "feature/nodelist/node_select.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerstatus_st.h"
#include "feature/relay/relay_find_addr.h"
#include "feature/relay/router.h"
#include "feature/relay/routermode.h"

Go to the source code of this file.

Macros

#define DUMMY_DOWNLOAD_INTERVAL   (20*60)
 

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

Implement mechanism for a relay to find its address.

Definition in file relay_find_addr.c.

Macro Definition Documentation

◆ DUMMY_DOWNLOAD_INTERVAL

#define DUMMY_DOWNLOAD_INTERVAL   (20*60)

How often should we launch a circuit to an authority to be sure of getting a guess for our IP?

Definition at line 177 of file relay_find_addr.c.

Function Documentation

◆ relay_addr_learn_from_dirauth()

void relay_addr_learn_from_dirauth ( void  )

Definition at line 180 of file relay_find_addr.c.

◆ 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().