mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
Type.extra (#1538)
* Revert "pkg/typify: empty messages are OtherError (#1531)"
This reverts commit fc1d73ffa9.
* plugin/cache: add failsafeTTL
If we can not see what TTL we should put on a message to be cached, use
5 seconds as minimal TTL. We used to apply the maximum TTL to these
messages.
This commit is contained in:
@@ -55,7 +55,6 @@ 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 {
|
||||
@@ -77,11 +76,6 @@ 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 {
|
||||
|
||||
@@ -26,23 +26,6 @@ func TestTypifyDelegation(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypifyEmptyMessage(t *testing.T) {
|
||||
m := new(dns.Msg)
|
||||
|
||||
// Normal question, with response = false
|
||||
m.SetQuestion("example.org.", dns.TypeAAAA)
|
||||
mt, _ := Typify(m, time.Now().UTC())
|
||||
if mt != NoError {
|
||||
t.Errorf("message is wrongly typified, expected NoError, got %s", mt)
|
||||
}
|
||||
// In case of a Reponse = true, this weird.
|
||||
m.Response = true
|
||||
mt, _ = Typify(m, time.Now().UTC())
|
||||
if mt != OtherError {
|
||||
t.Errorf("message is wrongly typified, expected OtherError, got %s", mt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTypifyRRSIG(t *testing.T) {
|
||||
now, _ := time.Parse(time.UnixDate, "Fri Apr 21 10:51:21 BST 2017")
|
||||
utc := now.UTC()
|
||||
|
||||
Reference in New Issue
Block a user