From 6dd0e09754ec0c324884f5daa0666a2c753fc896 Mon Sep 17 00:00:00 2001 From: Mohit Mehta Date: Wed, 22 Apr 2009 17:53:24 -0700 Subject: Fix Bug 4207 dns forwarding has hardcoded ethernet assumptions incorrect in assuming that nameservers can only be received via dhcp remove check to see if any eth/br interface using dhcp --- scripts/dns-forwarding/vyatta-dns-forwarding.pl | 48 ++----------------------- 1 file changed, 3 insertions(+), 45 deletions(-) (limited to 'scripts/dns-forwarding') diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index b536dada..d8552bd4 100644 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -150,7 +150,7 @@ sub dnsforwarding_write_file { sub check_nameserver { - my $cmd = `grep nameserver /etc/resolv.conf 2>/dev/null | wc -l`; + my $cmd = `cat /etc/resolv.conf 2>/dev/null | awk {'print \$1'} | grep \^nameserver\$ | wc -l`; return $cmd; } @@ -163,47 +163,6 @@ sub check_system_nameserver { } -sub check_dhcp_any_interface { - - my $config = new Vyatta::Config; - $config->setLevel("interfaces ethernet"); - my @eths = $config->listNodes("."); - foreach my $eth (@eths) { - $config->setLevel("interfaces ethernet $eth"); - my @addrs = $config->returnOrigValues("address"); - foreach my $addr (@addrs) { - if (defined $addr && $addr eq "dhcp") { - return 1; - } - } - my @vifs = $config->listNodes("vif"); - foreach my $vif (@vifs) { - $config->setLevel("interfaces ethernet $eth vif $vif"); - my @addrs = $config->returnOrigValues("address"); - foreach my $addr (@addrs) { - if (defined $addr && $addr eq "dhcp") { - return 1; - } - } - } - } - - $config->setLevel("interfaces bridge"); - my @bridges = $config->listNodes("."); - foreach my $bridge (@bridges) { - $config->setLevel("interfaces bridge $bridge"); - my @addrs = $config->returnOrigValues("address"); - foreach my $addr (@addrs) { - if (defined $addr && $addr eq "dhcp") { - return 1; - } - } - } - - return 0; - -} - sub check_dhcp_interface { my $interface = shift; @@ -258,9 +217,8 @@ if (defined $update_dnsforwarding) { if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) { my $nameserver_exists = check_nameserver(); - my $dhcp_enabled_any_interface = check_dhcp_any_interface(); - if ($nameserver_exists < 1 && $dhcp_enabled_any_interface == 0){ - print "DNS forwarding warning: No name-servers to forward DNS queries\n"; + if ($nameserver_exists < 1){ + print "DNS forwarding warning: Currently, no name-servers to forward DNS queries\n"; } } -- cgit v1.2.3