summaryrefslogtreecommitdiff
path: root/scripts/dns-forwarding
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2009-04-22 17:53:24 -0700
committerMohit Mehta <mohit.mehta@vyatta.com>2009-04-22 17:53:24 -0700
commit6dd0e09754ec0c324884f5daa0666a2c753fc896 (patch)
treebae9f95227e4f2e5469525f035a1e4e1c7aca74b /scripts/dns-forwarding
parent5c2c847fe2798fdb762e225cad1404beb1546bc2 (diff)
downloadvyatta-cfg-system-6dd0e09754ec0c324884f5daa0666a2c753fc896.tar.gz
vyatta-cfg-system-6dd0e09754ec0c324884f5daa0666a2c753fc896.zip
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
Diffstat (limited to 'scripts/dns-forwarding')
-rw-r--r--scripts/dns-forwarding/vyatta-dns-forwarding.pl48
1 files changed, 3 insertions, 45 deletions
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";
}
}