tor  0.4.2.1-alpha-dev
Macros | Functions | Variables
relay_periodic.c File Reference
#include "orconfig.h"
#include "core/or/or.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 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 subsytem.

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)

Definition at line 34 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 118 of file relay_periodic.c.

References check_descriptor_bandwidth_changed(), check_descriptor_ipaddress_changed(), consider_publishable_server(), and mark_my_descriptor_dirty_if_too_old().

◆ 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 64 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.

Definition at line 149 of file relay_periodic.c.

References any_predicted_circuits(), have_completed_a_circuit(), router_do_reachability_checks(), and TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT.

◆ 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 189 of file relay_periodic.c.

References routerinfo_t::addr, check_whether_orport_reachable(), have_completed_a_circuit(), TIMEOUT_UNTIL_UNREACHABILITY_COMPLAINT, and tor_dup_ip().

◆ 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 305 of file relay_periodic.c.

References periodic_event_reschedule().

◆ 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 46 of file relay_periodic.c.

References dns_init(), and has_dns_init_failed().