_Bool FORWARD : 1;
_Bool DNS64_MARK : 1;
_Bool CACHE_TRIED : 1;
+ _Bool NO_NS_FOUND : 1;
};
typedef struct {
knot_rrset_t **at;
VERBOSE_MSG(qry, "=> server: '%s' flagged as 'bad'\n", addr_str);
}
kr_nsrep_update_rtt(&qry->ns, choice, KR_NS_TIMEOUT,
- worker->engine->resolver.cache_rtt, KR_NS_UPDATE);
+ worker->engine->resolver.cache_rtt, KR_NS_RESET);
}
}
task->timeouts += 1;
* The fastest NS is preferred by workers until it is depleted (timeouts or degrades),
* at the same time long distance scouts probe other sources (low probability).
* Servers on TIMEOUT (depleted) can be probed by the dice roll only */
- if (score <= ns->score && (qry->flags.NO_THROTTLE || score < KR_NS_TIMEOUT)) {
+ if (score <= ns->score && (score < KR_NS_LONG || (qry->flags.NO_THROTTLE && (score < KR_NS_TIMEOUT)))) {
update_nsrep_set(ns, (const knot_dname_t *)k, addr_choice, score);
ns->reputation = reputation;
- } else {
+ } else if (score < KR_NS_TIMEOUT) {
/* With 10% chance, probe server with a probability given by its RTT / MAX_RTT */
if ((kr_rand_uint(100) < 10) && (kr_rand_uint(KR_NS_MAX_SCORE) >= score)) {
/* If this is a low-reliability probe, go with TCP to get ICMP reachability check. */
}
/* Penalise resolution failures except validation failures. */
} else if (!(qry->flags.DNSSEC_BOGUS)) {
- kr_nsrep_update_rtt(&qry->ns, src, KR_NS_TIMEOUT, ctx->cache_rtt, KR_NS_RESET);
+ kr_nsrep_update_rtt(&qry->ns, src, KR_NS_TIMEOUT, ctx->cache_rtt, KR_NS_UPDATE);
WITH_VERBOSE(qry) {
char addr_str[INET6_ADDRSTRLEN];
inet_ntop(src->sa_family, kr_inaddr(src), addr_str, sizeof(addr_str));
} else {
VERBOSE_MSG(qry, "=> no valid NS left\n");
}
- ITERATE_LAYERS(request, qry, reset);
- kr_rplan_pop(rplan, qry);
+ if (!qry->flags.NO_NS_FOUND) {
+ qry->flags.NO_NS_FOUND = true;
+ } else {
+ ITERATE_LAYERS(request, qry, reset);
+ kr_rplan_pop(rplan, qry);
+ }
return KR_STATE_PRODUCE;
}
}
bool FORWARD : 1; /**< Forward all queries to upstream; validate answers. */
bool DNS64_MARK : 1; /**< Internal mark for dns64 module. */
bool CACHE_TRIED : 1; /**< Internal to cache module. */
+ bool NO_NS_FOUND : 1; /**< No valid NS found during last PRODUCE stage. */
};
/** Combine flags together. This means set union for simple flags. */
local now = ffi.C.kr_now()
local deadline = qry.creation_time_mono + M.timeout
- if now > deadline then
- --log('[ ][stal] => deadline has passed')
+ if now > deadline or qry.flags.NO_NS_FOUND then
+ log('[ ][stal] => deadline has passed')
qry.stale_cb = M.callback
-- TODO: probably start the same request that doesn't stale-serve,
-- but first we need some detection of non-interactive / internal requests.