summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2009-11-01 09:55:20 -0800
committerStig Thormodsrud <stig@vyatta.com>2009-11-01 09:55:20 -0800
commit07219b06b85cf401a661075f289df5d01421b5c7 (patch)
treed9df7df522d3ff461fc63858cca21617567ba8b5 /lib
parentdb1b44563e05c1eb1f5d8bd475c3ed1250307aeb (diff)
downloadvyatta-cfg-07219b06b85cf401a661075f289df5d01421b5c7.tar.gz
vyatta-cfg-07219b06b85cf401a661075f289df5d01421b5c7.zip
Add method to retrieve carrier value.
Diffstat (limited to 'lib')
-rwxr-xr-xlib/Vyatta/Interface.pm11
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;