mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
relay: On new consensus, reconfigure DNS nameservers
This applies only for relays. Previous commit adds two new consensus parameters that dictate how libevent is configured with DNS resolution. And so, with a new consensus, we now look at those values in case they ever change. Without this, Exit relay would have to HUP or restart to apply any new Exit DNS consensus parameters. Related to #40312 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
347eaa32bf
commit
2cdb5ceb1d
@ -82,6 +82,7 @@
|
||||
#include "feature/nodelist/routerinfo.h"
|
||||
#include "feature/nodelist/routerlist.h"
|
||||
#include "feature/nodelist/torcert.h"
|
||||
#include "feature/relay/dns.h"
|
||||
#include "feature/relay/routermode.h"
|
||||
#include "lib/crypt_ops/crypto_rand.h"
|
||||
#include "lib/crypt_ops/crypto_util.h"
|
||||
@ -1706,6 +1707,7 @@ notify_after_networkstatus_changes(void)
|
||||
congestion_control_new_consensus_params(c);
|
||||
flow_control_new_consensus_params(c);
|
||||
hs_service_new_consensus_params(c);
|
||||
dns_new_consensus_params(c);
|
||||
|
||||
/* Maintenance of our L2 guard list */
|
||||
maintain_layer2_guards();
|
||||
|
@ -213,6 +213,19 @@ evdns_log_cb(int warn, const char *msg)
|
||||
tor_log(severity, LD_EXIT, "eventdns: %s", msg);
|
||||
}
|
||||
|
||||
/** New consensus just appeared, take appropriate actions if need be. */
|
||||
void
|
||||
dns_new_consensus_params(const networkstatus_t *ns)
|
||||
{
|
||||
(void) ns;
|
||||
|
||||
/* Consensus has parameters for the Exit relay DNS side and so we only reset
|
||||
* the DNS nameservers if we are in server mode. */
|
||||
if (server_mode(get_options())) {
|
||||
dns_reset();
|
||||
}
|
||||
}
|
||||
|
||||
/** Initialize the DNS subsystem; called by the OR process. */
|
||||
int
|
||||
dns_init(void)
|
||||
|
@ -26,6 +26,7 @@ void dns_reset_correctness_checks(void);
|
||||
size_t dns_cache_total_allocation(void);
|
||||
void dump_dns_mem_usage(int severity);
|
||||
size_t dns_cache_handle_oom(time_t now, size_t min_remove_bytes);
|
||||
void dns_new_consensus_params(const networkstatus_t *ns);
|
||||
|
||||
/* These functions are only used within the feature/relay module, and don't
|
||||
* need stubs. */
|
||||
@ -47,6 +48,8 @@ void dns_launch_correctness_checks(void);
|
||||
((void)(severity))
|
||||
#define dns_cache_handle_oom(now, bytes) \
|
||||
((void)(now), (void)(bytes), 0)
|
||||
#define dns_new_consensus_params(ns) \
|
||||
((void) ns)
|
||||
|
||||
#define connection_dns_remove(conn) \
|
||||
STMT_BEGIN \
|
||||
|
Loading…
Reference in New Issue
Block a user