Skip to content
Snippets Groups Projects
Commit f9da3080 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Fix DNS response flag parsing.

parent fa0a154e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -391,17 +391,18 @@ DNS.prototype.handle_response = function(sock) {
delete this.outstanding[id];
ret.id = id;
ret.response = !!(ascii(resp[2]) & 1);
ret.response = !!(ascii(resp[2]) & 0x80);
if (!ret.response)
return null;
ret.opcode = (ascii(resp[2]) & 0x1e) >> 1;
ret.opcode = (ascii(resp[2]) & 0x78) >> 3;
if (ret.opcode !== 0 && ret.opcode !== 2)
return null;
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] & 0xf0) >> 4;
ret.authoritative = !!(ascii(resp[2]) & (1<<2));
ret.truncation = !!(ascii(resp[2]) & (1<<1));
ret.recusrion_desired = !!(ascii(resp[2]) & (1));
ret.recusrion_available = !!(ascii(resp[2]) & (1<<7));
ret.reserved = (ascii(resp[3]) & 0x70) >> 4;
ret.rcode = ascii(resp[3] & 0x0f);
queries = string_to_int16(resp.substr(4, 2));
answers = string_to_int16(resp.substr(6, 2));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment