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:
cinap_lenrek 2013-06-21 02:27:10 +02:00
parent d1b6c02ac9
commit 41208add72

View file

@ -597,7 +597,7 @@ dnagedb(void)
/*
* mark all local db records about my area as authoritative,
* time out any others
* delete timed out ones
*/
void
dnauthdb(void)
@ -606,7 +606,7 @@ dnauthdb(void)
ulong minttl;
Area *area;
DN *dp;
RR *rp;
RR *rp, **l;
lock(&dnlock);
@ -614,19 +614,22 @@ dnauthdb(void)
for(i = 0; i < HTLEN; i++)
for(dp = ht[i]; dp; dp = dp->next){
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->expire == 0){
rrdelhead(l);
continue;
}
if(area){
minttl = area->soarr->soa->minttl;
if(rp->ttl < minttl)
rp->ttl = minttl;
rp->auth = 1;
}
if(rp->expire == 0){
rp->db = 0;
dp->referenced = now-Reserved-1;
}
}
l = &rp->next;
}
}
unlock(&dnlock);