diff options
-rwxr-xr-x | scripts/dns-forwarding/vyatta-dns-forwarding.pl | 12 | ||||
-rw-r--r-- | templates/service/dns/forwarding/domain/node.def | 4 | ||||
-rw-r--r-- | templates/service/dns/forwarding/domain/node.tag/server/node.def | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index 60abc53f..5714d293 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); + my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domain, $server); $config->setLevel("service dns forwarding"); @@ -73,6 +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"); } else { @listen_interfaces = $config->returnValues("listen-on"); @@ -80,6 +81,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"); } if (@listen_interfaces != 0) { @@ -115,6 +117,14 @@ 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 (@use_dhcp_nameservers != 0) { $use_dnsmasq_conf = 1; diff --git a/templates/service/dns/forwarding/domain/node.def b/templates/service/dns/forwarding/domain/node.def new file mode 100644 index 00000000..bdd82752 --- /dev/null +++ b/templates/service/dns/forwarding/domain/node.def @@ -0,0 +1,4 @@ +tag: +type: txt +help: DNS domain to forward to a local server +commit:expression: $VAR(./server/) != ""; "Error: No server configured for the domain $VAR(@)" diff --git a/templates/service/dns/forwarding/domain/node.tag/server/node.def b/templates/service/dns/forwarding/domain/node.tag/server/node.def new file mode 100644 index 00000000..3dec7d5d --- /dev/null +++ b/templates/service/dns/forwarding/domain/node.tag/server/node.def @@ -0,0 +1,2 @@ +type: ipv4 +help: DNS server to forward queries |