summaryrefslogtreecommitdiff
path: root/scripts/dns-forwarding
diff options
context:
space:
mode:
authorMohit Mehta <mohit.mehta@vyatta.com>2008-08-30 16:13:53 +0000
committerMohit Mehta <mohit.mehta@vyatta.com>2008-08-30 16:13:53 +0000
commita43151a69c1482c1c10806e83271f94fb691199d (patch)
tree9c90bff579cd6cbebbf4778828eb90a59c831208 /scripts/dns-forwarding
parent6a040ff8506966bae20d7e0638750c7a837e48ad (diff)
downloadvyatta-cfg-quagga-a43151a69c1482c1c10806e83271f94fb691199d.tar.gz
vyatta-cfg-quagga-a43151a69c1482c1c10806e83271f94fb691199d.zip
prompt warning for no nameservers if no nameservers set and no interface set to use dhcp
Diffstat (limited to 'scripts/dns-forwarding')
-rw-r--r--scripts/dns-forwarding/vyatta-dns-forwarding.pl46
1 files changed, 44 insertions, 2 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
index 902e91bc..08cea70a 100644
--- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl
+++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl
@@ -162,6 +162,47 @@ sub check_system_nameserver {
}
+sub check_dhcp_any_interface {
+
+ my $config = new VyattaConfig;
+ $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 is_dhcp_enabled {
my $intf = shift;
@@ -246,8 +287,9 @@ if (defined $update_dnsforwarding) {
if (!(defined $use_system_nameservers) && (@use_dhcp_nameservers == 0) && (@use_nameservers == 0)) {
my $nameserver_exists = check_nameserver();
- if ($nameserver_exists < 1){
- print "DNS forwarding warning: No DNS servers ('system' or 'dhcp received') to forward queries.\n";
+ 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";
}
}