Project

General

Profile

Actions

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.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03/21/2010
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.0
Affected Plus Version:
Affected Architecture:

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.

Actions #1

Updated by Henrik Kaare Poulsen over 15 years ago

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/@");
}
Actions #2

Updated by Ermal Luçi over 15 years ago

  • Status changed from New to Feedback

This should be fixed on latest versions.

Actions #3

Updated by Henrik Kaare Poulsen over 15 years ago

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.

Actions #4

Updated by Henrik Kaare Poulsen over 15 years ago

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/@");
}

Actions #5

Updated by Ermal Luçi over 15 years ago

Try reinstalling again.

Actions #6

Updated by Henrik Kaare Poulsen over 15 years ago

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)

Actions #7

Updated by Chris Buechler over 15 years ago

  • Status changed from Feedback to New
Actions #8

Updated by Ermal Luçi over 15 years ago

  • Status changed from New to Feedback
Actions #9

Updated by Henrik Kaare Poulsen over 15 years ago

Thank you very much for the fix - works for me now!

Actions #10

Updated by Chris Buechler about 15 years ago

  • Status changed from Feedback to Resolved
Actions

Also available in: Atom PDF