summaryrefslogtreecommitdiff
path: root/sys/src
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2018-07-16 23:54:23 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2018-07-16 23:54:23 +0200
commit00622d4d2b47d949de0894febdc149ed203130ea (patch)
treededfa0ac2676b9969d8219c588915c1cd816646b /sys/src
parent0d7bbda9b93e4af3c512f835cc502a7e9a60c359 (diff)
ndb/dns: fix delegation with norecursion (-R flag)
when the question zone is in a delegated area, we still need to provide the nameservers.
Diffstat (limited to 'sys/src')
-rw-r--r--sys/src/cmd/ndb/dnserver.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/sys/src/cmd/ndb/dnserver.c b/sys/src/cmd/ndb/dnserver.c
index 87a35ab28..f3f7cfab4 100644
--- a/sys/src/cmd/ndb/dnserver.c
+++ b/sys/src/cmd/ndb/dnserver.c
@@ -67,34 +67,34 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
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);
+
+ /* 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;
}
-
- /*
- * 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;
-
- /* 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 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
if(repp->ns)
break;
}
+ }
/*
* add ip addresses as hints
@@ -135,7 +136,7 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
* 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 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
}
repp->flags |= neg->negrcode;
}
+ }
/*
* get rid of duplicates