diff options
-rw-r--r-- | include/modules/dns.h | 1 | ||||
-rw-r--r-- | src/coremods/core_dns.cpp | 7 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h index 4da31b805..cfa048184 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -92,6 +92,7 @@ namespace DNS Question() : type(QUERY_NONE) { } Question(const std::string& n, QueryType t) : name(n), type(t) { } bool operator==(const Question& other) const { return ((name == other.name) && (type == other.type)); } + bool operator!=(const Question& other) const { return (!(*this == other)); } struct hash { diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index f4f85e253..d4214b9a5 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -527,6 +527,13 @@ class MyManager : public Manager, public Timer, public EventHandler return; } + if (static_cast<Question&>(*request) != recv_packet.question) + { + // This can happen under high latency, drop it silently, do not fail the request + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received an answer that isn't for a question we asked"); + return; + } + if (recv_packet.flags & QUERYFLAGS_OPCODE) { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received a nonstandard query"); |