middleware/backend: send proper reponse on NODATA (#804)
SOA would blindly add "." + zone, which when using the root zone would create a unparseable packet with "name.."
This commit is contained in:
parent
ea0a7d0076
commit
78db9fbb10
1 changed files with 9 additions and 3 deletions
|
@ -380,16 +380,22 @@ func NS(b ServiceBackend, zone string, state request.Request, opt Options) (reco
|
||||||
func SOA(b ServiceBackend, zone string, state request.Request, opt Options) ([]dns.RR, []msg.Service, error) {
|
func SOA(b ServiceBackend, zone string, state request.Request, opt Options) ([]dns.RR, []msg.Service, error) {
|
||||||
header := dns.RR_Header{Name: zone, Rrtype: dns.TypeSOA, Ttl: 300, Class: dns.ClassINET}
|
header := dns.RR_Header{Name: zone, Rrtype: dns.TypeSOA, Ttl: 300, Class: dns.ClassINET}
|
||||||
|
|
||||||
|
Mbox := hostmaster + "."
|
||||||
|
Ns := "ns.dns."
|
||||||
|
if zone[0] != '.' {
|
||||||
|
Mbox += zone
|
||||||
|
Ns += zone
|
||||||
|
}
|
||||||
|
|
||||||
soa := &dns.SOA{Hdr: header,
|
soa := &dns.SOA{Hdr: header,
|
||||||
Mbox: hostmaster + "." + zone,
|
Mbox: Mbox,
|
||||||
Ns: "ns.dns." + zone,
|
Ns: Ns,
|
||||||
Serial: uint32(time.Now().Unix()),
|
Serial: uint32(time.Now().Unix()),
|
||||||
Refresh: 7200,
|
Refresh: 7200,
|
||||||
Retry: 1800,
|
Retry: 1800,
|
||||||
Expire: 86400,
|
Expire: 86400,
|
||||||
Minttl: minTTL,
|
Minttl: minTTL,
|
||||||
}
|
}
|
||||||
// TODO(miek): fake some msg.Service here when returning?
|
|
||||||
return []dns.RR{soa}, nil, nil
|
return []dns.RR{soa}, nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue