diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2008-06-09 19:01:28 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2008-06-09 19:01:28 -0700 |
commit | fc24acbd57df4f967e7cec5fd98c3292f06105d5 (patch) | |
tree | 642a4352f4cf69e9bdad41865aa0992deebbe046 | |
parent | 0a45e74a8fadd4f434752bb70b0da936c68359f5 (diff) | |
parent | 1469f24f7b452f3412f83a5ac54a18b2caf63348 (diff) | |
download | vyatta-op-fc24acbd57df4f967e7cec5fd98c3292f06105d5.tar.gz vyatta-op-fc24acbd57df4f967e7cec5fd98c3292f06105d5.zip |
Merge branch 'hollywood' of http://git.vyatta.com/vyatta-op into hollywood
-rw-r--r-- | scripts/vyatta-show-interfaces.pl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/vyatta-show-interfaces.pl b/scripts/vyatta-show-interfaces.pl index 9046c17..e50c097 100644 --- a/scripts/vyatta-show-interfaces.pl +++ b/scripts/vyatta-show-interfaces.pl @@ -184,23 +184,23 @@ sub get_ipaddr { sub get_state_link { my $intf = shift; - - my $IFF_UP = 0x1; - my ($state, $link); + my $state; + my $link = 'down'; my $flags = get_sysfs_value($intf, 'flags'); - my $carrier = get_sysfs_value($intf, 'carrier'); - chomp $flags; chomp $carrier; + chomp $flags; + my $hex_flags = hex($flags); - if ($hex_flags & $IFF_UP) { - $state = "up"; + if ($hex_flags & 0x1) { # IFF_UP + $state = 'up'; + my $carrier = get_sysfs_value($intf, 'carrier'); + chomp $carrier; + if ($carrier eq '1') { + $link = "up"; + } } else { $state = "admin down"; } - if ($carrier eq "1") { - $link = "up"; - } else { - $link = "down"; - } + return ($state, $link); } |