summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2012-04-09 21:19:14 -0700
committerStephen Hemminger <shemminger@vyatta.com>2012-04-09 21:19:14 -0700
commitf7f9f099818f0d5fd30152625b1b941dcad22c8b (patch)
tree82cc5450a696c07f45aa59813487d9e413a3af36
parent5ff3e2dd8c630a62cb9d6e6835931429dbe9c038 (diff)
downloadvyatta-op-f7f9f099818f0d5fd30152625b1b941dcad22c8b.tar.gz
vyatta-op-f7f9f099818f0d5fd30152625b1b941dcad22c8b.zip
Use Interface.pm to find interface state
Bug 8006 Use standard module to check for interface state.
-rwxr-xr-xscripts/vyatta-show-interfaces.pl12
1 files changed, 4 insertions, 8 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl
index 5a56050..36428cb 100755
--- a/scripts/vyatta-show-interfaces.pl
+++ b/scripts/vyatta-show-interfaces.pl
@@ -119,18 +119,14 @@ sub get_ipaddr {
}
sub get_state_link {
- my $intf = shift;
+ my $name = shift;
+ my $intf = new Vyatta::Interface($name);
my $state;
my $link = 'down';
- my $flags = get_sysfs_value($intf, 'flags');
- my $hex_flags = hex($flags);
- if ($hex_flags & 0x1) { # IFF_UP
+ if ($intf->up()) {
$state = 'up';
- my $carrier = get_sysfs_value($intf, 'carrier');
- if ($carrier eq '1') {
- $link = "up";
- }
+ $link = "up" if ($intf->running());
} else {
$state = "admin down";
}