From fc3c650e8dc62c3fdde8e2cc4eda62ed4a37c532 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 31 Mar 2021 13:30:53 +0100 Subject: Add support for per-DNSBL timeouts. This should fix the issue of some DNSBLs being slower than others. --- src/modules/m_dnsbl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules/m_dnsbl.cpp') diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 57a780ff2..dc43dda3f 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -42,12 +42,14 @@ class DNSBLConfEntry : public refcountbase EnumType type; unsigned long duration; unsigned int bitmask; + unsigned int timeout; unsigned char records[256]; unsigned long stats_hits, stats_misses, stats_errors; DNSBLConfEntry() : type(A_BITMASK) , duration(86400) , bitmask(0) + , timeout(0) , stats_hits(0) , stats_misses(0) , stats_errors(0) @@ -69,7 +71,7 @@ class DNSBLResolver : public DNS::Request public: DNSBLResolver(DNS::Manager *mgr, Module *me, LocalStringExt& match, LocalIntExt& ctr, const std::string &hostname, LocalUser* u, reference conf) - : DNS::Request(mgr, me, hostname, DNS::QUERY_A, true) + : DNS::Request(mgr, me, hostname, DNS::QUERY_A, true, conf->timeout) , theirsa(u->client_sa) , theiruid(u->uuid) , nameExt(match) @@ -343,6 +345,7 @@ class ModuleDNSBL : public Module, public Stats::EventListener e->host = tag->getString("host"); e->reason = tag->getString("reason", "Your IP has been blacklisted.", 1); e->domain = tag->getString("domain"); + e->timeout = tag->getDuration("timeout", 0); if (stdalgo::string::equalsci(tag->getString("type"), "bitmask")) { -- cgit v1.2.3