| Re: [9fans] dnsquery or search |
|
 |
|
 |
|
 |
|
 |
Group: comp.os.plan9 · Group Profile
Author: erik quanstromerik quanstrom Date: Sep 18, 2008 04:52
> I see that ndb/dnsquery returns correct information on my system, but
> I noticed that there is not a default domainname, like on linux, in /
> etc/resolv.conf we set the "search domainname" ... is there a similar
> setting in plan9
plan 9 dns tries to look up unrooted (no ".") names in the local databases.
first success wins.
here's the algorithm from /sys/src/cmd/ndb/dnresolve.c
/*
* hack for systems that don't have resolve search
* lists. Just look up the simple name in the database.
*/
if(!rooted && strchr(name, '.') == nil){
rp = nil;
drp = domainlist(class);
for(nrp = drp; rp == nil && nrp != nil; nrp = nrp->next){
snprint(nname, sizeof nname, "%%s.%%s", name,
nrp->ptr->name);
rp = dnresolve(nname, class, type, req, cn, depth+1,
recurse, rooted, status);
rrfreelist(rrremneg(&rp));
}
if(drp != nil)
rrfreelist(drp);
procsetname(procname);
free(procname);
return rp;
}
- erik
|