Plan 9 from Bell Labs’s /usr/web/sources/contrib/uriel/changes/2007/0407/1

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


% cat >/sys/lib/dist/changes/1175643005.0.txt << EOF
Need clarification from Geoff on this and other recent DNS changes, though
this one seems to be largely whitespace and comment related with some NS
record changes. I'll need to take a deeper look into this, in any case.

These and (previous changes missing from this directory) are related to:

• Add support for SRV records
• Recognize truncated UDP replies and re-issue the query via TCP
• Support servers straddling a firewall.
• Various bugfixes (caching and small sizes).

Visible changes should be described in ndb(8)
EOF
 [geoff] --rw-rw-r-- M 77 glenda sys 32939 Apr  7 01:59 sys/src/cmd/ndb/dn.c
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:311,318 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:311,318
	  	}
	  
	  	if(dnvars.names >= target) {
	- 		dnslog("more names (%lud) than target (%lud)",
	- 			dnvars.names, target);
	+ 		dnslog("more names (%lud) than target (%lud)", dnvars.names,
	+ 			target);
	  		dnvars.oldest /= 2;
	  	}
	  	nextage = now + maxage;
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:595,601 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:595,602
	  			}
	  
	  			/* all things equal, pick the newer one */
	- 			if(rp->arg0 == new->arg0 && rp->arg1 == new->arg1){
	+ 			if(rp->arg0 == new->arg0 && rp->arg1 == new->arg1 &&
	+ 			    (rp->type != Tsrv || rp->srv == new->srv)){
	  				/* new drives out old */
	  				if (new->ttl > rp->ttl ||
	  				    new->expire > rp->expire){
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:1474,1480 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:1475,1482
	  	return r1->owner == r2->owner
	  		&& r1->type == r2->type
	  		&& r1->arg0 == r2->arg0
	- 		&& r1->arg1 == r2->arg1;
	+ 		&& r1->arg1 == r2->arg1
	+ 		&& (r1->type != Tsrv || r1->srv == r2->srv);
	  }
	  
	  void
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:1509,1514 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:1511,1533
	  	return 1;
	  }
	  
	+ int	isaslug(uchar nsip[]);
	+ 
	+ static int
	+ rrisslug(RR *rp)
	+ {
	+ 	uchar addr[IPaddrlen];
	+ 	RR *iprr;
	+ 
	+ 	if (rp->type != Tns)
	+ 		return 0;
	+ 	iprr = rrlookup(rp->host, Ta, NOneg);
	+ 	if (iprr == nil)
	+ 		return 0;
	+ 	parseip(addr, iprr->ip->name);
	+ 	return isaslug(addr);
	+ }
	+ 
	  /*
	   *  randomize the order we return items to provide some
	   *  load balancing for servers.
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:1524,1530 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:1543,1549
	  	if(rp == nil || rp->next == nil)
	  		return rp;
	  
	- 	/* just randomize addresses and mx's */
	+ 	/* just randomize addresses, mx's and ns's */
	  	for(x = rp; x; x = x->next)
	  		if(x->type != Ta && x->type != Tmx && x->type != Tns)
	  			return rp;
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:1545,1551 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:1564,1570
	  		rp = x->next;
	  		x->next = nil;
	  
	- 		if(n&1){
	+ 		if(n&1 && x->type == Tns && rrisslug(x)){
	  			/* add to tail */
	  			if(last == nil)
	  				first = x;
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dn.c:1563,1568 - 
	/n/sources/plan9/sys/src/cmd/ndb/dn.c:1582,1588
	  		/* reroll the dice */
	  		n >>= 1;
	  	}
	+ 	
	  	return first;
	  }
	  
 [geoff] --rw-rw-r-- M 77 glenda sys 5251 Apr  7 02:00 sys/src/cmd/ndb/dnudpserver.c
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dnudpserver.c:146,158 - 
	/n/sources/plan9/sys/src/cmd/ndb/dnudpserver.c:146,156
	  			goto freereq;
	  		}
	  
	- 		if(debug || (trace && subsume(trace, reqmsg.qd->owner->name))){
	+ 		if(debug || (trace && subsume(trace, reqmsg.qd->owner->name)))
	  			dnslog("%d: serve (%I/%d) %d %s %s",
	  				req.id, buf, uh->rport[0]<<8 | uh->rport[1],
	- 				reqmsg.id,
	- 				reqmsg.qd->owner->name,
	+ 				reqmsg.id, reqmsg.qd->owner->name,
	  				rrname(reqmsg.qd->type, tname, sizeof tname));
	- 		}
	  
	  		p = clientrxmit(&reqmsg, buf);
	  		if(p == nil){
	/n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dnudpserver.c:172,177 - 
	/n/sources/plan9/sys/src/cmd/ndb/dnudpserver.c:170,176
	  				dnnotify(&reqmsg, &repmsg, &req);
	  				break;
	  			}
	+ 			/* send reply on fd to address in buf's udp hdr */
	  			reply(fd, buf, &repmsg, &req);
	  			rrfreelist(repmsg.qd);
	  			rrfreelist(repmsg.an);
 [geoff] --rw-rw-r-- M 77 glenda sys 29811 Apr  7 02:36 sys/src/cmd/ndb/dnresolve.c
	[diffs elided - too long]
	[diff -c /n/sourcesdump/2007/0407/plan9/sys/src/cmd/ndb/dnresolve.c /n/sources/plan9/sys/src/cmd/ndb/dnresolve.c]


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.