aboutsummaryrefslogtreecommitdiff
path: root/src/feature/relay/dns.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2022-01-19 14:37:26 -0500
committerDavid Goulet <dgoulet@torproject.org>2022-03-15 15:26:37 -0400
commit2cdb5ceb1dfdeead331f6f65b8aa67791d91f94d (patch)
tree71310057e87ed6c8a080110c3b6a98392788adbf /src/feature/relay/dns.c
parent347eaa32bfbcdfb13c9e34397d8b068ed6f6ba17 (diff)
downloadtor-2cdb5ceb1dfdeead331f6f65b8aa67791d91f94d.tar.gz
tor-2cdb5ceb1dfdeead331f6f65b8aa67791d91f94d.zip
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>
Diffstat (limited to 'src/feature/relay/dns.c')
-rw-r--r--src/feature/relay/dns.c13
1 files changed, 13 insertions, 0 deletions
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)