Bug #440
closed
TinyDNS: dnscache goes into infinite loop when reconfigured
Added by Henrik Kaare Poulsen over 15 years ago.
Updated about 15 years ago.
Description
BETA 2 snapshot 20100321-0116
When dnscache in the TinyDNS package is configured, it will read "/etc/resolv.conf" (presumably containing the nameservers assigned by DHCP from the WAN interface).
Then it will write those into "/var/etc/resolv.conf.dnscache" and "/etc/dnscache/root/servers/@"
Now, if TinyDNS is reconfigured from the GUI (even without changing anything, just "Save"), it will go through the same process. But now "/etc/resolv.conf" nameserver entry points to the local server, effectively creating an endless loop.
Proposal:
Read nameserver names from "/var/etc/nameservers.conf" instead.
PATCH¶
In tinydns.inc
change the function tinydns_dnscache_forwarding_servers
to
function tinydns_dnscache_forwarding_servers() {
if (! file_exists("/var/etc/nameservers.conf")) {
printf("Error: cannot open /var/etc/nameservers.conf in tinydns_register_forwarding_servers().\n");
return 1;
}
exec("echo 1 > /etc/dnscache/env/FORWARDONLY");
if(is_dir("/etc/dnscache/root/servers/"))
exec("rm -R /etc/dnscache/root/servers/");
exec("mkdir /etc/dnscache/root/servers/");
/* dnscache does not allow @ to be a symbolic link */
exec("cp /var/etc/nameservers.conf /etc/dnscache/root/servers/@");
}
- Status changed from New to Feedback
This should be fixed on latest versions.
I am sorry, but the TinyDNS package version 1.0.6.6 does not solve the problem.
Please see previously offered patch, which I believe does solve the problem.
With the latest tinydns.inc
the patch is:
function tinydns_dnscache_forwarding_servers($index) {
exec("echo 1 > /etc/dnscache{$index}/env/FORWARDONLY");
if(is_dir("/etc/dnscache{$index}/root/servers/"))
exec("rm -R /etc/dnscache/root/servers/");
exec("mkdir -p /etc/dnscache{$index}/root/servers/");
exec("/bin/cat /var/etc/nameserver_* > /etc/dnscache{$index}/root/servers/@");
}
Unfortunately it still does not work.
This patch works for me:
--- tinydns.inc.ORIG 2010-03-26 17:11:43.000000000 +0100
+++ tinydns.inc 2010-03-26 17:12:12.000000000 +0100
@@ -207,7 +207,6 @@
$ipmask = $config['interfaces'][$dnsif]['subnet'];
$arr = tinydns_get_ip_subnet_arpa($dnscacheip, $ipmask);
$dnsuserip = $arr[0];
- exec("mkdir /etc/dnscache{$dnsidx}");
exec("/usr/local/bin/dnscache-conf Gdnscache Gdnslog /etc/dnscache{$dnsidx} {$dnscacheip}");
exec("/bin/ln -s /etc/dnscache{$dnsidx} /service/");
if (!is_dir("/etc/dnscache{$dnsidx}/env/IP"))
(dnscache-conf creates the directory for us, and fails if the directory is already existing)
- Status changed from Feedback to New
- Status changed from New to Feedback
Thank you very much for the fix - works for me now!
- Status changed from Feedback to Resolved
Also available in: Atom
PDF