Tor 0.4.9.0-alpha-dev
Data Structures | Macros | Functions | Variables
networkstatus.c File Reference

Functions and structures for handling networkstatus documents as a client or as a directory cache. More...

#include "core/or/or.h"
#include "app/config/config.h"
#include "core/mainloop/connection.h"
#include "core/mainloop/cpuworker.h"
#include "core/mainloop/mainloop.h"
#include "core/mainloop/netstatus.h"
#include "core/or/channel.h"
#include "core/or/channelpadding.h"
#include "core/or/circuitpadding.h"
#include "core/or/congestion_control_common.h"
#include "core/or/congestion_control_flow.h"
#include "core/or/circuitmux.h"
#include "core/or/circuitmux_ewma.h"
#include "core/or/circuitstats.h"
#include "core/or/conflux_params.h"
#include "core/or/connection_edge.h"
#include "core/or/connection_or.h"
#include "core/or/dos.h"
#include "core/or/protover.h"
#include "core/or/relay.h"
#include "core/or/scheduler.h"
#include "core/or/versions.h"
#include "feature/client/bridges.h"
#include "feature/client/entrynodes.h"
#include "feature/client/transports.h"
#include "feature/control/control_events.h"
#include "feature/dirauth/reachability.h"
#include "feature/dircache/consdiffmgr.h"
#include "feature/dircache/dirserv.h"
#include "feature/dirclient/dirclient.h"
#include "feature/dirclient/dirclient_modes.h"
#include "feature/dirclient/dlstatus.h"
#include "feature/dircommon/directory.h"
#include "feature/dirauth/voting_schedule.h"
#include "feature/dirparse/ns_parse.h"
#include "feature/hibernate/hibernate.h"
#include "feature/hs/hs_dos.h"
#include "feature/nodelist/authcert.h"
#include "feature/nodelist/dirlist.h"
#include "feature/nodelist/fmt_routerstatus.h"
#include "feature/nodelist/microdesc.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/node_select.h"
#include "feature/nodelist/nodelist.h"
#include "feature/nodelist/routerinfo.h"
#include "feature/nodelist/routerlist.h"
#include "feature/nodelist/torcert.h"
#include "feature/relay/dns.h"
#include "feature/relay/onion_queue.h"
#include "feature/relay/routermode.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_util.h"
#include "feature/dirauth/dirauth_periodic.h"
#include "feature/dirauth/dirvote.h"
#include "feature/dirauth/authmode.h"
#include "feature/dirauth/shared_random.h"
#include "feature/dirauth/voteflags.h"
#include "feature/nodelist/authority_cert_st.h"
#include "feature/dircommon/dir_connection_st.h"
#include "feature/dirclient/dir_server_st.h"
#include "feature/nodelist/document_signature_st.h"
#include "feature/nodelist/networkstatus_st.h"
#include "feature/nodelist/networkstatus_voter_info_st.h"
#include "feature/dirauth/ns_detached_signatures_st.h"
#include "feature/nodelist/node_st.h"
#include "feature/nodelist/routerinfo_st.h"
#include "feature/nodelist/routerlist_st.h"
#include "feature/dirauth/vote_microdesc_hash_st.h"
#include "feature/nodelist/vote_routerstatus_st.h"
#include "feature/nodelist/routerstatus_st.h"
#include "feature/stats/rephist.h"

Go to the source code of this file.

Data Structures

struct  consensus_waiting_for_certs_t
 

Macros

#define NETWORKSTATUS_PRIVATE
 
#define N_CONSENSUS_BOOTSTRAP_SCHEDULES   2
 
#define CONSENSUS_BOOTSTRAP_SOURCE_AUTHORITY   0
 
#define CONSENSUS_BOOTSTRAP_SOURCE_ANY_DIRSERVER   1
 
#define NETWORKSTATUS_ALLOW_SKEW   (24*60*60)
 
#define AUTHORITY_NS_CACHE_INTERVAL   (10*60)
 
#define NONAUTHORITY_NS_CACHE_INTERVAL   (60*60)
 
#define DELAY_WHILE_FETCHING_CERTS   (20*60)
 
#define MIN_DELAY_FOR_FETCH_CERT_STATUS_FAILURE   (1*60)
 
#define CONSENSUS_MIN_SECONDS_BEFORE_CACHING   120
 
#define REASONABLY_LIVE_TIME   (24*60*60)
 
#define EARLY_CONSENSUS_NOTICE_SKEW   60
 

Functions

static void update_consensus_bootstrap_multiple_downloads (time_t now, const or_options_t *options)
 
static int networkstatus_check_required_protocols (const networkstatus_t *ns, int client_mode, char **warning_out)
 
static int reload_consensus_from_file (const char *fname, const char *flavor, unsigned flags, const char *source_dir)
 
void networkstatus_reset_warnings (void)
 
void networkstatus_reset_download_failures (void)
 
char * networkstatus_get_cache_fname (int flav, const char *flavorname, int unverified_consensus)
 
static tor_mmap_tnetworkstatus_map_cached_consensus_impl (int flav, const char *flavorname, int unverified_consensus)
 
tor_mmap_tnetworkstatus_map_cached_consensus (const char *flavorname)
 
int router_reload_consensus_networkstatus (void)
 
void vote_routerstatus_free_ (vote_routerstatus_t *rs)
 
void routerstatus_free_ (routerstatus_t *rs)
 
void document_signature_free_ (document_signature_t *sig)
 
document_signature_tdocument_signature_dup (const document_signature_t *sig)
 
void networkstatus_vote_free_ (networkstatus_t *ns)
 
networkstatus_voter_info_tnetworkstatus_get_voter_by_id (networkstatus_t *vote, const char *identity)
 
document_signature_tnetworkstatus_get_voter_sig_by_alg (const networkstatus_voter_info_t *voter, digest_algorithm_t alg)
 
int networkstatus_check_document_signature (const networkstatus_t *consensus, document_signature_t *sig, const authority_cert_t *cert)
 
int networkstatus_check_consensus_signature (networkstatus_t *consensus, int warn)
 
int compare_digest_to_routerstatus_entry (const void *_key, const void **_member)
 
int compare_digest_to_vote_routerstatus_entry (const void *_key, const void **_member)
 
routerstatus_tnetworkstatus_vote_find_mutable_entry (networkstatus_t *ns, const char *digest)
 
const routerstatus_tnetworkstatus_vote_find_entry (networkstatus_t *ns, const char *digest)
 
int networkstatus_vote_find_entry_idx (networkstatus_t *ns, const char *digest, int *found_out)
 
routerstatus_trouter_get_mutable_consensus_status_by_descriptor_digest (networkstatus_t *consensus, const char *digest)
 
const routerstatus_trouter_get_consensus_status_by_descriptor_digest (networkstatus_t *consensus, const char *digest)
 
static smartlist_trouter_get_descriptor_digests_in_consensus (networkstatus_t *consensus)
 
smartlist_trouter_get_descriptor_digests (void)
 
download_status_trouter_get_dl_status_by_descriptor_digest (const char *d)
 
routerstatus_trouter_get_mutable_consensus_status_by_id (const char *digest)
 
const routerstatus_trouter_get_consensus_status_by_id (const char *digest)
 
int we_want_to_fetch_flavor (const or_options_t *options, int flavor)
 
int we_want_to_fetch_unknown_auth_certs (const or_options_t *options)
 
static int check_consensus_waiting_for_certs (int flavor, time_t now, download_status_t *dls)
 
static void update_consensus_networkstatus_downloads (time_t now)
 
static void update_consensus_bootstrap_attempt_downloads (time_t now, download_status_t *dls, download_want_authority_t want_authority)
 
void networkstatus_consensus_download_failed (int status_code, const char *flavname)
 
static void update_consensus_networkstatus_fetch_time_impl (time_t now, int flav)
 
void update_consensus_networkstatus_fetch_time (time_t now)
 
int should_delay_dir_fetches (const or_options_t *options, const char **msg_out)
 
void update_networkstatus_downloads (time_t now)
 
void update_certificate_downloads (time_t now)
 
int consensus_is_waiting_for_certs (void)
 
download_status_tnetworkstatus_get_dl_status_by_flavor (consensus_flavor_t flavor)
 
download_status_tnetworkstatus_get_dl_status_by_flavor_bootstrap (consensus_flavor_t flavor)
 
download_status_tnetworkstatus_get_dl_status_by_flavor_running (consensus_flavor_t flavor)
 
networkstatus_tnetworkstatus_get_latest_consensus (void)
 
networkstatus_tnetworkstatus_get_latest_consensus_by_flavor (consensus_flavor_t f)
 
networkstatus_tnetworkstatus_get_live_consensus (time_t now)
 
int networkstatus_is_live (const networkstatus_t *ns, time_t now)
 
int networkstatus_consensus_reasonably_live (const networkstatus_t *consensus, time_t now)
 
int networkstatus_valid_after_is_reasonably_live (time_t valid_after, time_t now)
 
int networkstatus_valid_until_is_reasonably_live (time_t valid_until, time_t now)
 
networkstatus_tnetworkstatus_get_reasonably_live_consensus (time_t now, int flavor)
 
int networkstatus_consensus_is_bootstrapping (time_t now)
 
int networkstatus_consensus_can_use_multiple_directories (const or_options_t *options)
 
int networkstatus_consensus_can_use_extra_fallbacks (const or_options_t *options)
 
int networkstatus_consensus_is_already_downloading (const char *resource)
 
STATIC int routerstatus_has_visibly_changed (const routerstatus_t *a, const routerstatus_t *b)
 
static void notify_control_networkstatus_changed (const networkstatus_t *old_c, const networkstatus_t *new_c)
 
static void notify_before_networkstatus_changes (const networkstatus_t *old_c, const networkstatus_t *new_c)
 
static void notify_after_networkstatus_changes (void)
 
static void networkstatus_copy_old_consensus_info (networkstatus_t *new_c, const networkstatus_t *old_c)
 
static void handle_missing_protocol_warning_impl (const networkstatus_t *c, int is_client)
 
static void handle_missing_protocol_warning (const networkstatus_t *c, const or_options_t *options)
 
STATIC void warn_early_consensus (const networkstatus_t *c, const char *flavor, time_t now)
 
int networkstatus_set_current_consensus (const char *consensus, size_t consensus_len, const char *flavor, unsigned flags, const char *source_dir)
 
void networkstatus_note_certs_arrived (const char *source_dir)
 
void routers_update_all_from_networkstatus (time_t now, int dir_version)
 
void routers_update_status_from_consensus_networkstatus (smartlist_t *routers, int reset_failures)
 
void signed_descs_update_status_from_consensus_networkstatus (smartlist_t *descs)
 
char * networkstatus_getinfo_helper_single (const routerstatus_t *rs)
 
void set_routerstatus_from_routerinfo (routerstatus_t *rs, const node_t *node, const routerinfo_t *ri)
 
char * networkstatus_getinfo_by_purpose (const char *purpose_string, time_t now)
 
static int32_t get_net_param_from_list (smartlist_t *net_params, const char *param_name, int32_t default_val, int32_t min_val, int32_t max_val)
 
int32_t networkstatus_get_param (const networkstatus_t *ns, const char *param_name, int32_t default_val, int32_t min_val, int32_t max_val)
 
int32_t networkstatus_get_overridable_param (const networkstatus_t *ns, int32_t torrc_value, const char *param_name, int32_t default_val, int32_t min_val, int32_t max_val)
 
int networkstatus_get_weight_scale_param (networkstatus_t *ns)
 
int32_t networkstatus_get_bw_weight (networkstatus_t *ns, const char *weight_name, int32_t default_val)
 
const char * networkstatus_get_flavor_name (consensus_flavor_t flav)
 
int networkstatus_parse_flavor_name (const char *flavname)
 
int client_would_use_router (const routerstatus_t *rs, time_t now)
 
int getinfo_helper_networkstatus (control_connection_t *conn, const char *question, char **answer, const char **errmsg)
 
void networkstatus_free_all (void)
 
time_t voting_sched_get_start_of_interval_after (time_t now, int interval, int offset)
 

Variables

STATIC networkstatus_tcurrent_ns_consensus = NULL
 
STATIC networkstatus_tcurrent_md_consensus = NULL
 
static consensus_waiting_for_certs_t consensus_waiting_for_certs [N_CONSENSUS_FLAVORS]
 
static time_t time_to_download_next_consensus [N_CONSENSUS_FLAVORS]
 
static download_status_t consensus_dl_status [N_CONSENSUS_FLAVORS]
 
static download_status_t consensus_bootstrap_dl_status [N_CONSENSUS_BOOTSTRAP_SCHEDULES]
 
static int have_warned_about_old_version = 0
 
static int have_warned_about_new_version = 0
 

Detailed Description

Functions and structures for handling networkstatus documents as a client or as a directory cache.

A consensus networkstatus object is created by the directory authorities. It authenticates a set of network parameters–most importantly, the list of all the relays in the network. This list of relays is represented as an array of routerstatus_t objects.

There are currently two flavors of consensus. With the older "NS" flavor, each relay is associated with a digest of its router descriptor. Tor instances that use this consensus keep the list of router descriptors as routerinfo_t objects stored and managed in routerlist.c. With the newer "microdesc" flavor, each relay is associated with a digest of the microdescriptor that the authorities made for it. These are stored and managed in microdesc.c. Information about the router is divided between the the networkstatus and the microdescriptor according to the general rule that microdescriptors should hold information that changes much less frequently than the information in the networkstatus.

Modern clients use microdescriptor networkstatuses. Directory caches need to keep both kinds of networkstatus document, so they can serve them.

This module manages fetching, holding, storing, updating, and validating networkstatus objects. The download-and-validate process is slightly complicated by the fact that the keys you need to validate a consensus are stored in the authority certificates, which you might not have yet when you download the consensus.

Definition in file networkstatus.c.

Macro Definition Documentation

◆ AUTHORITY_NS_CACHE_INTERVAL

#define AUTHORITY_NS_CACHE_INTERVAL   (10*60)

How frequently do directory authorities re-download fresh networkstatus documents?

Definition at line 857 of file networkstatus.c.

◆ CONSENSUS_BOOTSTRAP_SOURCE_ANY_DIRSERVER

#define CONSENSUS_BOOTSTRAP_SOURCE_ANY_DIRSERVER   1

Definition at line 161 of file networkstatus.c.

◆ CONSENSUS_BOOTSTRAP_SOURCE_AUTHORITY

#define CONSENSUS_BOOTSTRAP_SOURCE_AUTHORITY   0

Definition at line 160 of file networkstatus.c.

◆ CONSENSUS_MIN_SECONDS_BEFORE_CACHING

#define CONSENSUS_MIN_SECONDS_BEFORE_CACHING   120

How long do we (as a cache) wait after a consensus becomes non-fresh before trying to fetch another?

Definition at line 1143 of file networkstatus.c.

◆ DELAY_WHILE_FETCHING_CERTS

#define DELAY_WHILE_FETCHING_CERTS   (20*60)

How long will we hang onto a possibly live consensus for which we're fetching certs before we check whether there is a better one?

Definition at line 915 of file networkstatus.c.

◆ MIN_DELAY_FOR_FETCH_CERT_STATUS_FAILURE

#define MIN_DELAY_FOR_FETCH_CERT_STATUS_FAILURE   (1*60)

What is the minimum time we need to have waited fetching certs, before we increment the consensus download schedule on failure?

Definition at line 919 of file networkstatus.c.

◆ N_CONSENSUS_BOOTSTRAP_SCHEDULES

#define N_CONSENSUS_BOOTSTRAP_SCHEDULES   2

Definition at line 159 of file networkstatus.c.

◆ NETWORKSTATUS_ALLOW_SKEW

#define NETWORKSTATUS_ALLOW_SKEW   (24*60*60)

How far in the future do we allow a network-status to get before removing it? (seconds)

Definition at line 698 of file networkstatus.c.

◆ NETWORKSTATUS_PRIVATE

#define NETWORKSTATUS_PRIVATE

Definition at line 39 of file networkstatus.c.

◆ NONAUTHORITY_NS_CACHE_INTERVAL

#define NONAUTHORITY_NS_CACHE_INTERVAL   (60*60)

How frequently do non-authority directory caches re-download fresh networkstatus documents?

Definition at line 861 of file networkstatus.c.

◆ REASONABLY_LIVE_TIME

#define REASONABLY_LIVE_TIME   (24*60*60)

Definition at line 1459 of file networkstatus.c.

Function Documentation

◆ check_consensus_waiting_for_certs()

static int check_consensus_waiting_for_certs ( int  flavor,
time_t  now,
download_status_t dls 
)
static

Definition at line 927 of file networkstatus.c.

◆ client_would_use_router()

int client_would_use_router ( const routerstatus_t rs,
time_t  now 
)

Return 0 if this routerstatus is obsolete, too new, isn't running, or otherwise not a descriptor that we would make any use of even if we had it. Else return 1.

Definition at line 2625 of file networkstatus.c.

◆ compare_digest_to_routerstatus_entry()

int compare_digest_to_routerstatus_entry ( const void *  _key,
const void **  _member 
)

Helper for bsearching a list of routerstatus_t pointers: compare a digest in the key to the identity digest of a routerstatus_t.

Definition at line 703 of file networkstatus.c.

Referenced by networkstatus_vote_find_entry_idx(), networkstatus_vote_find_mutable_entry(), and router_get_mutable_consensus_status_by_id().

◆ compare_digest_to_vote_routerstatus_entry()

int compare_digest_to_vote_routerstatus_entry ( const void *  _key,
const void **  _member 
)

Helper for bsearching a list of routerstatus_t pointers: compare a digest in the key to the identity digest of a routerstatus_t.

Definition at line 713 of file networkstatus.c.

Referenced by measured_bw_line_apply().

◆ consensus_is_waiting_for_certs()

int consensus_is_waiting_for_certs ( void  )

Return 1 if we have a consensus but we don't have enough certificates to start using it yet.

Definition at line 1342 of file networkstatus.c.

Referenced by networkstatus_consensus_is_bootstrapping().

◆ document_signature_dup()

document_signature_t * document_signature_dup ( const document_signature_t sig)

Return a newly allocated copy of sig

Definition at line 344 of file networkstatus.c.

◆ document_signature_free_()

void document_signature_free_ ( document_signature_t sig)

Free all storage held in sig

Definition at line 336 of file networkstatus.c.

◆ get_net_param_from_list()

static int32_t get_net_param_from_list ( smartlist_t net_params,
const char *  param_name,
int32_t  default_val,
int32_t  min_val,
int32_t  max_val 
)
static

Search through a smartlist of "key=int32" strings for a value beginning with "param_name=". If one is found, clip it to be between min_val and max_val inclusive and return it. If one is not found, return default_val.

Definition at line 2472 of file networkstatus.c.

Referenced by networkstatus_get_bw_weight(), and networkstatus_get_param().

◆ getinfo_helper_networkstatus()

int getinfo_helper_networkstatus ( control_connection_t conn,
const char *  question,
char **  answer,
const char **  errmsg 
)

If question is a string beginning with "ns/" in a format the control interface expects for a GETINFO question, set *answer to a newly-allocated string containing networkstatus lines for the appropriate ORs. Return 0 on success, -1 on unrecognized question format.

Definition at line 2647 of file networkstatus.c.

◆ handle_missing_protocol_warning()

static void handle_missing_protocol_warning ( const networkstatus_t c,
const or_options_t options 
)
static

Called when we have received a networkstatus c. If there are any required protocols we are missing, log an error and exit immediately. If there are any recommended protocols we are missing, warn.

Definition at line 1849 of file networkstatus.c.

◆ handle_missing_protocol_warning_impl()

static void handle_missing_protocol_warning_impl ( const networkstatus_t c,
int  is_client 
)
static

Helper for handle_missing_protocol_warning: handles either the client case (if is_client is set) or the server case otherwise.

Definition at line 1823 of file networkstatus.c.

Referenced by handle_missing_protocol_warning().

◆ networkstatus_check_consensus_signature()

int networkstatus_check_consensus_signature ( networkstatus_t consensus,
int  warn 
)

Given a v3 networkstatus consensus in consensus, check every as-yet-unchecked signature on consensus. Return 1 if there is a signature from every recognized authority on it, 0 if there are enough good signatures from recognized authorities on it, -1 if we might get enough good signatures by fetching missing certificates, and -2 otherwise. Log messages at INFO or WARN: if warn is over 1, warn about every problem; if warn is at least 1, warn only if we can't get enough signatures; if warn is negative, log nothing at all.

Definition at line 518 of file networkstatus.c.

Referenced by networkstatus_note_certs_arrived().

◆ networkstatus_check_document_signature()

int networkstatus_check_document_signature ( const networkstatus_t consensus,
document_signature_t sig,
const authority_cert_t cert 
)

Check whether the signature sig is correctly signed with the signing key in cert. Return -1 if cert doesn't match the signing key; otherwise set the good_signature or bad_signature flag on voter, and return 0.

Definition at line 465 of file networkstatus.c.

◆ networkstatus_check_required_protocols()

int networkstatus_check_required_protocols ( const networkstatus_t ns,
int  client_mode,
char **  warning_out 
)
static

Check whether the networkstatus ns lists any protocol versions as "required" or "recommended" that we do not support. If so, set *warning_out to a newly allocated string describing the problem.

Return 1 if we should exit, 0 if we should not.

Definition at line 2730 of file networkstatus.c.

Referenced by handle_missing_protocol_warning_impl().

◆ networkstatus_consensus_can_use_extra_fallbacks()

int networkstatus_consensus_can_use_extra_fallbacks ( const or_options_t options)

Check if we can use fallback directory mirrors for a consensus download. If we have fallbacks and don't want to fetch from the authorities, we can use them.

Definition at line 1540 of file networkstatus.c.

Referenced by update_consensus_bootstrap_multiple_downloads().

◆ networkstatus_consensus_can_use_multiple_directories()

int networkstatus_consensus_can_use_multiple_directories ( const or_options_t options)

Check if we can use multiple directories for a consensus download. Only clients (including bridge relays, which act like clients) benefit from multiple simultaneous consensus downloads.

Definition at line 1529 of file networkstatus.c.

Referenced by update_consensus_bootstrap_multiple_downloads(), and update_consensus_networkstatus_downloads().

◆ networkstatus_consensus_download_failed()

void networkstatus_consensus_download_failed ( int  status_code,
const char *  flavname 
)

Called when an attempt to download a consensus fails: note that the failure occurred, and possibly retry.

Definition at line 1129 of file networkstatus.c.

Referenced by handle_response_fetch_consensus().

◆ networkstatus_consensus_is_already_downloading()

int networkstatus_consensus_is_already_downloading ( const char *  resource)

Definition at line 1557 of file networkstatus.c.

◆ networkstatus_consensus_is_bootstrapping()

int networkstatus_consensus_is_bootstrapping ( time_t  now)

Check if we need to download a consensus during tor's bootstrap phase. If we have no consensus, or our consensus is unusably old, return 1. As soon as we have received a consensus, return 0, even if we don't have enough certificates to validate it. If a fallback directory gives us a consensus we can never get certs for, check_consensus_waiting_for_certs() will wait 20 minutes before failing the cert downloads. After that, a new consensus will be fetched from a randomly chosen fallback.

Definition at line 1504 of file networkstatus.c.

Referenced by fetch_networkstatus_callback(), networkstatus_get_dl_status_by_flavor(), and update_consensus_networkstatus_downloads().

◆ networkstatus_consensus_reasonably_live()

int networkstatus_consensus_reasonably_live ( const networkstatus_t consensus,
time_t  now 
)

Determine if consensus is valid, or expired recently enough, or not too far in the future, so that we can still use it.

Return 1 if the consensus is reasonably live, or 0 if it is too old or too new.

Definition at line 1447 of file networkstatus.c.

Referenced by check_expired_networkstatus_callback(), and networkstatus_get_reasonably_live_consensus().

◆ networkstatus_copy_old_consensus_info()

static void networkstatus_copy_old_consensus_info ( networkstatus_t new_c,
const networkstatus_t old_c 
)
static

Copy all the ancillary information (like router download status and so on) from old_c to new_c.

Definition at line 1724 of file networkstatus.c.

◆ networkstatus_free_all()

void networkstatus_free_all ( void  )

Free all storage held locally in this module.

Definition at line 2785 of file networkstatus.c.

◆ networkstatus_get_bw_weight()

int32_t networkstatus_get_bw_weight ( networkstatus_t ns,
const char *  weight_name,
int32_t  default_val 
)

Return the value of a integer bw weight parameter from the networkstatus ns whose name is weight_name. If ns is NULL, try loading the latest consensus ourselves. Return default_val if no latest consensus, or if it has no parameter called weight_name.

Definition at line 2569 of file networkstatus.c.

Referenced by networkstatus_verify_bw_weights().

◆ networkstatus_get_cache_fname()

char * networkstatus_get_cache_fname ( int  flav,
const char *  flavorname,
int  unverified_consensus 
)

Return the filename used to cache the consensus of a given flavor

Definition at line 231 of file networkstatus.c.

Referenced by networkstatus_map_cached_consensus_impl(), and networkstatus_note_certs_arrived().

◆ networkstatus_get_dl_status_by_flavor()

download_status_t * networkstatus_get_dl_status_by_flavor ( consensus_flavor_t  flavor)

Look up the currently active (depending on bootstrap status) download status for this consensus flavor and return a pointer to it.

Definition at line 1352 of file networkstatus.c.

Referenced by getinfo_helper_downloads_networkstatus().

◆ networkstatus_get_dl_status_by_flavor_bootstrap()

download_status_t * networkstatus_get_dl_status_by_flavor_bootstrap ( consensus_flavor_t  flavor)

Look up the bootstrap download status for this consensus flavor and return a pointer to it.

Definition at line 1369 of file networkstatus.c.

◆ networkstatus_get_dl_status_by_flavor_running()

download_status_t * networkstatus_get_dl_status_by_flavor_running ( consensus_flavor_t  flavor)

Look up the running (non-bootstrap) download status for this consensus flavor and return a pointer to it.

Definition at line 1383 of file networkstatus.c.

◆ networkstatus_get_flavor_name()

const char * networkstatus_get_flavor_name ( consensus_flavor_t  flav)

◆ networkstatus_get_latest_consensus()

networkstatus_t * networkstatus_get_latest_consensus ( void  )

◆ networkstatus_get_latest_consensus_by_flavor()

networkstatus_t * networkstatus_get_latest_consensus_by_flavor ( consensus_flavor_t  f)

◆ networkstatus_get_live_consensus()

networkstatus_t * networkstatus_get_live_consensus ( time_t  now)

Return the most recent consensus that we have downloaded, or NULL if it is no longer live.

Definition at line 1423 of file networkstatus.c.

Referenced by mark_my_descriptor_dirty_if_too_old().

◆ networkstatus_get_overridable_param()

int32_t networkstatus_get_overridable_param ( const networkstatus_t ns,
int32_t  torrc_value,
const char *  param_name,
int32_t  default_val,
int32_t  min_val,
int32_t  max_val 
)

As networkstatus_get_param(), but check torrc_value before checking the consensus. If torrc_value is in-range, then return it instead of the value from the consensus.

Definition at line 2536 of file networkstatus.c.

◆ networkstatus_get_param()

int32_t networkstatus_get_param ( const networkstatus_t ns,
const char *  param_name,
int32_t  default_val,
int32_t  min_val,
int32_t  max_val 
)

Return the value of a integer parameter from the networkstatus ns whose name is param_name. If ns is NULL, try loading the latest consensus ourselves. Return default_val if no latest consensus, or if it has no parameter called param_name. Make sure the value parsed from the consensus is at least min_val and at most max_val and raise/cap the parsed value if necessary.

Definition at line 2518 of file networkstatus.c.

Referenced by channelpadding_new_consensus_params(), circpad_new_consensus_params(), circuit_build_times_close_quantile(), circuit_build_times_default_num_xm_modes(), circuit_build_times_initial_timeout(), circuit_build_times_max_timeouts(), circuit_build_times_min_circs_to_observe(), circuit_build_times_min_timeout(), circuit_build_times_quantile_cutoff(), circuit_build_times_recent_circuit_count(), circuit_build_times_test_frequency(), circuit_initial_package_window(), conflux_params_new_consensus(), congestion_control_init_params(), connection_or_update_token_buckets_helper(), flow_control_new_consensus_params(), get_consensus_param_exit_dns_attempts(), get_consensus_param_exit_dns_timeout(), get_extreme_restriction_threshold(), get_frac_paths_needed_for_circs(), get_guard_confirmed_min_lifetime(), get_guard_lifetime(), get_internet_likely_down_interval(), get_intro2_burst_consensus_param(), get_intro2_rate_consensus_param(), get_intro_point_max_introduce2(), get_intro_point_max_lifetime(), get_intro_point_min_introduce2(), get_intro_point_min_lifetime(), get_intro_point_num_extra(), get_max_lifetime_of_layer2_hs_guards(), get_max_pending_tasks_per_cpu(), get_max_sample_size_absolute(), get_max_sample_threshold(), get_meaningful_restriction_threshold(), get_min_filtered_sample_size(), get_min_lifetime_of_layer2_hs_guards(), get_n_primary_guards(), get_nonprimary_guard_connect_timeout(), get_nonprimary_guard_idle_timeout(), get_number_of_layer2_hs_guards(), get_onion_key_grace_period(), get_onion_key_rotation_days_(), get_param_max_circuit_cell_queue_size(), get_param_max_circuit_cell_queue_size_out(), get_remove_unlisted_guards_after_days(), hs_cache_get_max_descriptor_size(), hs_get_hsdir_n_replicas(), hs_get_hsdir_spread_fetch(), hs_get_hsdir_spread_store(), hs_get_service_max_rend_failures(), network_reentry_is_allowed(), networkstatus_get_overridable_param(), networkstatus_get_weight_scale_param(), pathbias_get_dropguards(), pathbias_get_extreme_rate(), pathbias_get_extreme_use_rate(), pathbias_get_min_circs(), pathbias_get_min_use(), pathbias_get_notice_rate(), pathbias_get_notice_use_rate(), pathbias_get_scale_ratio(), pathbias_get_scale_threshold(), pathbias_get_scale_use_threshold(), pathbias_get_warn_rate(), rep_hist_consensus_has_changed(), router_new_consensus_params(), should_apply_guardfraction(), should_include_ed25519_id_extend_cells(), should_refuse_unknown_exits(), and vanguards_lite_is_enabled().

◆ networkstatus_get_reasonably_live_consensus()

networkstatus_t * networkstatus_get_reasonably_live_consensus ( time_t  now,
int  flavor 
)

◆ networkstatus_get_voter_by_id()

networkstatus_voter_info_t * networkstatus_get_voter_by_id ( networkstatus_t vote,
const char *  identity 
)

Return the voter info from vote for the voter whose identity digest is identity, or NULL if no such voter is associated with vote.

Definition at line 435 of file networkstatus.c.

◆ networkstatus_get_voter_sig_by_alg()

document_signature_t * networkstatus_get_voter_sig_by_alg ( const networkstatus_voter_info_t voter,
digest_algorithm_t  alg 
)

Return the signature made by voter using the algorithm alg, or NULL if none is found.

Definition at line 449 of file networkstatus.c.

◆ networkstatus_get_weight_scale_param()

int networkstatus_get_weight_scale_param ( networkstatus_t ns)

Retrieve the consensus parameter that governs the fixed-point precision of our network balancing 'bandwidth-weights' (which are themselves integer consensus values). We divide them by this value and ensure they never exceed this value.

Definition at line 2556 of file networkstatus.c.

Referenced by networkstatus_get_bw_weight(), and networkstatus_verify_bw_weights().

◆ networkstatus_getinfo_by_purpose()

char * networkstatus_getinfo_by_purpose ( const char *  purpose_string,
time_t  now 
)

Alloc and return a string describing routerstatuses for the most recent info of each router we know about that is of purpose purpose_string. Return NULL if unrecognized purpose.

Right now this function is oriented toward listing bridges (you shouldn't use this for general-purpose routers, since those should be listed from the consensus, not from the routers list).

Definition at line 2429 of file networkstatus.c.

◆ networkstatus_getinfo_helper_single()

char * networkstatus_getinfo_helper_single ( const routerstatus_t rs)

Generate networkstatus lines for a single routerstatus_t object, and return the result in a newly allocated string. Used only by controller interface (for now.)

Definition at line 2373 of file networkstatus.c.

◆ networkstatus_is_live()

int networkstatus_is_live ( const networkstatus_t ns,
time_t  now 
)

Given a consensus in ns, return true iff currently live and unexpired.

Definition at line 1435 of file networkstatus.c.

Referenced by networkstatus_get_live_consensus().

◆ networkstatus_map_cached_consensus()

tor_mmap_t * networkstatus_map_cached_consensus ( const char *  flavorname)

Map the file containing the current cached consensus of flavor flavorname

Definition at line 269 of file networkstatus.c.

Referenced by handle_response_fetch_consensus().

◆ networkstatus_map_cached_consensus_impl()

static tor_mmap_t * networkstatus_map_cached_consensus_impl ( int  flav,
const char *  flavorname,
int  unverified_consensus 
)
static

Read and return the cached consensus of type flavorname. If unverified is false, get the one we haven't verified. Return NULL if the file isn't there.

Definition at line 254 of file networkstatus.c.

Referenced by networkstatus_map_cached_consensus().

◆ networkstatus_note_certs_arrived()

void networkstatus_note_certs_arrived ( const char *  source_dir)

Called when we have gotten more certificates: see whether we can now verify a pending consensus.

If source_dir is non-NULL, it's the identity digest for a directory that we've just successfully retrieved certificates from, so try it first to fetch any missing certificates.

Definition at line 2214 of file networkstatus.c.

◆ networkstatus_parse_flavor_name()

int networkstatus_parse_flavor_name ( const char *  flavname)

Return the consensus_flavor_t value for the flavor called flavname, or -1 if the flavor is not recognized.

Definition at line 2611 of file networkstatus.c.

Referenced by networkstatus_consensus_download_failed(), networkstatus_map_cached_consensus(), and networkstatus_set_current_consensus().

◆ networkstatus_reset_download_failures()

void networkstatus_reset_download_failures ( void  )

Reset the descriptor download failure count on all networkstatus docs, so that we can retry any long-failed documents immediately.

Definition at line 213 of file networkstatus.c.

◆ networkstatus_reset_warnings()

void networkstatus_reset_warnings ( void  )

Forget that we've warned about anything networkstatus-related, so we will give fresh warnings if the same behavior happens again.

Definition at line 200 of file networkstatus.c.

Referenced by routerlist_reset_warnings().

◆ networkstatus_set_current_consensus()

int networkstatus_set_current_consensus ( const char *  consensus,
size_t  consensus_len,
const char *  flavor,
unsigned  flags,
const char *  source_dir 
)

Try to replace the current cached v3 networkstatus with the one in consensus. If we don't have enough certificates to validate it, store it in consensus_waiting_for_certs and launch a certificate fetch.

If flags & NSSET_FROM_CACHE, this networkstatus has come from the disk cache. If flags & NSSET_WAS_WAITING_FOR_CERTS, this networkstatus was already received, but we were waiting for certificates on it. If flags & NSSET_DONT_DOWNLOAD_CERTS, do not launch certificate downloads as needed. If flags & NSSET_ACCEPT_OBSOLETE, then we should be willing to take this consensus, even if it comes from many days in the past.

If source_dir is non-NULL, it's the identity digest for a directory that we've just successfully retrieved a consensus or certificates from, so try it first to fetch any missing certificates.

Return 0 on success, <0 on failure. On failure, caller should increment the failure count as appropriate.

We return -1 for mild failures that don't need to be reported to the user, and -2 for more serious problems.

Definition at line 1934 of file networkstatus.c.

◆ networkstatus_valid_after_is_reasonably_live()

int networkstatus_valid_after_is_reasonably_live ( time_t  valid_after,
time_t  now 
)

As networkstatus_consensus_reasonably_live, but takes a valid_after time, and checks to see if it is in the past, or not too far in the future.

Definition at line 1465 of file networkstatus.c.

◆ networkstatus_valid_until_is_reasonably_live()

int networkstatus_valid_until_is_reasonably_live ( time_t  valid_until,
time_t  now 
)

As networkstatus_consensus_reasonably_live, but takes a valid_until time, and checks to see if it is in the future, or not too far in the past.

Definition at line 1475 of file networkstatus.c.

◆ networkstatus_vote_find_entry()

const routerstatus_t * networkstatus_vote_find_entry ( networkstatus_t ns,
const char *  digest 
)

Return the entry in ns for the identity digest digest, or NULL if none was found.

Definition at line 732 of file networkstatus.c.

Referenced by mark_my_descriptor_dirty_if_too_old().

◆ networkstatus_vote_find_entry_idx()

int networkstatus_vote_find_entry_idx ( networkstatus_t ns,
const char *  digest,
int *  found_out 
)

Search the routerstatuses in ns for one whose identity digest is digest. Return value and set *found_out as for smartlist_bsearch_idx().

Definition at line 742 of file networkstatus.c.

◆ networkstatus_vote_find_mutable_entry()

routerstatus_t * networkstatus_vote_find_mutable_entry ( networkstatus_t ns,
const char *  digest 
)

As networkstatus_find_entry, but do not return a const pointer

Definition at line 723 of file networkstatus.c.

Referenced by networkstatus_vote_find_entry().

◆ networkstatus_vote_free_()

void networkstatus_vote_free_ ( networkstatus_t ns)

Free all storage held in ns.

Definition at line 354 of file networkstatus.c.

◆ notify_after_networkstatus_changes()

static void notify_after_networkstatus_changes ( void  )
static

Definition at line 1680 of file networkstatus.c.

◆ notify_before_networkstatus_changes()

static void notify_before_networkstatus_changes ( const networkstatus_t old_c,
const networkstatus_t new_c 
)
static

Definition at line 1665 of file networkstatus.c.

◆ notify_control_networkstatus_changed()

static void notify_control_networkstatus_changed ( const networkstatus_t old_c,
const networkstatus_t new_c 
)
static

Notify controllers of any router status entries that changed between old_c and new_c.

Definition at line 1629 of file networkstatus.c.

◆ reload_consensus_from_file()

static int reload_consensus_from_file ( const char *  fname,
const char *  flavor,
unsigned  flags,
const char *  source_dir 
)
static

Helper: Read the current consensus of type flavor from fname. Flags and return values are as for networkstatus_set_current_consensus().

Definition at line 1786 of file networkstatus.c.

Referenced by networkstatus_note_certs_arrived().

◆ router_get_consensus_status_by_descriptor_digest()

const routerstatus_t * router_get_consensus_status_by_descriptor_digest ( networkstatus_t consensus,
const char *  digest 
)

Return the consensus view of the status of the router whose current descriptor digest in consensus is digest, or NULL if no such router is known.

Definition at line 776 of file networkstatus.c.

Referenced by signed_descs_update_status_from_consensus_networkstatus().

◆ router_get_consensus_status_by_id()

const routerstatus_t * router_get_consensus_status_by_id ( const char *  digest)

Return the consensus view of the status of the router whose identity digest is digest, or NULL if we don't know about any such router.

Definition at line 850 of file networkstatus.c.

Referenced by connection_or_digest_is_known_relay().

◆ router_get_descriptor_digests()

smartlist_t * router_get_descriptor_digests ( void  )

Return a smartlist of all router descriptor digests in the current consensus

Definition at line 808 of file networkstatus.c.

Referenced by getinfo_helper_downloads_desc().

◆ router_get_descriptor_digests_in_consensus()

static smartlist_t * router_get_descriptor_digests_in_consensus ( networkstatus_t consensus)
static

Return a smartlist of all router descriptor digests in a consensus

Definition at line 785 of file networkstatus.c.

Referenced by router_get_descriptor_digests().

◆ router_get_dl_status_by_descriptor_digest()

download_status_t * router_get_dl_status_by_descriptor_digest ( const char *  d)

Given the digest of a router descriptor, return its current download status, or NULL if the digest is unrecognized.

Definition at line 823 of file networkstatus.c.

Referenced by getinfo_helper_downloads_desc().

◆ router_get_mutable_consensus_status_by_descriptor_digest()

routerstatus_t * router_get_mutable_consensus_status_by_descriptor_digest ( networkstatus_t consensus,
const char *  digest 
)

As router_get_consensus_status_by_descriptor_digest, but does not return a const pointer.

Definition at line 755 of file networkstatus.c.

Referenced by router_get_consensus_status_by_descriptor_digest(), and router_get_dl_status_by_descriptor_digest().

◆ router_get_mutable_consensus_status_by_id()

routerstatus_t * router_get_mutable_consensus_status_by_id ( const char *  digest)

As router_get_consensus_status_by_id, but do not return a const pointer

Definition at line 837 of file networkstatus.c.

Referenced by mark_all_dirservers_up(), and router_get_consensus_status_by_id().

◆ router_reload_consensus_networkstatus()

int router_reload_consensus_networkstatus ( void  )

Read every cached v3 consensus networkstatus from the disk.

Definition at line 279 of file networkstatus.c.

◆ routers_update_all_from_networkstatus()

void routers_update_all_from_networkstatus ( time_t  now,
int  dir_version 
)

If the network-status list has changed since the last time we called this function, update the status of every routerinfo from the network-status list. If dir_version is 2, it's a v2 networkstatus that changed. If dir_version is 3, it's a v3 consensus that changed.

Definition at line 2237 of file networkstatus.c.

◆ routers_update_status_from_consensus_networkstatus()

void routers_update_status_from_consensus_networkstatus ( smartlist_t routers,
int  reset_failures 
)

Given a list routers of routerinfo_t *, update each status field according to our current consensus networkstatus. May re-order routers.

Definition at line 2301 of file networkstatus.c.

Referenced by router_load_routers_from_string().

◆ routerstatus_free_()

void routerstatus_free_ ( routerstatus_t rs)

Free all storage held by the routerstatus object rs.

Definition at line 326 of file networkstatus.c.

◆ routerstatus_has_visibly_changed()

STATIC int routerstatus_has_visibly_changed ( const routerstatus_t a,
const routerstatus_t b 
)

Given two router status entries for the same router identity, return 1 if the contents have changed between them. Otherwise, return 0. It only checks for fields that are output by control port. This should be kept in sync with the struct routerstatus_t and the printing function routerstatus_format_entry in NS_CONTROL_PORT mode.

Definition at line 1597 of file networkstatus.c.

◆ set_routerstatus_from_routerinfo()

void set_routerstatus_from_routerinfo ( routerstatus_t rs,
const node_t node,
const routerinfo_t ri 
)

Extract status information from ri and from other authority functions and store it in rs. rs is zeroed out before it is set.

We assume that node->is_running has already been set, e.g. by dirserv_set_router_is_running(ri, now);

Definition at line 2388 of file networkstatus.c.

Referenced by dirauth_set_routerstatus_from_routerinfo().

◆ should_delay_dir_fetches()

int should_delay_dir_fetches ( const or_options_t options,
const char **  msg_out 
)

Return 1 if there's a reason we shouldn't try any directory fetches yet (e.g. we demand bridges and none are yet known). Else return 0.

If we return 1 and msg_out is provided, set msg_out to an explanation of why directory fetches are delayed. (If we return 0, we set msg_out to NULL.)

Definition at line 1260 of file networkstatus.c.

Referenced by fetch_networkstatus_callback(), launch_descriptor_fetches_callback(), router_have_minimum_dir_info(), update_all_descriptor_downloads(), update_consensus_networkstatus_downloads(), update_extrainfo_downloads(), update_microdesc_downloads(), update_networkstatus_downloads(), and update_router_descriptor_downloads().

◆ signed_descs_update_status_from_consensus_networkstatus()

void signed_descs_update_status_from_consensus_networkstatus ( smartlist_t descs)

Given a list of signed_descriptor_t, update their fields (mainly, when they were last listed) from the most recent consensus.

Definition at line 2346 of file networkstatus.c.

◆ update_certificate_downloads()

void update_certificate_downloads ( time_t  now)

Launch requests as appropriate for missing directory authority certificates.

Definition at line 1324 of file networkstatus.c.

◆ update_consensus_bootstrap_attempt_downloads()

static void update_consensus_bootstrap_attempt_downloads ( time_t  now,
download_status_t dls,
download_want_authority_t  want_authority 
)
static

When we're bootstrapping, launch one or more consensus download connections, if schedule indicates connection(s) should be made after now. If is_authority, connect to an authority, otherwise, use a fallback directory mirror.

Definition at line 1047 of file networkstatus.c.

◆ update_consensus_bootstrap_multiple_downloads()

static void update_consensus_bootstrap_multiple_downloads ( time_t  now,
const or_options_t options 
)
static

If we're bootstrapping, check the connection schedules and see if we want to make additional, potentially concurrent, consensus download connections. Only call when bootstrapping, and when we want to make additional connections. Only nodes that satisfy networkstatus_consensus_can_use_multiple_directories make additional connections.

Definition at line 1083 of file networkstatus.c.

◆ update_consensus_networkstatus_downloads()

static void update_consensus_networkstatus_downloads ( time_t  now)
static

If we want to download a fresh consensus, launch a new download as appropriate.

Check if we're waiting for certificates to download. If we are, launch download for missing directory authority certificates.

Definition at line 958 of file networkstatus.c.

Referenced by networkstatus_consensus_download_failed(), and update_networkstatus_downloads().

◆ update_consensus_networkstatus_fetch_time()

void update_consensus_networkstatus_fetch_time ( time_t  now)

Update the time at which we'll consider replacing the current consensus of flavor 'flavor'

Definition at line 1242 of file networkstatus.c.

◆ update_consensus_networkstatus_fetch_time_impl()

static void update_consensus_networkstatus_fetch_time_impl ( time_t  now,
int  flav 
)
static

Update the time at which we'll consider replacing the current consensus of flavor flav

Definition at line 1148 of file networkstatus.c.

Referenced by update_consensus_networkstatus_fetch_time().

◆ update_networkstatus_downloads()

void update_networkstatus_downloads ( time_t  now)

Launch requests for networkstatus documents as appropriate. This is called when we retry all the connections on a SIGHUP and periodically by a Periodic event which checks whether we want to download any networkstatus documents.

Launch a consensus download request, we will wait for the consensus to download and when it completes we will launch a certificate download request.

Definition at line 1310 of file networkstatus.c.

◆ vote_routerstatus_free_()

void vote_routerstatus_free_ ( vote_routerstatus_t rs)

Free all storage held by the vote_routerstatus object rs.

Definition at line 308 of file networkstatus.c.

◆ voting_sched_get_start_of_interval_after()

time_t voting_sched_get_start_of_interval_after ( time_t  now,
int  interval,
int  offset 
)

Return the start of the next interval of size interval (in seconds) after now, plus offset. Midnight always starts a fresh interval, and if the last interval of a day would be truncated to less than half its size, it is rolled into the previous interval.

Definition at line 2807 of file networkstatus.c.

Referenced by dirauth_sched_get_cur_valid_after_time().

◆ warn_early_consensus()

STATIC void warn_early_consensus ( const networkstatus_t c,
const char *  flavor,
time_t  now 
)

Check whether we received a consensus that appears to be coming from the future. Because we implicitly trust the directory authorities' idea of the current time, we produce a warning if we get an early consensus.

If we got a consensus that is time stamped far in the past, that could simply have come from a stale cache. Possible ways to get a consensus from the future can include:

  • enough directory authorities have wrong clocks
  • directory authorities collude to produce misleading time stamps
  • our own clock is wrong (this is by far the most likely)

We neglect highly improbable scenarios that involve actual time travel.

If a consensus appears more than this many seconds before it could possibly be a sufficiently-signed consensus, declare that our clock is skewed.

Definition at line 1879 of file networkstatus.c.

◆ we_want_to_fetch_flavor()

int we_want_to_fetch_flavor ( const or_options_t options,
int  flavor 
)

Return true iff, given the options listed in options, flavor is the flavor of a consensus networkstatus that we would like to fetch.

For certificate fetches, use we_want_to_fetch_unknown_auth_certs, and for serving fetched documents, use directory_caches_dir_info.

Definition at line 869 of file networkstatus.c.

Referenced by update_consensus_networkstatus_downloads(), update_consensus_networkstatus_fetch_time(), and update_consensus_networkstatus_fetch_time_impl().

◆ we_want_to_fetch_unknown_auth_certs()

int we_want_to_fetch_unknown_auth_certs ( const or_options_t options)

Return true iff, given the options listed in options, we would like to fetch and store unknown authority certificates.

For consensus and descriptor fetches, use we_want_to_fetch_flavor, and for serving fetched certificates, use directory_caches_unknown_auth_certs.

Definition at line 897 of file networkstatus.c.

Variable Documentation

◆ consensus_bootstrap_dl_status

download_status_t consensus_bootstrap_dl_status[N_CONSENSUS_BOOTSTRAP_SCHEDULES]
static
Initial value:
=
{
{ 0, 0, 0, DL_SCHED_CONSENSUS, DL_WANT_AUTHORITY,
DL_SCHED_INCREMENT_ATTEMPT, 0, 0 },
{ 0, 0, 0, DL_SCHED_CONSENSUS, DL_WANT_ANY_DIRSERVER,
DL_SCHED_INCREMENT_ATTEMPT, 0, 0 },
}

Definition at line 170 of file networkstatus.c.

◆ consensus_dl_status

download_status_t consensus_dl_status[N_CONSENSUS_FLAVORS]
static
Initial value:
=
{
{ 0, 0, 0, DL_SCHED_CONSENSUS, DL_WANT_ANY_DIRSERVER,
DL_SCHED_INCREMENT_FAILURE, 0, 0 },
{ 0, 0, 0, DL_SCHED_CONSENSUS, DL_WANT_ANY_DIRSERVER,
DL_SCHED_INCREMENT_FAILURE, 0, 0 },
}

Download status for the current consensus networkstatus.

Definition at line 151 of file networkstatus.c.

Referenced by networkstatus_consensus_download_failed(), and networkstatus_get_dl_status_by_flavor_running().

◆ consensus_waiting_for_certs

consensus_waiting_for_certs_t consensus_waiting_for_certs[N_CONSENSUS_FLAVORS]
static

An array, for each flavor of consensus we might want, of consensuses that we have downloaded, but which we cannot verify due to having insufficient authority certificates.

Definition at line 144 of file networkstatus.c.

Referenced by consensus_is_waiting_for_certs(), networkstatus_note_certs_arrived(), and update_certificate_downloads().

◆ current_md_consensus

STATIC networkstatus_t* current_md_consensus = NULL

Most recently received and validated v3 "microdesc"-flavored consensus network status.

Definition at line 124 of file networkstatus.c.

Referenced by networkstatus_get_latest_consensus(), and update_certificate_downloads().

◆ current_ns_consensus

STATIC networkstatus_t* current_ns_consensus = NULL

◆ have_warned_about_new_version

int have_warned_about_new_version = 0
static

True iff we have logged a warning about this OR's version being newer than listed by the authorities.

Definition at line 184 of file networkstatus.c.

Referenced by networkstatus_reset_warnings().

◆ have_warned_about_old_version

int have_warned_about_old_version = 0
static

True iff we have logged a warning about this OR's version being older than listed by the authorities.

Definition at line 181 of file networkstatus.c.

Referenced by networkstatus_reset_warnings().

◆ time_to_download_next_consensus

time_t time_to_download_next_consensus[N_CONSENSUS_FLAVORS]
static

A time before which we shouldn't try to replace the current consensus: this will be at some point after the next consensus becomes valid, but before the current consensus becomes invalid.

Definition at line 149 of file networkstatus.c.

Referenced by update_consensus_networkstatus_downloads().