summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-27 14:29:00 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-27 14:29:00 -0700
commit6dc71d03ef92e7a0e66ed09c786287f817443017 (patch)
treefc4c286ee72bbc3a73477635cb4403c6d6693bc7
parent134d48232a74473ed2d03920e44e400858e44bb1 (diff)
downloadvyatta-cfg-6dc71d03ef92e7a0e66ed09c786287f817443017.tar.gz
vyatta-cfg-6dc71d03ef92e7a0e66ed09c786287f817443017.zip
Cleanup exports of Vyatta::Misc
Remove duplicates from list, and make sure getIP is exported, and that explicit imports are listed.
-rwxr-xr-xlib/Vyatta/Misc.pm10
-rwxr-xr-xscripts/vyatta-interfaces.pl18
2 files changed, 17 insertions, 11 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm
index 2bad31d..e5d0738 100755
--- a/lib/Vyatta/Misc.pm
+++ b/lib/Vyatta/Misc.pm
@@ -24,10 +24,12 @@ use strict;
require Exporter;
our @ISA = qw(Exporter);
-our @EXPORT =
- qw(get_sysfs_value getInterfaces getNetAddIP isIpAddress is_ip_v4_or_v6 is_dhcp_enabled is_address_enabled);
-our @EXPORT_OK = qw(get_sysfs_value getNetAddIP isIpAddress is_ip_v4_or_v6
- getInterfacesIPadresses getPortRuleString);
+our @EXPORT = qw(getInterfaces getIP getNetAddIP get_sysfs_value
+ is_address_enabled is_dhcp_enabled
+ isIpAddress is_ip_v4_or_v6);
+our @EXPORT_OK = qw(generate_dhclient_intf_files
+ getInterfacesIPadresses
+ getPortRuleString);
use Vyatta::Config;
use Vyatta::Interface;
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 9edf8f2..d1a0e55 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -32,7 +32,9 @@
use lib "/opt/vyatta/share/perl5/";
use Vyatta::Config;
-use Vyatta::Misc;
+use Vyatta::Misc qw(generate_dhclient_intf_files
+ getInterfaces getIP get_sysfs_value
+ is_address_enabled is_dhcp_enabled is_ip_v4_or_v6);
use Vyatta::Interface;
use Getopt::Long;
@@ -200,7 +202,8 @@ sub is_intf_disabled {
sub run_dhclient {
my $intf = shift;
- my ($intf_config_file, $intf_process_id_file, $intf_leases_file) = Vyatta::Misc::generate_dhclient_intf_files($intf);
+ my ($intf_config_file, $intf_process_id_file, $intf_leases_file)
+ = 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 &";
@@ -213,7 +216,8 @@ 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) = Vyatta::Misc::generate_dhclient_intf_files($intf);
+ my ($intf_config_file, $intf_process_id_file, $intf_leases_file)
+ = 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";
@@ -326,7 +330,7 @@ sub is_valid_addr {
print "Error: can't use dhcp client on loopback interface\n";
exit 1;
}
- if (Vyatta::Misc::is_dhcp_enabled($intf)) {
+ if (is_dhcp_enabled($intf)) {
print "Error: dhcp already configured for $intf\n";
exit 1;
}
@@ -372,7 +376,7 @@ sub is_valid_addr {
}
}
- if (Vyatta::Misc::is_dhcp_enabled($intf)) {
+ if (is_dhcp_enabled($intf)) {
print "Error: remove dhcp before adding static addresses for $intf\n";
exit 1;
}
@@ -398,12 +402,12 @@ sub is_valid_addr {
sub op_dhcp_command {
my ($op_command, $intf) = @_;
- if (!Vyatta::Misc::is_dhcp_enabled($intf)) {
+ if (!is_dhcp_enabled($intf)) {
print "$intf is not using DHCP to get an IP address\n";
exit 1;
}
- my $flags = Vyatta::Misc::get_sysfs_value($intf, 'flags');
+ my $flags = get_sysfs_value($intf, 'flags');
my $hex_flags = hex($flags);
if (!($hex_flags & 0x1)) {
print "$intf is disabled. Unable to release/renew lease\n";