mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
plugin/erratic: add axfr support (#1977)
* plugin/erratic: add axfr support Add support for axfr. This to fix and test long standing axfr issues that are hard to test if we don't support it directly in coredns. The most intriguing feature is withholding the last SOA from a response so the client needs to wait; drop (no reply) and delay is also supported. All TTLs are set to zero. Add simple tests that checks if first record is a SOA. Signed-off-by: Miek Gieben <miek@miek.nl> * more test coverage Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -61,14 +61,26 @@ func (e *Erratic) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg
|
||||
rr := *(rrAAAA.(*dns.AAAA))
|
||||
rr.Header().Name = state.QName()
|
||||
m.Answer = append(m.Answer, &rr)
|
||||
default:
|
||||
if !drop {
|
||||
if delay {
|
||||
time.Sleep(e.duration)
|
||||
}
|
||||
// coredns will return error.
|
||||
return dns.RcodeServerFailure, nil
|
||||
case dns.TypeAXFR:
|
||||
if drop {
|
||||
return 0, nil
|
||||
}
|
||||
if delay {
|
||||
time.Sleep(e.duration)
|
||||
}
|
||||
|
||||
xfr(state, trunc)
|
||||
return 0, nil
|
||||
|
||||
default:
|
||||
if drop {
|
||||
return 0, nil
|
||||
}
|
||||
if delay {
|
||||
time.Sleep(e.duration)
|
||||
}
|
||||
// coredns will return error.
|
||||
return dns.RcodeServerFailure, nil
|
||||
}
|
||||
|
||||
if drop {
|
||||
|
||||
Reference in New Issue
Block a user