This commit is contained in:
cinap_lenrek 2018-07-16 23:55:45 +02:00
commit ec5227f7f5

View file

@ -67,34 +67,34 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
Oquery; Oquery;
return; return;
} }
} else }
if(norecursion) { if(myarea == nil && norecursion) {
/* we don't recurse and we're not authoritative */ /* we don't recurse and we're not authoritative */
repp->flags = Rok | Fresp | Oquery; repp->flags = Rok | Fresp | Oquery;
return; 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 * add name server if we know
*/ */
@ -120,6 +120,7 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
if(repp->ns) if(repp->ns)
break; break;
} }
}
/* /*
* add ip addresses as hints * 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 * add an soa to the authority section to help client
* with negative caching * with negative caching
*/ */
if(repp->an == nil) if(repp->an == nil){
if(myarea != nil){ if(myarea != nil){
rrcopy(myarea->soarr, &tp); rrcopy(myarea->soarr, &tp);
rrcat(&repp->ns, tp); rrcat(&repp->ns, tp);
@ -146,6 +147,7 @@ dnserver(DNSmsg *reqp, DNSmsg *repp, Request *req, uchar *srcip, int rcode)
} }
repp->flags |= neg->negrcode; repp->flags |= neg->negrcode;
} }
}
/* /*
* get rid of duplicates * get rid of duplicates