mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #894 from sanimej/dns
Set Recursion Available bit in query responses.
This commit is contained in:
commit
577159e0cb
1 changed files with 7 additions and 1 deletions
|
@ -35,7 +35,7 @@ const (
|
||||||
dnsPort = "53"
|
dnsPort = "53"
|
||||||
ptrIPv4domain = ".in-addr.arpa."
|
ptrIPv4domain = ".in-addr.arpa."
|
||||||
ptrIPv6domain = ".ip6.arpa."
|
ptrIPv6domain = ".ip6.arpa."
|
||||||
respTTL = 1800
|
respTTL = 600
|
||||||
maxExtDNS = 3 //max number of external servers to try
|
maxExtDNS = 3 //max number of external servers to try
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -147,6 +147,10 @@ func (r *resolver) ResolverOptions() []string {
|
||||||
return []string{"ndots:0"}
|
return []string{"ndots:0"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setCommonFlags(msg *dns.Msg) {
|
||||||
|
msg.RecursionAvailable = true
|
||||||
|
}
|
||||||
|
|
||||||
func (r *resolver) handleIPv4Query(name string, query *dns.Msg) (*dns.Msg, error) {
|
func (r *resolver) handleIPv4Query(name string, query *dns.Msg) (*dns.Msg, error) {
|
||||||
addr := r.sb.ResolveName(name)
|
addr := r.sb.ResolveName(name)
|
||||||
if addr == nil {
|
if addr == nil {
|
||||||
|
@ -157,6 +161,7 @@ func (r *resolver) handleIPv4Query(name string, query *dns.Msg) (*dns.Msg, error
|
||||||
|
|
||||||
resp := new(dns.Msg)
|
resp := new(dns.Msg)
|
||||||
resp.SetReply(query)
|
resp.SetReply(query)
|
||||||
|
setCommonFlags(resp)
|
||||||
|
|
||||||
rr := new(dns.A)
|
rr := new(dns.A)
|
||||||
rr.Hdr = dns.RR_Header{Name: name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: respTTL}
|
rr.Hdr = dns.RR_Header{Name: name, Rrtype: dns.TypeA, Class: dns.ClassINET, Ttl: respTTL}
|
||||||
|
@ -186,6 +191,7 @@ func (r *resolver) handlePTRQuery(ptr string, query *dns.Msg) (*dns.Msg, error)
|
||||||
|
|
||||||
resp := new(dns.Msg)
|
resp := new(dns.Msg)
|
||||||
resp.SetReply(query)
|
resp.SetReply(query)
|
||||||
|
setCommonFlags(resp)
|
||||||
|
|
||||||
rr := new(dns.PTR)
|
rr := new(dns.PTR)
|
||||||
rr.Hdr = dns.RR_Header{Name: ptr, Rrtype: dns.TypePTR, Class: dns.ClassINET, Ttl: respTTL}
|
rr.Hdr = dns.RR_Header{Name: ptr, Rrtype: dns.TypePTR, Class: dns.ClassINET, Ttl: respTTL}
|
||||||
|
|
Loading…
Reference in a new issue