shithub: riscv

Download patch

ref: b868b9919f570cbcbdb3c713bf1431b9d843ea43
parent: 12dec344ac21fc49e1ee374f8ce53403eaf73e84
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jun 26 16:28:26 EDT 2023

ndb/dns: hack for the caching server for delegated nameservers

This is a hack for a delegation to a nameservers that
simply do not answer with authorative replies.

This results in us asking some higher up nameserver
when no answer is returned, but because the ns record
is itself already authorative, it wont be able to update
any new info (rrattach()).

Instead, we cut the search short if the nameserver
ns record is set as authorative in ndb (with soa=).

it is a unfortunate hack because this behaviour cannot
be implemented for non-caching server as it does not
load the authorative areas (inmyarea()).

--- a/sys/src/cmd/ndb/dnresolve.c
+++ b/sys/src/cmd/ndb/dnresolve.c
@@ -337,6 +337,10 @@
 		if(nsrp){
 			rrfreelistptr(&dbnsrp);
 
+			/* hack: stop search if ns is authoritative in db */
+			if(cfg.cachedb && nsrp->db && nsrp->auth)
+				cp = "";
+
 			/* query the name servers found in cache */
 			if(netqueryns(qp, depth+1, nsrp) > Answnone)
 				return rrlookup(qp->dp, qp->type, OKneg);