ndb/dns: avoid duplicate entries for db records
dnauthdb() would relabel expired rr's as rr->db == 0 to make them get garbage collected by dnage(). but this doesnt work due to dn->keep and also causes the deduplication to fail on rrattach() as rrattach1() handles rr->dn/rr->auth as separate name spaces. this causes duplicate entries in the rr's when ndb gets gets changed. to fix, we just delete the expired (removed from ndb) rr's immidiately in dnauthdb() instead of trying trick dnage() to garbage collect it.
This commit is contained in:
parent
d1b6c02ac9
commit
41208add72
|
@ -597,7 +597,7 @@ dnagedb(void)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mark all local db records about my area as authoritative,
|
* mark all local db records about my area as authoritative,
|
||||||
* time out any others
|
* delete timed out ones
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
dnauthdb(void)
|
dnauthdb(void)
|
||||||
|
@ -606,7 +606,7 @@ dnauthdb(void)
|
||||||
ulong minttl;
|
ulong minttl;
|
||||||
Area *area;
|
Area *area;
|
||||||
DN *dp;
|
DN *dp;
|
||||||
RR *rp;
|
RR *rp, **l;
|
||||||
|
|
||||||
lock(&dnlock);
|
lock(&dnlock);
|
||||||
|
|
||||||
|
@ -614,18 +614,21 @@ dnauthdb(void)
|
||||||
for(i = 0; i < HTLEN; i++)
|
for(i = 0; i < HTLEN; i++)
|
||||||
for(dp = ht[i]; dp; dp = dp->next){
|
for(dp = ht[i]; dp; dp = dp->next){
|
||||||
area = inmyarea(dp->name);
|
area = inmyarea(dp->name);
|
||||||
for(rp = dp->rr; rp; rp = rp->next)
|
l = &dp->rr;
|
||||||
|
for(rp = *l; rp; rp = *l){
|
||||||
if(rp->db){
|
if(rp->db){
|
||||||
|
if(rp->expire == 0){
|
||||||
|
rrdelhead(l);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if(area){
|
if(area){
|
||||||
minttl = area->soarr->soa->minttl;
|
minttl = area->soarr->soa->minttl;
|
||||||
if(rp->ttl < minttl)
|
if(rp->ttl < minttl)
|
||||||
rp->ttl = minttl;
|
rp->ttl = minttl;
|
||||||
rp->auth = 1;
|
rp->auth = 1;
|
||||||
}
|
}
|
||||||
if(rp->expire == 0){
|
|
||||||
rp->db = 0;
|
|
||||||
dp->referenced = now-Reserved-1;
|
|
||||||
}
|
}
|
||||||
|
l = &rp->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue