mirror of
git://git.9front.org/plan9front/plan9front
synced 2025-01-12 11:10:06 +00:00
ndb/dnsdebug: fix dnsserver override (thanks moody)
This commit is contained in:
parent
53fe82ee86
commit
9c2e8e2b13
2 changed files with 21 additions and 8 deletions
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue