pforemski / dingo

A DNS client in Go that supports Google DNS over HTTPS
761 stars 66 forks source link

Pack() failed: dns: nil rr #20

Open denisu opened 7 years ago

denisu commented 7 years ago

Some DNS requests appear to be "stuck" due to an error from dingo.

To reproduce: dig 122.141.76.110.in-addr.arpa

Error from dingo: Pack() failed: dns: nil rr

Other public resolvers just return no answer for that query. Dingo should do the same, because the current behavior prevents certain applications to work (eg. KakaoTalk on Mac).

pforemski commented 7 years ago

Hi, thanks for reporting, but this works for me (both for A and PTR queries):

pjf@pjftab:~$ dig 122.141.76.110.in-addr.arpa @127.0.0.1

; <<>> DiG 9.10.3-P4-Ubuntu <<>> 122.141.76.110.in-addr.arpa @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 29254
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;122.141.76.110.in-addr.arpa.   IN  A

;; AUTHORITY SECTION:
110.in-addr.arpa.   1765    IN  SOA ns1.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3006091476 7200 1800 604800 172800

;; Query time: 852 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Nov 16 09:22:30 PST 2016
;; MSG SIZE  rcvd: 134

pjf@pjftab:~$ dig ptr 122.141.76.110.in-addr.arpa @127.0.0.1

; <<>> DiG 9.10.3-P4-Ubuntu <<>> ptr 122.141.76.110.in-addr.arpa @127.0.0.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 46232
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;122.141.76.110.in-addr.arpa.   IN  PTR

;; AUTHORITY SECTION:
110.in-addr.arpa.   1748    IN  SOA ns1.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3006091476 7200 1800 604800 172800

;; Query time: 196 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Nov 16 09:22:34 PST 2016
;; MSG SIZE  rcvd: 134

I get the same result when using the Google Public DNS over UDP (8.8.8.8). That said, the error you're referencing is a kind of error after which no reply would be sent anyway.

Please submit the output of dingo with the -dbg=8 option turned on while querying for the host that doesn't work for you.

denisu commented 7 years ago

Still having this problem with 0.13 (compiled for arm / raspberry pi) but it works on macOS.

Output of -dbg=8

2016/11/17 03:13:46 starting 10 Google Public DNS client(s) querying server [2404:6800:4005:807::200e]:443
2016/11/17 03:13:46 dingo ver. 0.13 listening on * UDP port 53
2016/11/17 03:13:49 unpacked message: ;; opcode: QUERY, status: NOERROR, id: 46935
;; flags: rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;122.141.76.110.in-addr.arpa.   IN       PTR
2016/11/17 03:13:49 resolving 122.141.76.110.in-addr.arpa./PTR
2016/11/17 03:13:50 http.Do(https://[2404:6800:4005:807::200e]:443/resolve?name=122.141.76.110.in-addr.arpa.&random_padding=OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO&type=12): 200 OK HTTP/2.0
2016/11/17 03:13:50   reply: {"Status": 3,"TC": false,"RD": true,"RA": true,"AD": true,"CD": false,"Question":[ {"name": "122.141.76.110.in-addr.arpa.","type": 12}],"Authority":[ {"name": "110.in-addr.arpa.","type": 6,"TTL": 1645,"data": "ns1.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3006091476 7200 1800 604800 172800"}]}
2016/11/17 03:13:50 got reply: {Status:3 TC:false RD:true RA:true AD:true CD:false Question:[{Name:122.141.76.110.in-addr.arpa. Type:12 TTL:0 Data:}] Answer:[] Additional:[] Authority:[{Name:110.in-addr.arpa. Type:6 TTL:1645 Data:ns1.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3006091476 7200 1800 604800 172800}] Comment: Now:2016-11-17 12:13:50.980650904 +0900 KST}
2016/11/17 03:13:50 getrr(110.in-addr.arpa.     1645    IN      SOA     ns1.apnic.net. read-txt-record-of-zone-first-dns-admin.apnic.net. 3006091476 7200 1800 604800 172800): dns: bad SOA zone parameter: "3006091476" at line: 1:107
2016/11/17 03:13:50 sending ;; opcode: QUERY, status: NXDOMAIN, id: 46935
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;122.141.76.110.in-addr.arpa.   IN       PTR

;; AUTHORITY SECTION:
2016/11/17 03:13:50 Pack() failed: dns: nil rr
pforemski commented 7 years ago

Found possibly the same bug on linux-amd64 - needs research:

2016/11/22 14:27:10 resolving cam.ac.uk./ANY
2016/11/22 14:27:10 Pack() failed: dns: nil rr
ghost commented 7 years ago

I tested this against #25 changes and using meikg/dns as the server seems to fix this issue https://github.com/pforemski/dingo/pull/25/commits/27c6be15a61b57056396edc435fd1db376b609e6