Tor  0.4.7.0-alpha-dev
Macros | Functions | Variables
relay_periodic.c File Reference

Periodic functions for the relay subsystem. More...

#include "orconfig.h"
#include "core/or/or.h"
#include "app/config/resolve_addr.h"
#include "core/mainloop/periodic.h"
#include "core/mainloop/cpuworker.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/netstatus.h"
#include "core/or/circuituse.h"
#include "feature/relay/dns.h"
#include "feature/relay/relay_periodic.h"
#include "feature/relay/router.h"
#include "feature/relay/routerkeys.h"
#include "feature/relay/routermode.h"
#include "feature/relay/selftest.h"
#include "feature/stats/predict_ports.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "feature/nodelist/routerinfo_st.h"
#include "feature/control/control_events.h"

Go to the source code of this file.

Macros

#define DECLARE_EVENT(name, roles, flags)
 
#define FL(name)   (PERIODIC_EVENT_FLAG_##name)
 
#define RETRY_DNS_INTERVAL   (10*60)
 
#define CHECK_DESCRIPTOR_INTERVAL   (60)
 
#define EARLY_CHECK_REACHABILITY_INTERVAL   (60)
 
#define BANDWIDTH_RECHECK_INTERVAL   (12*60*60)
 

Functions

static int retry_dns_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (retry_dns, ROUTER, 0)
 
static int check_dns_honesty_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (check_dns_honesty, RELAY, FL(NEED_NET))
 
static int rotate_onion_key_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (rotate_onion_key, ROUTER, 0)
 
static int check_descriptor_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (check_descriptor, ROUTER, FL(NEED_NET))
 
static int check_for_reachability_bw_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (check_for_reachability_bw, ROUTER, FL(NEED_NET))
 
static int reachability_warnings_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (reachability_warnings, ROUTER, FL(NEED_NET))
 
static int check_ed_keys_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (check_ed_keys, ROUTER, 0)
 
static int check_onion_keys_expiry_time_callback (time_t now, const or_options_t *options)
 
 DECLARE_EVENT (check_onion_keys_expiry_time, ROUTER, 0)
 
void relay_register_periodic_events (void)
 
void reschedule_descriptor_update_check (void)
 

Variables

static int dns_honesty_first_time = 1
 
static int dirport_reachability_count = 0
 

Detailed Description

Periodic functions for the relay subsystem.

Definition in file relay_periodic.c.

Macro Definition Documentation

◆ DECLARE_EVENT

#define DECLARE_EVENT (   name,
  roles,
  flags 
)
Value:
static periodic_event_item_t name ## _event = \
PERIODIC_EVENT(name, \
PERIODIC_EVENT_ROLE_##roles, \
flags)
const char * name
Definition: config.c:2434

Definition at line 37 of file relay_periodic.c.

Function Documentation

◆ check_descriptor_callback()

static int check_descriptor_callback ( time_t  now,
const or_options_t options 
)
static

Periodic callback: consider rebuilding or and re-uploading our descriptor (if we've passed our internal checks).

How often do we check whether part of our router info has changed in a way that would require an upload? That includes checking whether our IP address has changed.

Definition at line 122 of file relay_periodic.c.

◆ check_dns_honesty_callback()

static int check_dns_honesty_callback ( time_t  now,
const or_options_t options 
)
static

Periodic event: if we're an exit, see if our DNS server is telling us obvious lies.

Definition at line 68 of file relay_periodic.c.

◆ check_for_reachability_bw_callback()

static int check_for_reachability_bw_callback ( time_t  now,
const or_options_t options 
)
static

Periodic callback: check whether we're reachable (as a relay), and whether our bandwidth has changed enough that we need to publish a new descriptor.

How often should we consider launching reachability tests in our first TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT seconds?

Definition at line 153 of file relay_periodic.c.

◆ reachability_warnings_callback()

static int reachability_warnings_callback ( time_t  now,
const or_options_t options 
)
static

Callback: Send warnings if Tor doesn't find its ports reachable.

Definition at line 194 of file relay_periodic.c.

◆ reschedule_descriptor_update_check()

void reschedule_descriptor_update_check ( void  )

Update our schedule so that we'll check whether we need to update our descriptor immediately, rather than after up to CHECK_DESCRIPTOR_INTERVAL seconds.

Definition at line 342 of file relay_periodic.c.

◆ retry_dns_callback()

static int retry_dns_callback ( time_t  now,
const or_options_t options 
)
static

Periodic callback: If we're a server and initializing dns failed, retry.

Definition at line 50 of file relay_periodic.c.