Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return an error rather than do nothing when having no valid result #138

Merged
merged 1 commit into from
Mar 10, 2019

Conversation

comzyh
Copy link
Contributor

@comzyh comzyh commented Mar 9, 2019

Currently, if overture gets nothing from all of its backends, overture will not reply to the DNS query, cause the client to wait for a response.

Actually, overture should return something rather than keep the client waiting.

I'm facing this problem because many domains don't have an AAAA record. When using curl, curl wants to try ipv4 and ipv6, so curl make an AAAA query to the overture, but overture doesn't reply until timeout, cause curl to start ipv4 query very slow.

However, dig has the same problem.

time dig @127.0.0.1 -p 8053 qq.com AAAA

; <<>> DiG 9.11.3-1ubuntu1.5-Ubuntu <<>> @127.0.0.1 -p 8053 qq.com AAAA
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached
dig @127.0.0.1 -p 8053 qq.com AAAA  0.01s user 0.01s system 0% cpu 15.012 total

Dig return after 15 seconds.

@comzyh
Copy link
Contributor Author

comzyh commented Mar 9, 2019

Actually, response without answer indeed is an answer, and it can be cached. If backend returns a message that doesn't have Answer Section, Overture should treat it as an error.

for _, o := range cb.clients {
go func(c *RemoteClient, ch chan *RemoteClient) {
c.Exchange(isLog)
if common.HasAnswer(c.responseMessage) {
ch <- c
}
ch <- nil
}(o, ch)

I think this behavior(ignoring HasAnswer = false) is not correct. But I don't have a good solution.

@shawn1m shawn1m merged commit a7f001d into shawn1m:master Mar 10, 2019
@shawn1m
Copy link
Owner

shawn1m commented Mar 10, 2019

Merged. The HasAnswer problem I will fix it sometime later.
There is no Answer Section when dig AAAA qq.com @114.114.114.114 (qq.com does not have an AAAA record right now). I think this is the common strategy to return a message that doesn't have Answer Section if there is actually no answer.

$ dig AAAA qq.com @114.114.114.114                                                                                                                               

; <<>> DiG 9.10.6 <<>> AAAA qq.com @114.114.114.114
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 30855
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1

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

;; AUTHORITY SECTION:
qq.com.			582	IN	SOA	ns1.qq.com. webmaster.qq.com. 1330914143 3600 300 86400 300

;; Query time: 18 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Sun Mar 10 15:29:23 CST 2019
;; MSG SIZE  rcvd: 85

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants