From db6569f10c066dcb5553f456725f1e61ada07969 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 17 Sep 2012 17:34:01 -0700 Subject: Fix handling of unknown interface types Bug 8361 Instead of hard coding skip list, just use Vyatta::Interface as defined. --- scripts/vyatta-show-interfaces.pl | 21 +++++++++++---------- 1 file 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 ); -- cgit v1.2.3