diff options
author | 2018-07-20 10:25:54 +0100 | |
---|---|---|
committer | 2018-07-20 10:25:54 +0100 | |
commit | d998aa6c25ffe83e2d2abf9ba52c5ada57da7e30 (patch) | |
tree | 4e83faf380c6a79b6295db3a230bdbac3a0ba65b /plugin/erratic/erratic.go | |
parent | f3134da45eb2808431a29fa55c58e3271bbba637 (diff) | |
download | coredns-d998aa6c25ffe83e2d2abf9ba52c5ada57da7e30.tar.gz coredns-d998aa6c25ffe83e2d2abf9ba52c5ada57da7e30.tar.zst coredns-d998aa6c25ffe83e2d2abf9ba52c5ada57da7e30.zip |
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>
Diffstat (limited to 'plugin/erratic/erratic.go')
-rw-r--r-- | plugin/erratic/erratic.go | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/plugin/erratic/erratic.go b/plugin/erratic/erratic.go index 290e0c2cc..3460f3bca 100644 --- a/plugin/erratic/erratic.go +++ b/plugin/erratic/erratic.go @@ -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) + case dns.TypeAXFR: + if drop { + return 0, nil + } + if delay { + time.Sleep(e.duration) + } + + xfr(state, trunc) + return 0, nil + default: - if !drop { - if delay { - time.Sleep(e.duration) - } - // coredns will return error. - return dns.RcodeServerFailure, nil + if drop { + return 0, nil + } + if delay { + time.Sleep(e.duration) } + // coredns will return error. + return dns.RcodeServerFailure, nil } if drop { |