ref: 00622d4d2b47d949de0894febdc149ed203130ea
parent: 0d7bbda9b93e4af3c512f835cc502a7e9a60c359
author: cinap_lenrek <[email protected]>
date: Mon Jul 16 19:54:23 EDT 2018
ndb/dns: fix delegation with norecursion (-R flag) when the question zone is in a delegated area, we still need to provide the nameservers.
--- 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