/* entry is locked */
struct del_info* inf = (struct del_info*)arg;
struct packed_rrset_data* d = (struct packed_rrset_data*)e->data;
- if(d->security == sec_status_bogus) {
+ if(d->security == sec_status_bogus && d->ttl > inf->expired) {
d->ttl = inf->expired;
inf->num_rrsets++;
}
/* entry is locked */
struct del_info* inf = (struct del_info*)arg;
struct reply_info* d = (struct reply_info*)e->data;
- if(d->security == sec_status_bogus) {
+ if(d->security == sec_status_bogus && d->ttl > inf->expired) {
d->ttl = inf->expired;
d->prefetch_ttl = inf->expired;
d->serve_expired_ttl = inf->expired;
/* entry is locked */
struct del_info* inf = (struct del_info*)arg;
struct key_entry_data* d = (struct key_entry_data*)e->data;
- if(d->isbad) {
+ if(d->isbad && d->ttl > inf->expired) {
d->ttl = inf->expired;
inf->num_keys++;
}
/* delete the parentside negative cache rrsets,
* these are nameserver rrsets that failed lookup, rdata empty */
if((k->rk.flags & PACKED_RRSET_PARENT_SIDE) && d->count == 1 &&
- d->rrsig_count == 0 && d->rr_len[0] == 0) {
+ d->rrsig_count == 0 && d->rr_len[0] == 0 &&
+ d->ttl > inf->expired) {
d->ttl = inf->expired;
inf->num_rrsets++;
}
struct reply_info* d = (struct reply_info*)e->data;
/* rcode not NOERROR: NXDOMAIN, SERVFAIL, ..: an nxdomain or error
* or NOERROR rcode with ANCOUNT==0: a NODATA answer */
- if(FLAGS_GET_RCODE(d->flags) != 0 || d->an_numrrsets == 0) {
+ if((FLAGS_GET_RCODE(d->flags) != 0 || d->an_numrrsets == 0) &&
+ d->ttl > inf->expired) {
d->ttl = inf->expired;
d->prefetch_ttl = inf->expired;
d->serve_expired_ttl = inf->expired;
struct key_entry_data* d = (struct key_entry_data*)e->data;
/* could be bad because of lookup failure on the DS, DNSKEY, which
* was nxdomain or servfail, and thus a result of negative lookups */
- if(d->isbad) {
+ if(d->isbad && d->ttl > inf->expired) {
d->ttl = inf->expired;
inf->num_keys++;
}
teststep "clean reload"
clean_reload
+teststep "Check negative flushing"
+query always.empty.
+expect_answer "SERVFAIL"
+query always.empty. DNSKEY
+expect_answer "SERVFAIL"
+control_command -c ub.conf flush_negative
+expect_exit_value 0
+expect_answer "^ok removed .*, 2 messages and 1 key"
+control_command -c ub.conf flush_negative
+expect_exit_value 0
+expect_answer "^ok removed .*, 0 messages and 0 key"
+
teststep "create a new local zone"
control_command -c ub.conf local_zone example.net static
expect_exit_value 0