shithub: riscv

Download patch

ref: ec5227f7f554d54c04258a17bc2bed433cccb4ab
parent: 37b560e50f263b3342a8f8933c3c836272786a4e
parent: 00622d4d2b47d949de0894febdc149ed203130ea
author: cinap_lenrek <[email protected]>
date: Mon Jul 16 19:55:45 EDT 2018

merge

--- a/sys/src/cmd/ndb/dnserver.c
+++ b/sys/src/cmd/ndb/dnserver.c
@@ -67,34 +67,34 @@
 				Oquery;
 			return;
 		}
-	} else
-		if(norecursion) {
-			/* we don't recurse and we're not authoritative */
-			repp->flags = Rok | Fresp | Oquery;
-			return;
-		}
+	}
+	if(myarea == nil && norecursion) {
+		/* we don't recurse and we're not authoritative */
+		repp->flags = Rok | Fresp | Oquery;
+		neg = nil;
+	} else {
+		/*
+		 *  get the answer if we can, in *repp
+		 */
+		if(reqp->flags & Frecurse)
+			neg = doextquery(repp, req, Recurse);
+		else
+			neg = doextquery(repp, req, Dontrecurse);
 
-	/*
-	 *  get the answer if we can, in *repp
-	 */
-	if(reqp->flags & Frecurse)
-		neg = doextquery(repp, req, Recurse);
-	else
-		neg = doextquery(repp, req, Dontrecurse);
+		/* authority is transitive */
+		if(myarea != nil || (repp->an && repp->an->auth))
+			repp->flags |= Fauth;
 
-	/* authority is transitive */
-	if(myarea != nil || (repp->an && repp->an->auth))
-		repp->flags |= Fauth;
-
-	/* pass on error codes */
-	if(repp->an == nil){
-		dp = dnlookup(repp->qd->owner->name, repp->qd->owner->class, 0);
-		if(dp->rr == nil)
-			if(reqp->flags & Frecurse)
-				repp->flags |= dp->respcode | Fauth;
+		/* pass on error codes */
+		if(repp->an == nil){
+			dp = dnlookup(repp->qd->owner->name, repp->qd->owner->class, 0);
+			if(dp->rr == nil)
+				if(reqp->flags & Frecurse)
+					repp->flags |= dp->respcode | Fauth;
+		}
 	}
 
-	if(myarea == nil)
+	if(myarea == nil){
 		/*
 		 *  add name server if we know
 		 */
@@ -120,6 +120,7 @@
 			if(repp->ns)
 				break;
 		}
+	}
 
 	/*
 	 *  add ip addresses as hints
@@ -135,7 +136,7 @@
 	 *  add an soa to the authority section to help client
 	 *  with negative caching
 	 */
-	if(repp->an == nil)
+	if(repp->an == nil){
 		if(myarea != nil){
 			rrcopy(myarea->soarr, &tp);
 			rrcat(&repp->ns, tp);
@@ -146,6 +147,7 @@
 			}
 			repp->flags |= neg->negrcode;
 		}
+	}
 
 	/*
 	 *  get rid of duplicates