From 4e58282058fe9d57f0ef1d557e88ffdbdbf01166 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Tue, 21 Apr 2015 15:08:10 +0200 Subject: core_dns Add typedef for request id, change it to uint16_t --- include/modules/dns.h | 4 +++- src/coremods/core_dns.cpp | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/modules/dns.h b/include/modules/dns.h index 400d2085d..04e3df16c 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -68,6 +68,8 @@ namespace DNS ERROR_INVALIDTYPE }; + typedef uint16_t RequestId; + const int PORT = 53; /** @@ -147,7 +149,7 @@ namespace DNS /* Use result cache if available */ bool use_cache; /* Request id */ - unsigned short id; + RequestId id; /* Creator of this request */ Module* const creator; diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 58c275c7c..703dfdbdc 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -201,7 +201,7 @@ class Packet : public Query static const int HEADER_LENGTH = 12; /* ID for this packet */ - unsigned short id; + RequestId id; /* Flags on the packet */ unsigned short flags; @@ -219,9 +219,6 @@ class Packet : public Query this->id = (input[packet_pos] << 8) | input[packet_pos + 1]; packet_pos += 2; - if (this->id >= MAX_REQUEST_ID) - throw Exception("Query ID too large?"); - this->flags = (input[packet_pos] << 8) | input[packet_pos + 1]; packet_pos += 2; -- cgit v1.2.3