diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-11-21 17:09:30 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2008-11-21 17:09:30 -0800 |
commit | 32cefc2d846f9946bf6e5b84cd914b5e2959dbfa (patch) | |
tree | 0bbb5d52e5621b84a897bd023ae51e15c9e72be9 /scripts/vyatta-interfaces.pl | |
parent | 6d87be16190a658ac324488024a82961774f0ece (diff) | |
download | vyatta-cfg-32cefc2d846f9946bf6e5b84cd914b5e2959dbfa.tar.gz vyatta-cfg-32cefc2d846f9946bf6e5b84cd914b5e2959dbfa.zip |
Convert VyattaConfig (et al) to Vyatta::Config
Use hierarchal directory structure
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-x[-rw-r--r--] | scripts/vyatta-interfaces.pl | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl index 6453717..31b7d8d 100644..100755 --- a/scripts/vyatta-interfaces.pl +++ b/scripts/vyatta-interfaces.pl @@ -31,8 +31,8 @@ # use lib "/opt/vyatta/share/perl5/"; -use VyattaConfig; -use VyattaMisc; +use Vyatta::Config; +use Vyatta::Misc; use Getopt::Long; use POSIX; @@ -126,7 +126,7 @@ sub dhcp_conf_header { sub is_address_enabled { my $intf = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; ## FIXME this is name based madness find a better way ## so we don't have to redo with each interface type! @@ -160,20 +160,20 @@ sub is_address_enabled { } sub get_hostname { - my $config = new VyattaConfig; + my $config = new Vyatta::Config; $config->setLevel("system"); return $config->returnValue("host-name"); } sub is_domain_name_set { - my $config = new VyattaConfig; + my $config = new Vyatta::Config; $config->setLevel("system"); return $config->returnValue("domain-name"); } sub get_mtu { my $intf = shift; - my $config = new VyattaConfig; + my $config = new Vyatta::Config; $config->setLevel("interfaces $intf"); return $config->returnValue("mtu"); } @@ -224,7 +224,7 @@ sub is_intf_disabled { exit 1; } - my $config = new VyattaConfig; + my $config = new Vyatta::Config; $config->setLevel("$intf_cli_path"); if ($intf =~ m/^br/) { @@ -245,7 +245,7 @@ sub is_intf_disabled { sub run_dhclient { my $intf = shift; - my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = VyattaMisc::generate_dhclient_intf_files($intf); + my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = Vyatta::Misc::generate_dhclient_intf_files($intf); dhcp_update_config($intf_config_file, $intf); if (!(is_intf_disabled($intf))) { my $cmd = "$dhcp_daemon -q -nw -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file $intf 2> /dev/null &"; @@ -258,7 +258,7 @@ sub run_dhclient { sub stop_dhclient { my $intf = shift; if (!(is_intf_disabled($intf))) { - my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = VyattaMisc::generate_dhclient_intf_files($intf); + my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = Vyatta::Misc::generate_dhclient_intf_files($intf); my $release_cmd = "$dhcp_daemon -q -cf $intf_config_file -pf $intf_process_id_file -lf $intf_leases_file -r $intf 2> /dev/null"; system ($release_cmd) == 0 or warn "stop $dhcp_daemon failed: $?\n"; @@ -387,7 +387,7 @@ sub is_valid_addr { print "Error: can't use dhcp client on loopback interface\n"; exit 1; } - if (VyattaMisc::is_dhcp_enabled($intf)) { + if (Vyatta::Misc::is_dhcp_enabled($intf)) { print "Error: dhcp already configured for $intf\n"; exit 1; } @@ -433,7 +433,7 @@ sub is_valid_addr { } } - if (VyattaMisc::is_dhcp_enabled($intf)) { + if (Vyatta::Misc::is_dhcp_enabled($intf)) { print "Error: remove dhcp before adding static addresses for $intf\n"; exit 1; } @@ -459,12 +459,12 @@ sub is_valid_addr { sub op_dhcp_command { my ($op_command, $intf) = @_; - if (!VyattaMisc::is_dhcp_enabled($intf)) { + if (!Vyatta::Misc::is_dhcp_enabled($intf)) { print "$intf is not using DHCP to get an IP address\n"; exit 1; } - my $flags = VyattaMisc::get_sysfs_value($intf, 'flags'); + my $flags = Vyatta::Misc::get_sysfs_value($intf, 'flags'); my $hex_flags = hex($flags); if (!($hex_flags & 0x1)) { print "$intf is disabled. Unable to release/renew lease\n"; |