summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/vyatta-interfaces.pl14
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 8fce903..89b6e1e 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -439,21 +439,23 @@ sub is_valid_name {
sub show_interfaces {
my $type = shift;
my @interfaces = getInterfaces();
+ my @match;
foreach my $name (@interfaces) {
my $intf = new Vyatta::Interface($name);
- next unless $intf;
+ next unless $intf; # skip unknown types
next unless ($type eq 'all' || $type eq $intf->type());
if ($vif_name) {
- next unless ($vif_name eq $intf->physicalDevice() && $intf->vif());
+ next unless $intf->vif();
+ push @match, $intf->vif()
+ if ($vif_name eq $intf->physicalDevice());
} else {
- next if $intf->vif();
+ push @match, $name
+ unless $intf->vif();
}
- print $name, ' ';
}
- print "\n";
- exit 0;
+ print join(' ', @match), "\n";
}
exit 0;