aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenoit GUERIN <benoit.guerin1@free.fr>2012-06-23 19:28:22 +0200
committerBenoit GUERIN <benoit.guerin1@free.fr>2012-06-23 19:28:22 +0200
commit4b75de5354a13eee4179b1c6526f2589a7c7ce43 (patch)
treedc99977dc46b6c555c602c402d794c884772e07b
parent29c00462a5b073f61996bf363796d84145b5bff0 (diff)
downloadpfsense-packages-4b75de5354a13eee4179b1c6526f2589a7c7ce43.tar.gz
pfsense-packages-4b75de5354a13eee4179b1c6526f2589a7c7ce43.tar.bz2
pfsense-packages-4b75de5354a13eee4179b1c6526f2589a7c7ce43.zip
Use first DNS server configured in System -> General setup if we don't have one received by DHCP on WANs
-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) {