diff options
-rw-r--r-- | sys/src/cmd/ndb/dblookup.c | 39 | ||||
-rw-r--r-- | sys/src/cmd/ndb/dn.c | 39 | ||||
-rw-r--r-- | sys/src/cmd/ndb/dns.c | 17 | ||||
-rw-r--r-- | sys/src/cmd/ndb/dns.h | 1 |
4 files changed, 12 insertions, 84 deletions
diff --git a/sys/src/cmd/ndb/dblookup.c b/sys/src/cmd/ndb/dblookup.c index 50d9e367d..106395a39 100644 --- a/sys/src/cmd/ndb/dblookup.c +++ b/sys/src/cmd/ndb/dblookup.c @@ -579,23 +579,6 @@ doaxfr(Ndb *db, char *name) return 0; } - -/* - * read the all the soa's from the database to determine area's. - * this is only used when we're not caching the database. - */ -static void -dbfile2area(Ndb *db) -{ - Ndbtuple *t; - - if(debug) - dnslog("rereading %s", db->file); - Bseek(&db->b, 0, 0); - while(t = ndbparse(db)) - ndbfree(t); -} - /* * read the database into the cache */ @@ -750,23 +733,23 @@ db2cache(int doit) /* reload straddle-server configuration */ loaddomsrvs(); - if(cfg.cachedb){ - /* mark all db records as timed out */ - dnagedb(); + /* mark all db records as timed out */ + dnagedb(); + if(cfg.cachedb){ /* read in new entries */ for(ndb = db; ndb; ndb = ndb->next) dbfile2cache(ndb); + } - /* mark as authoritative anything in our domain */ - dnauthdb(); + /* + * mark as authoritative anything in our domain, + * delete timed out db records + */ + dnauthdb(); - /* remove old entries */ - dnageall(1); - } else - /* read all the soa's to get database defaults */ - for(ndb = db; ndb; ndb = ndb->next) - dbfile2area(ndb); + /* remove old entries */ + dnageall(1); doit = 0; lastyoungest = youngest; diff --git a/sys/src/cmd/ndb/dn.c b/sys/src/cmd/ndb/dn.c index 412acbe11..684b25e16 100644 --- a/sys/src/cmd/ndb/dn.c +++ b/sys/src/cmd/ndb/dn.c @@ -1,7 +1,6 @@ #include <u.h> #include <libc.h> #include <ip.h> -#include <pool.h> #include <ctype.h> #include "dns.h" @@ -702,15 +701,10 @@ putactivity(int recursive) } unlock(&dnvars); - dncheck(); - db2cache(needrefresh); - dncheck(); dnageall(0); - dncheck(); - /* let others back in */ lastclean = now; needrefresh = 0; @@ -1548,39 +1542,6 @@ slave(Request *req) } } -/* - * chasing down double free's - */ -void -dncheck(void) -{ - int i; - DN *dp; - RR *rp; - - if(!testing) - return; - - lock(&dnlock); - poolcheck(mainmem); - for(i = 0; i < HTLEN; i++) - for(dp = ht[i]; dp; dp = dp->next){ - assert(dp->magic == DNmagic); - for(rp = dp->rr; rp; rp = rp->next){ - assert(rp->magic == RRmagic); - assert(rp->cached); - assert(rp->owner == dp); - /* also check for duplicate rrs */ - if (rronlist(rp, rp->next)) { - dnslog("%R duplicates its next chain " - "(%R); aborting", rp, rp->next); - abort(); - } - } - } - unlock(&dnlock); -} - static int rrequiv(RR *r1, RR *r2) { diff --git a/sys/src/cmd/ndb/dns.c b/sys/src/cmd/ndb/dns.c index 3b163ca72..93c05e250 100644 --- a/sys/src/cmd/ndb/dns.c +++ b/sys/src/cmd/ndb/dns.c @@ -4,7 +4,6 @@ #include <fcall.h> #include <bio.h> #include <ip.h> -#include <pool.h> #include "dns.h" enum @@ -69,7 +68,6 @@ int needrefresh; ulong now; vlong nowns; int sendnotifies; -int testing; char *trace; int traceactivity; char *zonerefreshprogram; @@ -107,7 +105,7 @@ static char *respond(Job*, Mfile*, RR*, char*, int, int); void usage(void) { - fprint(2, "usage: %s [-FnorRst] [-a maxage] [-f ndb-file] [-N target] " + fprint(2, "usage: %s [-FnorRs] [-a maxage] [-f ndb-file] [-N target] " "[-T forwip] [-x netmtpt] [-z refreshprog]\n", argv0); exits("usage"); } @@ -158,9 +156,6 @@ main(int argc, char *argv[]) cfg.serve = 1; /* serve network */ cfg.cachedb = 1; break; - case 't': - testing = 1; - break; case 'T': addforwtarg(EARGF(usage())); break; @@ -178,9 +173,6 @@ main(int argc, char *argv[]) if(argc != 0) usage(); - if(testing) - mainmem->flags |= POOL_NOREUSE | POOL_ANTAGONISM; - mainmem->flags |= POOL_ANTAGONISM; rfork(RFREND|RFNOTEG); cfg.inside = (*mntpt == '\0' || strcmp(mntpt, "/net") == 0); @@ -206,9 +198,6 @@ main(int argc, char *argv[]) sysfatal("%s exists; another dns instance is running", servefile); free(dir); -// unmount(servefile, mntpt); -// remove(servefile); - mountinit(servefile, mntpt); /* forks, parent exits */ srand(now*getpid()); @@ -733,12 +722,8 @@ rwrite(Job *job, Mfile *mf, Request *req) send = 1; if(strcmp(job->request.data, "debug")==0) debug ^= 1; - else if(strcmp(job->request.data, "testing")==0) - testing ^= 1; else if(strcmp(job->request.data, "dump")==0) dndump("/lib/ndb/dnsdump"); - else if(strcmp(job->request.data, "poolcheck")==0) - poolcheck(mainmem); else if(strcmp(job->request.data, "refresh")==0) needrefresh = 1; else if(strcmp(job->request.data, "restart")==0) diff --git a/sys/src/cmd/ndb/dns.h b/sys/src/cmd/ndb/dns.h index 51c1f7953..32f55d96d 100644 --- a/sys/src/cmd/ndb/dns.h +++ b/sys/src/cmd/ndb/dns.h @@ -448,7 +448,6 @@ void dnageall(int); void dnagedb(void); void dnagenever(DN *); void dnauthdb(void); -void dncheck(void); void dndump(char*); void dnget(void); void dninit(void); |