summaryrefslogtreecommitdiff
path: root/sys/src/cmd/ndb
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-06-21 02:27:10 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-06-21 02:27:10 +0200
commit41208add722b0e572c1fae65b4184088a61ee3b1 (patch)
tree8a2f9927e15729ce1a2a73d5fdce3a8999a2dc77 /sys/src/cmd/ndb
parentd1b6c02ac9207b4c2f661821b3e841071480f535 (diff)
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.
Diffstat (limited to 'sys/src/cmd/ndb')
-rw-r--r--sys/src/cmd/ndb/dn.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/sys/src/cmd/ndb/dn.c b/sys/src/cmd/ndb/dn.c
index e91183c37..ffc55ef8f 100644
--- a/sys/src/cmd/ndb/dn.c
+++ b/sys/src/cmd/ndb/dn.c
@@ -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);