summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-07-29 15:17:10 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-07-29 15:17:10 -0700
commita4404bfb3c4243967a4434707213430d5c4df58e (patch)
tree7327acee57447c9b5da46091d5f7835edc6d406b
parent5775389cb2fb7982cff07e956511a65b8c40ab8b (diff)
downloadvyatta-cfg-a4404bfb3c4243967a4434707213430d5c4df58e.tar.gz
vyatta-cfg-a4404bfb3c4243967a4434707213430d5c4df58e.zip
Add hw_address method for use in bonding
Bonding management needs easy way to find hardware address. Related to Bug 4758
-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;