diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2012-09-17 17:34:01 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2012-09-17 17:34:01 -0700 |
commit | db6569f10c066dcb5553f456725f1e61ada07969 (patch) | |
tree | 2609852f61d5d18c21deef2d64b4c7df0853dbb8 | |
parent | 9e40a5ac1ddd80bf7444f373decf431e7b5d0f58 (diff) | |
download | vyatta-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-x | scripts/vyatta-show-interfaces.pl | 21 |
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 ); |