summaryrefslogtreecommitdiffstats
path: root/src/dns.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-31 07:37:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-31 07:37:43 +0000
commit759ea409fe884c184d51f81c73523015a468a1eb (patch)
treedf4ba82f4118a4ac46c34a262f87f8ec26fdd240 /src/dns.c
parentAdding upstream version 2.5.0+debian. (diff)
downloaddnsperf-759ea409fe884c184d51f81c73523015a468a1eb.tar.xz
dnsperf-759ea409fe884c184d51f81c73523015a468a1eb.zip
Adding upstream version 2.5.2.upstream/2.5.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/dns.c')
-rw-r--r--src/dns.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dns.c b/src/dns.c
index 1dc58e0..b070eba 100644
--- a/src/dns.c
+++ b/src/dns.c
@@ -146,6 +146,17 @@ perf_result_t perf_qtype_fromstring(const char* str, size_t len, perf_buffer_t*
{
const perf_qtype_t* q = qtype_table;
+ if (len > 4 && !strncasecmp(str, "TYPE", 4)) {
+ char* endptr = 0;
+ unsigned long int u = strtoul(str + 4, &endptr, 10);
+ if (endptr != str + len || u == ULONG_MAX || u > 65535) {
+ return PERF_R_FAILURE;
+ }
+
+ perf_buffer_putuint16(target, u);
+ return PERF_R_SUCCESS;
+ }
+
while (q->type) {
if (!strncasecmp(q->type, str, len)) {
perf_buffer_putuint16(target, q->value);