summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta')
-rw-r--r--lib/Vyatta/Interface.pm16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm
index ea9c40f..017b7e4 100644
--- a/lib/Vyatta/Interface.pm
+++ b/lib/Vyatta/Interface.pm
@@ -77,6 +77,9 @@ sub new {
my $class = ref($that) || $that;
my ($dev, $vif);
+ # need argument to constructor
+ return unless $name;
+
# Strip off vif from name
if ( $name =~ m/(\w)+\.(\d)+/ ) {
$dev = $1;
@@ -87,20 +90,21 @@ sub new {
foreach my $prefix (keys %net_prefix) {
next unless $dev =~ /$prefix/;
- my $path = $net_prefix{$prefix}{path};
+ my $type = $net_prefix{$prefix}{path};
my $vifpath = $net_prefix{$prefix}{vif};
# Interface name has vif, but this type doesn't support vif!
return if ( $vif && !$vifpath );
# Check path if given
- return if ( $#_ >= 0 && join( ' ', @_ ) ne $path );
+ return if ( $#_ >= 0 && join( ' ', @_ ) ne $type );
- $path = "interfaces $path $dev";
+ my $path = "interfaces $type $dev";
$path .= " $vifpath $vif" if $vif;
my $self = {
name => $name,
+ type => $type,
path => $path,
dev => $dev,
vif => $vif,
@@ -108,7 +112,6 @@ sub new {
bless $self, $class;
return $self;
-
}
return; # nothing
@@ -135,6 +138,11 @@ sub physicalDevice {
return $self->{dev};
}
+sub type {
+ my $self = shift;
+ return $self->{type};
+}
+
## Configuration checks
sub configured {