::arg().set("forward-zones-recurse", "Zones for which we forward queries with recursion bit, comma separated domain=ip pairs")="";
::arg().set("forward-zones-file", "File with (+)domain=ip pairs for forwarding")="";
::arg().set("export-etc-hosts", "If we should serve up contents from /etc/hosts")="off";
- // ::arg().set("export-etc-hosts-search-suffix", "Also serve up the contents of /etc/hosts with this suffix")="";
+ ::arg().set("export-etc-hosts-search-suffix", "Also serve up the contents of /etc/hosts with this suffix")="";
::arg().set("etc-hosts-file", "Path to 'hosts' file")="/etc/hosts";
::arg().set("serve-rfc1918", "If we should be authoritative for RFC 1918 private IP space")="";
::arg().set("auth-can-lower-ttl", "If we follow RFC 2181 to the letter, an authoritative server can lower the TTL of NS records")="off";
L<<Logger::Warning<<"Could not open /etc/hosts for reading"<<endl;
}
else {
+ string searchSuffix = ::arg()["export-etc-hosts-search-suffix"];
string::size_type pos;
while(getline(ifs,line)) {
pos=line.find('#');
if(parts[0].find(':')!=string::npos)
continue;
- for(unsigned int n=1; n < parts.size(); ++n)
+ for(unsigned int n=1; n < parts.size(); ++n) {
makeNameToIPZone(newMap, parts[n], parts[0]);
+ if(!searchSuffix.empty()) {
+ string canonic=toCanonic(searchSuffix, parts[n]);
+ if(canonic != parts[n]) {
+ makeNameToIPZone(newMap, canonic, parts[0]);
+ }
+ }
+ }
makeIPToNamesZone(newMap, parts);
}
}