From 733259a85b0791b9779e4a03fa65158770c48637 Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Tue, 10 Feb 2015 22:56:06 +0000 Subject: 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 --- scripts/dns-forwarding/vyatta-dns-forwarding.pl | 25 ++++++++++++++-------- .../dns/forwarding/domain/node.tag/server/node.def | 1 + 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 -- cgit v1.2.3 From ad79079808876ed0161ab4d8933d66a86f93a6bd Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Tue, 24 Feb 2015 22:33:34 +0000 Subject: Revert "vyatta-cfg-system: multiple servers for dns forwarding domain override" This reverts commit 733259a85b0791b9779e4a03fa65158770c48637. --- scripts/dns-forwarding/vyatta-dns-forwarding.pl | 25 ++++++++-------------- .../dns/forwarding/domain/node.tag/server/node.def | 1 - 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index 217a520a..b5efd269 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, @domains, $server, $ignore_hosts_file); + my (@listen_interfaces, $cache_size, @use_nameservers, $use_system_nameservers, @use_dhcp_nameservers, @domain, $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"); - @domains = $config->listOrigNodes("domain"); + @domain = $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"); - @domains = $config->listNodes("domain"); + @domain = $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,18 +123,11 @@ sub dnsforwarding_get_values { } } } - 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"; - } + 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"; } } } 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 8f40a299..3dec7d5d 100644 --- a/templates/service/dns/forwarding/domain/node.tag/server/node.def +++ b/templates/service/dns/forwarding/domain/node.tag/server/node.def @@ -1,3 +1,2 @@ -multi: type: ipv4 help: DNS server to forward queries -- cgit v1.2.3 From 57cc55d8bab4640f8245ececa03b115a1524197f Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Mon, 9 Feb 2015 21:01:35 +0000 Subject: vyatta-cfg-system: invalid resolv.conf format causing extra DNS request The resolv.conf file contains comments at the end of the search and domain entries which cause unexpected behaviour on lookups. Moving these to the line above in each case fixes the issue. Bug #468 http://bugzilla.vyos.net/show_bug.cgi?id=468 --- scripts/system/vyatta_update_resolv.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl index 921052f0..93e6041d 100755 --- a/scripts/system/vyatta_update_resolv.pl +++ b/scripts/system/vyatta_update_resolv.pl @@ -96,12 +96,12 @@ if (!defined($domain_name)) { my $search = ''; if (length($doms) > 0) { - $search = "search\t\t$doms\t\t#line generated by $0\n"; + $search = "#line generated by $0\nsearch\t\t$doms\n"; } my $domain = ''; if ($domain_name && length($domain_name) > 0) { - $domain = "domain\t\t$domain_name\t\t#line generated by $0\n"; + $domain = "#line generated by $0\ndomain\t\t$domain_name\n"; } # update /etc/resolv.conf with name-servers received from dhcp client, done when this script is called @@ -221,7 +221,7 @@ foreach my $line (@resolv) { if (length($domain) > 0) { print $r $domain; } - } else { + } elsif ($line !~ /^#line generated by\s/) { print $r $line; } } -- cgit v1.2.3 From c546dd3ad5c15c42494d9fddf60704043985fe48 Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Wed, 25 Feb 2015 07:23:05 +0000 Subject: 0.20.43+vyos1+helium27 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index 671002a4..c67edc8d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +vyatta-cfg-system (0.20.43+vyos1+helium27) unstable; urgency=low + + [ Alex Harpin ] + * vyatta-cfg-system: multiple servers for dns forwarding domain override + * Revert "vyatta-cfg-system: multiple servers for dns forwarding domain override" + * vyatta-cfg-system: invalid resolv.conf format causing extra DNS request + + -- Alex Harpin Wed, 25 Feb 2015 07:21:38 +0000 + vyatta-cfg-system (0.20.43+vyos1+helium26) unstable; urgency=low * Bug #490: use command line options for parameters-only and temporary -- cgit v1.2.3