mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-25 00:59:37 -05:00
remove lost and backoff values.
git-svn-id: file:///svn/unbound/trunk@2309 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
573ce5a4de
commit
a72fe210ca
5 changed files with 18 additions and 63 deletions
|
|
@ -802,8 +802,8 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
|||
{
|
||||
char buf[257];
|
||||
struct delegpt_addr* a;
|
||||
int lame, dlame, rlame, rtt, edns_vs, to, lost;
|
||||
int entry_ttl, clean_rtt, backoff;
|
||||
int lame, dlame, rlame, rtt, edns_vs, to;
|
||||
int entry_ttl, clean_rtt;
|
||||
uint8_t edns_lame_known;
|
||||
for(a = dp->target_list; a; a = a->next_target) {
|
||||
addr_to_str(&a->addr, a->addrlen, buf, sizeof(buf));
|
||||
|
|
@ -815,15 +815,14 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
|||
}
|
||||
/* lookup in infra cache */
|
||||
entry_ttl = infra_get_host_rto(worker->env.infra_cache,
|
||||
&a->addr, a->addrlen, &clean_rtt, &rtt, &backoff,
|
||||
&a->addr, a->addrlen, &clean_rtt, &rtt,
|
||||
*worker->env.now);
|
||||
if(entry_ttl == -1) {
|
||||
if(!ssl_printf(ssl, "not in infra cache.\n"))
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
} else if(entry_ttl == -2) {
|
||||
if(!ssl_printf(ssl, "not in infra cache "
|
||||
"(backoff %d).\n", backoff))
|
||||
if(!ssl_printf(ssl, "not in infra cache.\n"))
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
}
|
||||
|
|
@ -832,25 +831,21 @@ print_dp_details(SSL* ssl, struct worker* worker, struct delegpt* dp)
|
|||
* lameness won't be reported then */
|
||||
if(!infra_get_lame_rtt(worker->env.infra_cache,
|
||||
&a->addr, a->addrlen, dp->name, dp->namelen,
|
||||
LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rtt, &lost,
|
||||
LDNS_RR_TYPE_A, &lame, &dlame, &rlame, &rtt,
|
||||
*worker->env.now)) {
|
||||
if(!ssl_printf(ssl, "not in infra cache.\n"))
|
||||
return;
|
||||
continue; /* skip stuff not in infra cache */
|
||||
}
|
||||
if(!ssl_printf(ssl, "%s%s%s%srtt %d msec, %d lost, ttl %d",
|
||||
if(!ssl_printf(ssl, "%s%s%s%srtt %d msec, ttl %d",
|
||||
lame?"LAME ":"", dlame?"NoDNSSEC ":"",
|
||||
a->lame?"AddrWasParentSide ":"",
|
||||
rlame?"NoAuthButRecursive ":"", rtt, lost, entry_ttl))
|
||||
rlame?"NoAuthButRecursive ":"", rtt, entry_ttl))
|
||||
return;
|
||||
if(rtt != clean_rtt && clean_rtt != 376 /* unknown */) {
|
||||
if(!ssl_printf(ssl, ", ping %d", clean_rtt))
|
||||
return;
|
||||
}
|
||||
if(backoff != INFRA_BACKOFF_INITIAL) {
|
||||
if(!ssl_printf(ssl, ", backoff %d", backoff))
|
||||
return;
|
||||
}
|
||||
if(infra_host(worker->env.infra_cache, &a->addr, a->addrlen,
|
||||
*worker->env.now, &edns_vs, &edns_lame_known, &to)) {
|
||||
if(edns_vs == -1) {
|
||||
|
|
|
|||
|
|
@ -1567,21 +1567,15 @@ dump_infra_host(struct lruhash_entry* e, void* arg)
|
|||
a->ipstr = ip_str;
|
||||
/* skip expired stuff (only backed off) */
|
||||
if(d->ttl < a->now) {
|
||||
if(d->backoff != INFRA_BACKOFF_INITIAL) {
|
||||
if(!ssl_printf(a->ssl, "%s expired, backoff is %d\n",
|
||||
ip_str, (int)d->backoff))
|
||||
return;
|
||||
}
|
||||
if(d->lameness)
|
||||
lruhash_traverse(d->lameness, 0, &dump_infra_lame, arg);
|
||||
return;
|
||||
}
|
||||
if(!ssl_printf(a->ssl, "%s ttl %d ping %d var %d rtt %d rto %d "
|
||||
"backoff %d ednsknown %d edns %d\n",
|
||||
"ednsknown %d edns %d\n",
|
||||
ip_str, (int)(d->ttl - a->now),
|
||||
d->rtt.srtt, d->rtt.rttvar, rtt_notimeout(&d->rtt), d->rtt.rto,
|
||||
(int)d->backoff, (int)d->edns_lame_known, (int)d->edns_version
|
||||
))
|
||||
(int)d->edns_lame_known, (int)d->edns_version))
|
||||
return;
|
||||
if(d->lameness)
|
||||
lruhash_traverse(d->lameness, 0, &dump_infra_lame, arg);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
|||
uint8_t* name, size_t namelen, uint16_t qtype, uint32_t now,
|
||||
struct delegpt_addr* a)
|
||||
{
|
||||
int rtt, lame, reclame, dnsseclame, lost;
|
||||
int rtt, lame, reclame, dnsseclame;
|
||||
if(a->bogus)
|
||||
return -1; /* address of server is bogus */
|
||||
if(donotq_lookup(iter_env->donotq, &a->addr, a->addrlen)) {
|
||||
|
|
@ -197,9 +197,9 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
|||
/* check lameness - need zone , class info */
|
||||
if(infra_get_lame_rtt(env->infra_cache, &a->addr, a->addrlen,
|
||||
name, namelen, qtype, &lame, &dnsseclame, &reclame,
|
||||
&rtt, &lost, now)) {
|
||||
&rtt, now)) {
|
||||
log_addr(VERB_ALGO, "servselect", &a->addr, a->addrlen);
|
||||
verbose(VERB_ALGO, " rtt=%d lost=%d%s%s%s%s", rtt, lost,
|
||||
verbose(VERB_ALGO, " rtt=%d%s%s%s%s", rtt,
|
||||
lame?" LAME":"",
|
||||
dnsseclame?" DNSSEC_LAME":"",
|
||||
reclame?" REC_LAME":"",
|
||||
|
|
|
|||
32
services/cache/infra.c
vendored
32
services/cache/infra.c
vendored
|
|
@ -203,7 +203,7 @@ infra_lookup_host(struct infra_cache* infra,
|
|||
return data;
|
||||
}
|
||||
|
||||
/** init the host elements (not lame elems, not backoff) */
|
||||
/** init the host elements (not lame elems) */
|
||||
static void
|
||||
host_entry_init(struct infra_cache* infra, struct lruhash_entry* e,
|
||||
uint32_t timenow)
|
||||
|
|
@ -213,7 +213,6 @@ host_entry_init(struct infra_cache* infra, struct lruhash_entry* e,
|
|||
rtt_init(&data->rtt);
|
||||
data->edns_version = 0;
|
||||
data->edns_lame_known = 0;
|
||||
data->num_timeouts = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -246,7 +245,6 @@ new_host_entry(struct infra_cache* infra, struct sockaddr_storage* addr,
|
|||
key->addrlen = addrlen;
|
||||
memcpy(&key->addr, addr, addrlen);
|
||||
data->lameness = NULL;
|
||||
data->backoff = INFRA_BACKOFF_INITIAL;
|
||||
host_entry_init(infra, &key->entry, tm);
|
||||
return &key->entry;
|
||||
}
|
||||
|
|
@ -497,30 +495,9 @@ infra_rtt_update(struct infra_cache* infra,
|
|||
/* have an entry, update the rtt */
|
||||
data = (struct infra_host_data*)e->data;
|
||||
if(roundtrip == -1) {
|
||||
int o = rtt_timeout(&data->rtt);
|
||||
rtt_lost(&data->rtt, orig_rtt);
|
||||
if(rtt_timeout(&data->rtt) >= USEFUL_SERVER_TOP_TIMEOUT
|
||||
&& o < USEFUL_SERVER_TOP_TIMEOUT) {
|
||||
/* backoff the blacklisted timeout */
|
||||
log_addr(VERB_ALGO, "backoff for", addr, addrlen);
|
||||
data->backoff *= 2;
|
||||
if(data->backoff >= 24*3600)
|
||||
data->backoff = 24*3600;
|
||||
verbose(VERB_ALGO, "backoff to %d", data->backoff);
|
||||
/* increase the infra item TTL */
|
||||
data->ttl = timenow + data->backoff;
|
||||
}
|
||||
|
||||
if(data->num_timeouts<255)
|
||||
data->num_timeouts++;
|
||||
} else {
|
||||
rtt_update(&data->rtt, roundtrip);
|
||||
/* un-backoff the element */
|
||||
if(data->backoff > (uint32_t)infra->host_ttl*2)
|
||||
data->backoff = (uint32_t)infra->host_ttl*2;
|
||||
else data->backoff = INFRA_BACKOFF_INITIAL;
|
||||
|
||||
data->num_timeouts = 0;
|
||||
}
|
||||
if(data->rtt.rto > 0)
|
||||
rto = data->rtt.rto;
|
||||
|
|
@ -533,7 +510,7 @@ infra_rtt_update(struct infra_cache* infra,
|
|||
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
int* rtt, int* rto, int* backoff, uint32_t timenow)
|
||||
int* rtt, int* rto, uint32_t timenow)
|
||||
{
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
addrlen, 0);
|
||||
|
|
@ -541,7 +518,6 @@ int infra_get_host_rto(struct infra_cache* infra,
|
|||
int ttl = -2;
|
||||
if(!e) return -1;
|
||||
data = (struct infra_host_data*)e->data;
|
||||
*backoff = (int)data->backoff;
|
||||
if(data->ttl >= timenow) {
|
||||
ttl = (int)(data->ttl - timenow);
|
||||
*rtt = rtt_notimeout(&data->rtt);
|
||||
|
|
@ -585,8 +561,7 @@ int
|
|||
infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
|
||||
uint32_t timenow)
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow)
|
||||
{
|
||||
struct infra_host_data* host;
|
||||
struct lruhash_entry* e = infra_lookup_host_nottl(infra, addr,
|
||||
|
|
@ -596,7 +571,6 @@ infra_get_lame_rtt(struct infra_cache* infra,
|
|||
return 0;
|
||||
host = (struct infra_host_data*)e->data;
|
||||
*rtt = rtt_unclamped(&host->rtt);
|
||||
*lost = (int)host->num_timeouts;
|
||||
/* check lameness first, if so, ttl on host does not matter anymore */
|
||||
if(infra_lookup_lame(host, name, namelen, timenow,
|
||||
&dlm, &rlm, &alm, &olm)) {
|
||||
|
|
|
|||
14
services/cache/infra.h
vendored
14
services/cache/infra.h
vendored
|
|
@ -64,8 +64,6 @@ struct infra_host_key {
|
|||
struct infra_host_data {
|
||||
/** TTL value for this entry. absolute time. */
|
||||
uint32_t ttl;
|
||||
/** backoff time if blacklisted unresponsive. in seconds. */
|
||||
uint32_t backoff;
|
||||
/** round trip times for timeout calculation */
|
||||
struct rtt_info rtt;
|
||||
/** Names of the zones that are lame. NULL=no lame zones. */
|
||||
|
|
@ -76,8 +74,6 @@ struct infra_host_data {
|
|||
* EDNS lame is when EDNS queries or replies are dropped,
|
||||
* and cause a timeout */
|
||||
uint8_t edns_lame_known;
|
||||
/** Number of consequtive timeouts; reset when reply arrives OK. */
|
||||
uint8_t num_timeouts;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -281,16 +277,13 @@ int infra_edns_update(struct infra_cache* infra,
|
|||
* @param reclame: if function returns true, this is if it is recursion lame.
|
||||
* @param rtt: if function returns true, this returns avg rtt of the server.
|
||||
* The rtt value is unclamped and reflects recent timeouts.
|
||||
* @param lost: number of queries lost in a row. Reset to 0 when an answer
|
||||
* gets back. Gives a connectivity number.
|
||||
* @param timenow: what time it is now.
|
||||
* @return if found in cache, or false if not (or TTL bad).
|
||||
*/
|
||||
int infra_get_lame_rtt(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
uint8_t* name, size_t namelen, uint16_t qtype,
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, int* lost,
|
||||
uint32_t timenow);
|
||||
int* lame, int* dnsseclame, int* reclame, int* rtt, uint32_t timenow);
|
||||
|
||||
/**
|
||||
* Get additional (debug) info on timing.
|
||||
|
|
@ -299,14 +292,13 @@ int infra_get_lame_rtt(struct infra_cache* infra,
|
|||
* @param addrlen: length of addr.
|
||||
* @param rtt: the clean rtt time (of working replies).
|
||||
* @param rto: the rtt with timeouts applied. (rtt as returned by other funcs).
|
||||
* @param backoff: the backoff time for blacked entries.
|
||||
* @param timenow: what time it is now.
|
||||
* @return TTL the infra host element is valid for. If -1: not found in cache.
|
||||
* If -2: found in cache, but TTL was not valid, only backoff is filled.
|
||||
* If -2: found in cache, but TTL was not valid.
|
||||
*/
|
||||
int infra_get_host_rto(struct infra_cache* infra,
|
||||
struct sockaddr_storage* addr, socklen_t addrlen,
|
||||
int* rtt, int* rto, int* backoff, uint32_t timenow);
|
||||
int* rtt, int* rto, uint32_t timenow);
|
||||
|
||||
/**
|
||||
* Get memory used by the infra cache.
|
||||
|
|
|
|||
Loading…
Reference in a new issue