summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-07-29 15:17:10 -0700
committerStig Thormodsrud <stig@vyatta.com>2009-07-30 11:43:17 -0700
commite33736282961ba3e277fa03d6cf843556b7c8b33 (patch)
treeb1dbd79b22c7c17e61e87d9a0d876594f88a9a3e /lib
parent0fe88f4f5f81d8b02caf7cf73301ea21f8a15874 (diff)
downloadvyatta-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-xlib/Vyatta/Interface.pm12
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;