From b22811eca246c9805cd1972981bc289e224181e6 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Tue, 11 Apr 2023 09:27:16 -0400 Subject: config --- src/packet/question.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/packet/question.c') diff --git a/src/packet/question.c b/src/packet/question.c index 5a08fd6..b138121 100644 --- a/src/packet/question.c +++ b/src/packet/question.c @@ -1,21 +1,28 @@ #include #include +#include #include "question.h" #include "buffer.h" #include "record.h" #include "../io/log.h" -void read_question(PacketBuffer* buffer, Question* question) { +bool read_question(PacketBuffer* buffer, Question* question) { buffer_read_qname(buffer, &question->domain); uint16_t qtype_num = buffer_read_short(buffer); record_from_id(qtype_num, &question->qtype); question->cls = buffer_read_short(buffer); + if (question->qtype == UNKOWN) { + free(question->domain); + return false; + } + INIT_LOG_BUFFER(log) LOGONLY(print_question(question, log);) - TRACE("Reading question: %s", log); + TRACE("Reading question: %s", log); + return true; } void write_question(PacketBuffer* buffer, Question* question) { @@ -85,6 +92,8 @@ void print_question(Question* question, char* buffer) { case CAA: APPEND(buffer, "CAA "); break; + case CMD: + APPEND(buffer, "CMD "); break; } APPEND(buffer, "%.*s", -- cgit v1.2.3-freya