diff options
Diffstat (limited to 'lib/Vyatta/Interface.pm')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 97ef7f7..513f686 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -222,6 +222,18 @@ sub flags { return hex($val); } +sub carrier { + my $self = shift; + open my $carrier, '<', "/sys/class/net/$self->{name}/carrier" + or return; + + my $val = <$carrier>; + $val = 0 if ! defined $val; # proc entry not readable on down interface + chomp $val; + close $carrier; + return $val; +} + sub hw_address { my $self = shift; |