diff options
-rw-r--r-- | include/modules/dns.h | 9 | ||||
-rw-r--r-- | src/coremods/core_dns.cpp | 8 |
2 files changed, 8 insertions, 9 deletions
diff --git a/include/modules/dns.h b/include/modules/dns.h index 04e3df16c..f4071e399 100644 --- a/include/modules/dns.h +++ b/include/modules/dns.h @@ -88,11 +88,10 @@ namespace DNS { std::string name; QueryType type; - unsigned short qclass; - Question() : type(QUERY_NONE), qclass(0) { } - Question(const std::string& n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { } - inline bool operator==(const Question& other) const { return name == other.name && type == other.type && qclass == other.qclass; } + 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)); } struct hash { @@ -109,7 +108,7 @@ namespace DNS std::string rdata; time_t created; - ResourceRecord(const std::string& n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(ServerInstance->Time()) { } + ResourceRecord(const std::string& n, QueryType t) : Question(n, t), ttl(0), created(ServerInstance->Time()) { } ResourceRecord(const Question& question) : Question(question), ttl(0), created(ServerInstance->Time()) { } }; diff --git a/src/coremods/core_dns.cpp b/src/coremods/core_dns.cpp index 891c6705a..999da8356 100644 --- a/src/coremods/core_dns.cpp +++ b/src/coremods/core_dns.cpp @@ -126,7 +126,7 @@ class Packet : public Query question.type = static_cast<QueryType>(input[pos] << 8 | input[pos + 1]); pos += 2; - question.qclass = input[pos] << 8 | input[pos + 1]; + // Skip over query class code pos += 2; return question; @@ -307,9 +307,9 @@ class Packet : public Query memcpy(&output[pos], &s, 2); pos += 2; - s = htons(q.qclass); - memcpy(&output[pos], &s, 2); - pos += 2; + // Query class, always IN + output[pos++] = 0; + output[pos++] = 1; } return pos; |