ndb/dnsdebug: fix dnsserver override (thanks moody)

This commit is contained in:
cinap_lenrek 2024-01-15 03:59:10 +00:00
parent 53fe82ee86
commit 9c2e8e2b13
2 changed files with 21 additions and 8 deletions

View file

@ -1227,9 +1227,10 @@ udpqueryns(Query *qp, int fd, uchar *pkt)
for(rp = qp->nsrp; rp; rp = rp->next)
rp->marker = 0;
/* request recursion only for local dns servers */
/* request recursion only for local/override dns servers */
flag = Oquery;
if(strncmp(qp->nsrp->owner->name, "local#", 6) == 0)
if(strncmp(qp->nsrp->owner->name, "local#", 6) == 0
|| strncmp(qp->nsrp->owner->name, "override#", 9) == 0)
flag |= Frecurse;
/* pack request into a udp message */

View file

@ -170,15 +170,27 @@ logrequest(int id, int depth, char *send, uchar *addr, char *sname, char *rname,
RR*
getdnsservers(int class)
{
RR *rr;
uchar ip[IPaddrlen];
DN *nsdp;
RR *rp;
if(servername == nil)
return dnsservers(class);
rr = rralloc(Tns);
rr->owner = dnlookup("local#dns#servers", class, 1);
rr->host = idnlookup(servername, class, 1);
return rr;
if(parseip(ip, servername) == -1){
nsdp = idnlookup(servername, class, 1);
} else {
nsdp = dnlookup("local#dns#server", class, 1);
rp = rralloc(isv4(ip) ? Ta : Taaaa);
rp->owner = nsdp;
rp->ip = ipalookup(ip, class, 1);
rp->db = 1;
rp->ttl = 10*Min;
rrattach(rp, Authoritative);
}
rp = rralloc(Tns);
rp->owner = dnlookup("override#dns#servers", class, 1);
rp->host = nsdp;
return rp;
}
int