Skip to content

Commit 64460b5

Browse files
committed
dnsx/alg: err log on negative ttl from cache
1 parent 8c8bd6f commit 64460b5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

intra/dnsx/alg.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,9 +923,15 @@ func (t *dnsgateway) fromInternalCache(tid, uid string, q *dns.Msg, typ iptype)
923923
cachedips = cached6s
924924
}
925925

926+
ttlnegative := false
926927
ttl := int64(until / time.Second)
927-
log.VV("alg: response for %s by %s[%s] (q4? %t / q6? %t) realip; in cache? %v [until: %s] (or stale? %v)",
928-
domain, tid, uid, a, aaaa, cachedips, core.FmtSecs(ttl), stale)
928+
if ttl <= 0 {
929+
ttl = int64(ttl8s / time.Second)
930+
ttlnegative = true
931+
}
932+
933+
logeif(ttlnegative)("alg: response for %s by %s[%s] (q4? %t / q6? %t) realip; in cache? %v [ttl: %s / -ve? %t / until: %s] (or stale? %v)",
934+
domain, tid, uid, a, aaaa, cachedips, core.FmtSecs(ttl), ttlnegative, core.FmtPeriod(until), stale)
929935

930936
if len(cachedips) <= 0 {
931937
return nil, errNilCacheResponse

0 commit comments

Comments
 (0)