aboutsummaryrefslogtreecommitdiffstats
path: root/config/tinydns/tinydns.inc
diff options
context:
space:
mode:
authorSeth Mos <seth.mos@dds.nl>2012-06-23 11:16:23 -0700
committerSeth Mos <seth.mos@dds.nl>2012-06-23 11:16:23 -0700
commit7a8e84b83eef9a051a1623333f201f2d1f0a74ab (patch)
treef3b2264e4508c4cfa51c25d4aa2b146b55d20a1a /config/tinydns/tinydns.inc
parenta879e0579f55fd5b1b2bd831cae2e09f1cd6761d (diff)
parent4b75de5354a13eee4179b1c6526f2589a7c7ce43 (diff)
downloadpfsense-packages-7a8e84b83eef9a051a1623333f201f2d1f0a74ab.tar.gz
pfsense-packages-7a8e84b83eef9a051a1623333f201f2d1f0a74ab.tar.bz2
pfsense-packages-7a8e84b83eef9a051a1623333f201f2d1f0a74ab.zip
Merge pull request #262 from bguerin/master
TinyDNS : Use first DNS server configured in System -> General setup if we don't have one received by DHCP on WANs
Diffstat (limited to 'config/tinydns/tinydns.inc')
-rw-r--r--config/tinydns/tinydns.inc12
1 files changed, 11 insertions, 1 deletions
diff --git a/config/tinydns/tinydns.inc b/config/tinydns/tinydns.inc
index f6b9b556..1b3e7c0c 100644
--- a/config/tinydns/tinydns.inc
+++ b/config/tinydns/tinydns.inc
@@ -1139,7 +1139,17 @@ function tinydns_dnscache_forwarding_servers($index) {
exec("rm -R {$g['varetc_path']}/dnscache/root/servers/");
exec("/bin/mkdir -p {$g['varetc_path']}/dnscache{$index}/root/servers/");
if (intval($config['version']) >= 6)
- exec("/bin/cat {$g['varetc_path']}/nameserver_* > {$g['varetc_path']}/dnscache{$index}/root/servers/@");
+ if (file_exists("{$g['varetc_path']}/nameserver_*")) {
+ exec("/bin/cat {$g['varetc_path']}/nameserver_* > {$g['varetc_path']}/dnscache{$index}/root/servers/@");
+ } else {
+ $fw = fopen("{$g['varetc_path']}/dnscache{$index}/root/servers/@", "w");
+ if (! $fw) {
+ printf("Error: cannot open dnscache/root/servers/@ in tinydns_register_forwarding_servers().\n");
+ return 1;
+ }
+ fwrite($fw, $config['system']['dnsserver'][0]);
+ fclose($fw);
+ }
else {
$fr = fopen("{$g['varetc_path']}/resolv.conf.dnscache", "r");
if (! $fr) {