summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-04-19 21:57:38 -0400
committerAttila Molnar <attilamolnar@hush.com>2015-04-21 14:56:27 +0200
commit987dee3fdea29dcfa0035747c43ee22886a707fb (patch)
tree818f8b51fba7a51b565583feb8feeef9334e869a
parentdda1d696c1316b09d65763b4f12bc2b63cfbbe72 (diff)
core_dns Move packet source address checking before packet processing
-rw-r--r--src/coremods/core_dns.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp
index de8dedd4a..61d524ada 100644
--- a/src/coremods/core_dns.cpp
+++ b/src/coremods/core_dns.cpp
@@ -571,6 +571,15 @@ class MyManager : public Manager, public Timer, public EventHandler
if (length < Packet::HEADER_LENGTH)
return;
+ if (myserver != from)
+ {
+ std::string server1 = from.str();
+ std::string server2 = myserver.str();
+ ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'",
+ server1.c_str(), server2.c_str());
+ return;
+ }
+
Packet recv_packet;
try
@@ -583,15 +592,6 @@ class MyManager : public Manager, public Timer, public EventHandler
return;
}
- if (myserver != from)
- {
- std::string server1 = from.str();
- std::string server2 = myserver.str();
- ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Got a result from the wrong server! Bad NAT or DNS forging attempt? '%s' != '%s'",
- server1.c_str(), server2.c_str());
- return;
- }
-
DNS::Request* request = this->requests[recv_packet.id];
if (request == NULL)
{