diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-07-29 15:17:10 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2009-07-30 11:43:17 -0700 |
commit | e33736282961ba3e277fa03d6cf843556b7c8b33 (patch) | |
tree | b1dbd79b22c7c17e61e87d9a0d876594f88a9a3e /lib | |
parent | 0fe88f4f5f81d8b02caf7cf73301ea21f8a15874 (diff) | |
download | vyatta-cfg-e33736282961ba3e277fa03d6cf843556b7c8b33.tar.gz vyatta-cfg-e33736282961ba3e277fa03d6cf843556b7c8b33.zip |
Add hw_address method for use in bonding
Bonding management needs easy way to find hardware address.
Related to Bug 4758
(cherry picked from commit a4404bfb3c4243967a4434707213430d5c4df58e)
Diffstat (limited to 'lib')
-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 96429c0..97ef7f7 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -222,6 +222,18 @@ sub flags { return hex($val); } +sub hw_address { + my $self = shift; + + open my $addrf, '<', "/sys/class/net/$self->{name}/address" + or return; + my $address = <$addrf>; + close $addrf; + + chomp $address if $address; + return $address; +} + sub is_broadcast { my $self = shift; return $self->flags() & IFF_BROADCAST; |