summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2012-09-17 17:34:01 -0700
committerStephen Hemminger <shemminger@vyatta.com>2012-09-17 17:34:01 -0700
commitdb6569f10c066dcb5553f456725f1e61ada07969 (patch)
tree2609852f61d5d18c21deef2d64b4c7df0853dbb8
parent9e40a5ac1ddd80bf7444f373decf431e7b5d0f58 (diff)
downloadvyatta-op-db6569f10c066dcb5553f456725f1e61ada07969.tar.gz
vyatta-op-db6569f10c066dcb5553f456725f1e61ada07969.zip
Fix handling of unknown interface types
Bug 8361 Instead of hard coding skip list, just use Vyatta::Interface as defined.
-rwxr-xr-xscripts/vyatta-show-interfaces.pl21
1 files changed, 11 insertions, 10 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index ae1ab3c..71930db 100755
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -295,17 +295,18 @@ sub run_show_intf_brief {
printf($format, "Interface","IP Address","S/L","Description");
printf($format, "---------","----------","---","-----------");
foreach my $intf (@intfs) {
- next if ($intf =~ /gre0/);
- next if ($intf =~ /sit0/);
- next if ($intf =~ /tunl0/);
- next if ($intf =~ /ip6tnl0/);
- next if ($intf =~ /ip_vti0/);
+ my $interface = new Vyatta::Interface($intf);
+ # ignore tunnels, unknown interface types, etc.
+ next unless $interface;
+
+ my $state = $interface->up() ? 'u' : 'A';
+ my $link = $interface->running() ? 'u' : 'D';
+
+ my $description = $interface->description();
+ my @descriptions = conv_descriptions($description)
+ if defined($description);
+
my @ip_addr = get_ipaddr($intf);
- my ($state, $link) = get_state_link($intf);
- $state = conv_brief_code($state);
- $link = conv_brief_code($link);
- my $description = get_intf_description($intf);
- my @descriptions = conv_descriptions($description);
if (scalar(@ip_addr) == 0) {
my $desc = '';
$desc = shift @descriptions if (scalar(@descriptions) > 0 );