diff options
author | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-03-10 17:39:13 -0700 |
---|---|---|
committer | Mohit Mehta <mohit.mehta@vyatta.com> | 2009-03-10 17:39:13 -0700 |
commit | b528d9ab2e06e7167281f46dcbed45a68462ab0d (patch) | |
tree | 8c7edee3f9561aa18131077344d847b899b3819e /scripts | |
parent | 895be1fb5a50943af5b062e6fcb8d75b66562264 (diff) | |
download | vyatta-cfg-quagga-b528d9ab2e06e7167281f46dcbed45a68462ab0d.tar.gz vyatta-cfg-quagga-b528d9ab2e06e7167281f46dcbed45a68462ab0d.zip |
use code from Vyatta::Misc where is_dhcp_enabled() is already defined
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/dns-forwarding/vyatta-dns-forwarding.pl | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/scripts/dns-forwarding/vyatta-dns-forwarding.pl b/scripts/dns-forwarding/vyatta-dns-forwarding.pl index 8c28becd..b536dada 100644 --- a/scripts/dns-forwarding/vyatta-dns-forwarding.pl +++ b/scripts/dns-forwarding/vyatta-dns-forwarding.pl @@ -204,40 +204,11 @@ sub check_dhcp_any_interface { } -sub is_dhcp_enabled { - my $intf = shift; - - my $config = new Vyatta::Config; - - if ($intf =~ m/^eth/) { - if ($intf =~ m/(\w+)\.(\d+)/) { - $config->setLevel("interfaces ethernet $1 vif $2"); - } else { - $config->setLevel("interfaces ethernet $intf"); - } - } elsif ($intf =~ m/^br/) { - $config->setLevel("interfaces bridge $intf"); - } else { - # - # currently we only support dhcp on ethernet - # and bridge interfaces. - # - return 0; - } - 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; - if (!is_dhcp_enabled($interface)) { + if (!Vyatta::Misc::is_dhcp_enabled($interface)) { print "DNS forwarding error: $interface is not using DHCP to get an IP address\n"; return 0; } |