kamarya/dnsd

Work with nslookup but not dig

Closed this issue · 2 comments

First, thanks a lots for your project! It's work but i face some problem:

nslookup -port=5553 twitter.com 127.0.0.1

Server:     127.0.0.1
Address:    127.0.0.1#5553

Non-authoritative answer:
Name:   twitter.com
Address: 104.244.42.129
Name:   twitter.com
Address: 104.244.42.193

dig @127.0.0.1 -p 5553 twitter.com

;; Warning: Message parser reports malformed message packet.

; <<>> DiG 9.10.3-P4 <<>> @127.0.0.1 -p 5553 twitter.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4363
;; flags: qr rd ad; QUERY: 1, ANSWER: 17, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; WARNING: Message has 303 extra bytes at end

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;twitter.com.           IN  A

;; ANSWER SECTION:
twitter.com.        599 IN  MX  20 alt1.aspmx.l.google.com.
twitter.com.        599 IN  MX  10 aspmx.l.google.com.
twitter.com.        599 IN  MX  20 alt2.aspmx.l.google.com.
twitter.com.        599 IN  MX  30 ASPMX3.GOOGLEMAIL.com.
twitter.com.        599 IN  MX  30 ASPMX2.GOOGLEMAIL.com.

;; Query time: 492 msec
;; SERVER: 127.0.0.1#5553(127.0.0.1)
;; WHEN: Sat Oct 29 02:10:00 CST 2016
;; MSG SIZE  rcvd: 541

I am from China, so https://dns.google.com was blocked for sure. I use https_proxy, i can confirm this proxy is work by run curl with proxy:

curl -s --proxy 127.0.0.1:7575 https://dns.google.com/resolve?name=twitter.com | jq -r '.Answer[] | "(.data)"'

104.244.42.129
104.244.42.1

I don't know why dnsd can't work with dig, any suggest?

Thank you for reporting this problem. I can confirm that this is a bug and it has nothing to do with 'dig' or the web proxy. I can reproduce the same results with 'host'.

The fix has been tested and verified by 'dig' and 'host' commands.
host -va twitter.com localhost

Trying "twitter.com"
Using domain server:
Name: localhost
Address: 127.0.0.1#53
Aliases: 

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7859
;; flags: qr rd; QUERY: 1, ANSWER: 21, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;twitter.com.           IN  ANY

;; ANSWER SECTION:
twitter.com.        599 IN  MX  30 ASPMX3.GOOGLEMAIL.com.
twitter.com.        599 IN  MX  30 ASPMX2.GOOGLEMAIL.com.
twitter.com.        599 IN  MX  20 alt1.aspmx.l.google.com.
twitter.com.        599 IN  MX  20 alt2.aspmx.l.google.com.
twitter.com.        599 IN  MX  10 aspmx.l.google.com.
twitter.com.        10799   IN  NS  ns2.p34.dynect.net.
twitter.com.        10799   IN  NS  ns4.p34.dynect.net.
twitter.com.        10799   IN  NS  ns1.p34.dynect.net.
twitter.com.        10799   IN  NS  ns3.p34.dynect.net.
twitter.com.        29  IN  A   199.59.149.198
twitter.com.        29  IN  A   199.59.150.7
twitter.com.        29  IN  A   199.59.148.82
twitter.com.        29  IN  A   199.16.156.102
twitter.com.        29  IN  A   199.59.148.10
twitter.com.        29  IN  A   199.16.156.38
twitter.com.        29  IN  A   199.16.156.198
twitter.com.        29  IN  A   199.16.156.6
twitter.com.        29  IN  A   199.16.156.70
twitter.com.        29  IN  A   199.16.156.230
twitter.com.        29  IN  A   199.59.149.230
twitter.com.        29  IN  A   199.59.150.39

Received 535 bytes from 127.0.0.1#53 in 325 ms

dig @127.0.0.1 -p 53 twitter.com

; <<>> DiG 9.8.3-P1 <<>> @127.0.0.1 -p 53 twitter.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 19188
;; flags: qr rd; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available

;; QUESTION SECTION:
;twitter.com.           IN  A

;; ANSWER SECTION:
twitter.com.        84  IN  A   199.16.156.230
twitter.com.        84  IN  A   199.16.156.70
twitter.com.        84  IN  A   199.16.156.102
twitter.com.        84  IN  A   199.16.156.198

;; Query time: 358 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Sun Oct 30 17:06:42 2016
;; MSG SIZE  rcvd: 93