diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2009-11-01 09:55:20 -0800 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-11-01 09:55:20 -0800 |
commit | 07219b06b85cf401a661075f289df5d01421b5c7 (patch) | |
tree | d9df7df522d3ff461fc63858cca21617567ba8b5 /lib/Vyatta | |
parent | db1b44563e05c1eb1f5d8bd475c3ed1250307aeb (diff) | |
download | vyatta-cfg-07219b06b85cf401a661075f289df5d01421b5c7.tar.gz vyatta-cfg-07219b06b85cf401a661075f289df5d01421b5c7.zip |
Add method to retrieve carrier value.
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 97ef7f7..8107eff 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -222,6 +222,17 @@ sub flags { return hex($val); } +sub carrier { + my $self = shift; + open my $carrier, '<', "/sys/class/net/$self->{name}/carrier" + or return; + + my $val = <$carrier>; + chomp $val; + close $carrier; + return $carrier; +} + sub hw_address { my $self = shift; |