From dbcc780efbf648babd8e700079594f470470f29d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Fri, 2 Apr 2021 00:22:52 -0400
Subject: [PATCH] Also, parse and return the header.

---
 exec/load/dns.js | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/exec/load/dns.js b/exec/load/dns.js
index afbd4abfc0..18be808823 100644
--- a/exec/load/dns.js
+++ b/exec/load/dns.js
@@ -232,6 +232,15 @@ var DNS = new function(servers)
 		q = DNS.outstanding[id];
 		delete DNS.outstanding[id];
 
+		ret.id = id;
+		ret.response = !!(ascii(resp[2]) & 1);
+		ret.opcode = (ascii(resp[2]) & 0x1e) >> 1;
+		ret.authoritative = !!(ascii(resp[2]) & (1<<5));
+		ret.truncation = !!(ascii(resp[2]) & (1<<6));
+		ret.recusrion = !!(ascii(resp[2]) & (1<<7));
+		ret.reserved = ascii(resp[3]) & 7;
+		ret.rcode = ascii(resp[3] & 0xf1) >> 3;
+
 		queries = DNS.string_to_int16(resp.substr(4, 2));
 		answers = DNS.string_to_int16(resp.substr(6, 2));
 		nameservers = DNS.string_to_int16(resp.substr(8, 2));
-- 
GitLab