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:
parent
f3134da45e
commit
d998aa6c25
4 changed files with 99 additions and 11 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue