mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-27 02:00:18 -05:00
Add subnetcache support
This commit is contained in:
parent
a7ac109e4e
commit
79d39e7f4d
1 changed files with 13 additions and 0 deletions
13
services/cache/dns.c
vendored
13
services/cache/dns.c
vendored
|
|
@ -182,6 +182,9 @@ dns_cache_store_msg(struct module_env* env, struct query_info* qinfo,
|
|||
/* we do not store the message, but we did store the RRs,
|
||||
* which could be useful for delegation information */
|
||||
verbose(VERB_ALGO, "TTL 0: dropped msg from cache");
|
||||
if (rep->reason_bogus_str_size) {
|
||||
free(rep->reason_bogus_str);
|
||||
}
|
||||
free(rep);
|
||||
/* if the message is SERVFAIL in cache, remove that SERVFAIL,
|
||||
* so that the TTL 0 response can be returned for future
|
||||
|
|
@ -610,6 +613,8 @@ gen_dns_msg(struct regional* region, struct query_info* q, size_t num)
|
|||
if(!msg->rep)
|
||||
return NULL;
|
||||
msg->rep->reason_bogus = LDNS_EDE_NONE;
|
||||
msg->rep->reason_bogus_str_size = 0;
|
||||
msg->rep->reason_bogus_str = NULL;
|
||||
if(num > RR_COUNT_MAX)
|
||||
return NULL; /* integer overflow protection */
|
||||
msg->rep->rrsets = (struct ub_packed_rrset_key**)
|
||||
|
|
@ -664,6 +669,11 @@ tomsg(struct module_env* env, struct query_info* q, struct reply_info* r,
|
|||
msg->rep->rrset_count = r->rrset_count;
|
||||
msg->rep->authoritative = r->authoritative;
|
||||
msg->rep->reason_bogus = r->reason_bogus;
|
||||
if (r->reason_bogus_str_size > 0) {
|
||||
msg->rep->reason_bogus_str = strdup(r->reason_bogus_str);
|
||||
msg->rep->reason_bogus_str_size = r->reason_bogus_str_size;
|
||||
}
|
||||
|
||||
if(!rrset_array_lock(r->ref, r->rrset_count, now_control)) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -1083,6 +1093,9 @@ dns_cache_store(struct module_env* env, struct query_info* msgqinf,
|
|||
((ntohs(ref.key->rk.type)==LDNS_RR_TYPE_NS
|
||||
&& !pside) ? qstarttime:*env->now + leeway));
|
||||
}
|
||||
if (rep->reason_bogus_str_size) {
|
||||
free(rep->reason_bogus_str);
|
||||
}
|
||||
free(rep);
|
||||
return 1;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue