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.
This commit is contained in:
parent
f10627c1d6
commit
fc1d73ffa9
4 changed files with 35 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue