diff options
author | 2018-02-16 09:43:22 +0100 | |
---|---|---|
committer | 2018-02-16 09:43:22 +0100 | |
commit | fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb (patch) | |
tree | ec08dd8896a2b0e1d73f88aabae6310c67b02fa6 /plugin/pkg/response/typify.go | |
parent | f10627c1d61518b33c658db64c8b8b1bc6a914cb (diff) | |
download | coredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.tar.gz coredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.tar.zst coredns-fc1d73ffa9ae193c4cfca4adc194ae43f9360dbb.zip |
pkg/typify: empty messages are OtherError (#1531)
Messages with nothing in them are considered OtherError, they can not
serve any purpose for normal clients (i.e. dyn update or notifies might
have a use for them).
Also update a test in the cache plugin, so that we explicitaly test for
this case.
Diffstat (limited to 'plugin/pkg/response/typify.go')
-rw-r--r-- | plugin/pkg/response/typify.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugin/pkg/response/typify.go b/plugin/pkg/response/typify.go index 9faa17d7b..a80b6b39f 100644 --- a/plugin/pkg/response/typify.go +++ b/plugin/pkg/response/typify.go @@ -55,6 +55,7 @@ func Typify(m *dns.Msg, t time.Time) (Type, *dns.OPT) { if m == nil { return OtherError, nil } + opt := m.IsEdns0() do := false if opt != nil { @@ -76,6 +77,11 @@ func Typify(m *dns.Msg, t time.Time) (Type, *dns.OPT) { } } + if m.Response && len(m.Answer) == 0 && len(m.Ns) == 0 { + // Response with nothing in it, maybe stuff in the additional section, this is not useful. + return OtherError, opt + } + // If our message contains any expired sigs and we care about that, we should return expired if do { if expired := typifyExpired(m, t); expired { |