summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-02-10 22:56:06 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-02-24 22:30:46 +0000
commit733259a85b0791b9779e4a03fa65158770c48637 (patch)
tree23a3c026bfe36612321d8fb518a1fca862f610d6
parent55ca193fc1c4945b8d1e16d8f5b6333d3a5228dd (diff)
downloadvyatta-cfg-system-733259a85b0791b9779e4a03fa65158770c48637.tar.gz
vyatta-cfg-system-733259a85b0791b9779e4a03fa65158770c48637.zip
vyatta-cfg-system: multiple servers for dns forwarding domain override
When configuring DNS fowarding, allow multiple servers to be specified when setting domain overrides, in order to allow Dnsmasq to gracefully handle unavailable nameservers. Bug #408 http://bugzilla.vyos.net/show_bug.cgi?id=408
-rwxr-xr-xscripts/dns-forwarding/vyatta-dns-forwarding.pl25
-rw-r--r--templates/service/dns/forwarding/domain/node.tag/server/node.def1
2 files changed, 17 insertions, 9 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
index b5efd269..217a520a 100755
--- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl
+++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
@@ -63,7 +63,7 @@ sub dnsforwarding_get_values {
my $output = '';
my $config = new Vyatta::Config;
my $use_dnsmasq_conf = 0;
- my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domain, $server, $ignore_hosts_file);
+ my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domains, $server, $ignore_hosts_file);
$config->setLevel("service dns forwarding");
@@ -73,7 +73,7 @@ sub dnsforwarding_get_values {
@use_nameservers = $config->returnOrigValues("name-server");
$use_system_nameservers = $config->existsOrig("system");
@use_dhcp_nameservers = $config->returnOrigValues("dhcp");
- @domain = $config->listOrigNodes("domain");
+ @domains = $config->listOrigNodes("domain");
$ignore_hosts_file = $config->returnOrigValue("ignore-hosts-file");
} else {
@@ -82,7 +82,7 @@ sub dnsforwarding_get_values {
@use_nameservers = $config->returnValues("name-server");
$use_system_nameservers = $config->exists("system");
@use_dhcp_nameservers = $config->returnValues("dhcp");
- @domain = $config->listNodes("domain");
+ @domains = $config->listNodes("domain");
$ignore_hosts_file = $config->exists("ignore-hosts-file");
}
@@ -112,7 +112,7 @@ sub dnsforwarding_get_values {
my $sys_config = new Vyatta::Config;
$sys_config->setLevel("system");
my @system_nameservers;
- if ($outside_cli == 1){
+ if ($outside_cli == 1) {
@system_nameservers = $sys_config->returnOrigValues("name-server");
} else {
@system_nameservers = $sys_config->returnValues("name-server");
@@ -123,11 +123,18 @@ sub dnsforwarding_get_values {
}
}
}
- if (@domain != 0) {
- foreach my $dom (@domain) {
- my $ser = $config->returnValue("domain $dom server");
- if (defined ($ser)) {
- $output .="server=/$dom/$ser\t# domain-override\n";
+ if (@domains != 0) {
+ foreach my $domain (@domains) {
+ my @domain_servers;
+ if ($outside_cli == 1) {
+ @domain_servers = $config->returnValues("domain $domain server");
+ } else {
+ @domain_servers = $config->returnValues("domain $domain server");
+ }
+ if (@domain_servers > 0) {
+ foreach my $domain_server (@domain_servers) {
+ $output .="server=/$domain/$domain_server\t# domain-override\n";
+ }
}
}
}
diff --git a/templates/service/dns/forwarding/domain/node.tag/server/node.def b/templates/service/dns/forwarding/domain/node.tag/server/node.def
index 3dec7d5d..8f40a299 100644
--- a/templates/service/dns/forwarding/domain/node.tag/server/node.def
+++ b/templates/service/dns/forwarding/domain/node.tag/server/node.def
@@ -1,2 +1,3 @@
+multi:
type: ipv4
help: DNS server to forward queries