Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2006/0330/7

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


ndb: add dns -R, remove unreachable code
 [rsc] --rw-rw-r-- M 76409 glenda sys 18249 Mar 30 17:55 sys/src/cmd/ndb/dblookup.c
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dblookup.c:651,660 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dblookup.c:651,658
	  				free(d);
	  			}
	  		}
	- 		if(!doit && youngest == lastyoungest){
	- 			unlock(&dblock);
	- 			return;
	- 		}
	+ 		if(!doit && youngest == lastyoungest)
	+ 			break;
	  	
	  		/* forget our area definition */
	  		freearea(&owned);
 [rsc] --rw-rw-r-- M 76409 glenda sys 15287 Mar 30 17:55 sys/src/cmd/ndb/dns.c
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dns.c:139,144 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dns.c:139,147
	  	case 'r':
	  		resolver = 1;
	  		break;
	+ 	case 'R':
	+ 		norecursion = 1;
	+ 		break;
	  	case 's':
	  		serve = 1;	/* serve network */
	  		cachedb = 1;
 [rsc] --rw-rw-r-- M 76409 glenda sys 10167 Mar 30 17:55 sys/src/cmd/ndb/dns.h
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dns.h:439,444 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dns.h:439,445
	  extern char	mntpt[];
	  extern char	*logfile;
	  extern int	resolver;
	+ extern int	norecursion;
	  extern int	maxage;		/* age of oldest entry in cache (secs) */
	  extern char	*zonerefreshprogram;
	  extern int	sendnotifies;
 [rsc] --rw-rw-r-- M 76409 glenda sys 3982 Mar 30 17:55 sys/src/cmd/ndb/dnserver.c
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dnserver.c:8,13 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dnserver.c:8,16
	  
	  extern char *logfile;
	  
	+ /* set in dns.c */
	+ int	norecursion;		/* don't allow recursive requests */
	+ 
	  /*
	   *  answer a dns request
	   */
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dnserver.c:19,30 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dnserver.c:22,35
	  	DN *nsdp, *dp;
	  	Area *myarea;
	  	char tname[32];
	+ 	int recursionflag;
	  
	  	dncheck(nil, 1);
	  
	+ 	recursionflag = norecursion?0:Fcanrec;
	  	memset(repp, 0, sizeof(*repp));
	  	repp->id = reqp->id;
	- 	repp->flags = Fresp | Fcanrec | Oquery;
	+ 	repp->flags = Fresp | recursionflag | Oquery;
	  
	  	/* move one question from reqp to repp */
	  	tp = reqp->qd;
	/n/sourcesdump/2006/0330/plan9/sys/src/cmd/ndb/dnserver.c:45,54 - 
	/n/sourcesdump/2006/0331/plan9/sys/src/cmd/ndb/dnserver.c:50,67
	  	}
	  
	  	myarea = inmyarea(repp->qd->owner->name);
	- 	if(myarea != nil && (repp->qd->type == Tixfr || repp->qd->type == Taxfr)){
	- 		syslog(0, logfile, "server: request %s", rrname(repp->qd->type, tname, sizeof tname));
	- 		repp->flags = Runimplimented | Fresp | Fcanrec | Oquery;
	- 		return;
	+ 	if(myarea != nil) {
	+ 		if(repp->qd->type == Tixfr || repp->qd->type == Taxfr){
	+ 			syslog(0, logfile, "server: request %s", rrname(repp->qd->type, tname, sizeof tname));
	+ 			repp->flags = Runimplimented | Fresp | recursionflag | Oquery;
	+ 			return;
	+ 		}
	+ 	} else {
	+ 		if(norecursion) {
	+ 			/* we don't recurse and we're not authoritative */
	+ 			repp->flags = Rok | Fresp | Oquery;
	+ 			return;
	+ 		}
	  	}
	  
	  	/*
 [rsc] --rw-rw-r-- M 76409 glenda sys 10084 Mar 30 18:12 sys/man/8/ndb
	/n/sourcesdump/2006/0330/plan9/sys/man/8/ndb:43,49 - 
	/n/sourcesdump/2006/0331/plan9/sys/man/8/ndb:43,49
	  .br
	  .B ndb/dns
	  [
	- .B -rsn
	+ .B -rRsn
	  ] [
	  .B -f
	  .I dbfile
	/n/sourcesdump/2006/0330/plan9/sys/man/8/ndb:205,211 - 
	/n/sourcesdump/2006/0331/plan9/sys/man/8/ndb:205,217
	  with the domain name of the area as its argument.
	  .TP
	  .B -r
	- defer to other servers to resolve queries.
	+ send `recursive' queries, asking the other servers
	+ to complete lookups.
	+ .TP
	+ .B -R
	+ ignore the `recursive' bit on incoming requests.
	+ do not complete lookups on behalf of remote systems.
	+ .PD
	  .PP
	  When the
	  .B -r
	/n/sourcesdump/2006/0330/plan9/sys/man/8/ndb:221,228 - 
	/n/sourcesdump/2006/0331/plan9/sys/man/8/ndb:227,232
	  	dns=ns2.cs.bell-labs.com
	  dom=ns1.cs.bell-labs.com ip=135.104.1.11
	  dom=ns2.cs.bell-labs.com ip=135.104.1.12
	- 
	- .EE
	  .PP
	  The server for a domain is indicated by a database entry containing
	  both a


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.