aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/feature/nodelist/networkstatus.c2
-rw-r--r--src/feature/relay/dns.c13
-rw-r--r--src/feature/relay/dns.h3
3 files changed, 18 insertions, 0 deletions
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index 666083ae50..aaddf2331d 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -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();
diff --git a/src/feature/relay/dns.c b/src/feature/relay/dns.c
index 9e504a7cfa..8467b9c0a4 100644
--- a/src/feature/relay/dns.c
+++ b/src/feature/relay/dns.c
@@ -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)
diff --git a/src/feature/relay/dns.h b/src/feature/relay/dns.h
index d7a815e697..3f8519bd97 100644
--- a/src/feature/relay/dns.h
+++ b/src/feature/relay/dns.h
@@ -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 \