Co-authored-by: Remi Gacogne <github@coredump.fr>
}
if (!SyncRes::s_nopacketcache && !variableAnswer && !sr.wasVariable()) {
const auto& hdr = pw.getHeader();
- if (hdr->ancount == 0 && hdr->rcode != RCode::NoError && hdr->rcode != RCode::NXDomain) {
+ if ((hdr->rcode != RCode::NoError && hdr->rcode != RCode::NXDomain) ||
+ (hdr->ancount == 0 && hdr->nscount == 0)) {
minTTL = min(minTTL, SyncRes::s_packetcacheservfailttl);
}
minTTL = min(minTTL, SyncRes::s_packetcachettl);