1 |
diff -Nur e-smith-lib-2.4.0/root/usr/share/perl5/vendor_perl/esmith/ethernet.pm e-smith-lib-2.4.0-fix_bonding/root/usr/share/perl5/vendor_perl/esmith/ethernet.pm |
2 |
--- e-smith-lib-2.4.0/root/usr/share/perl5/vendor_perl/esmith/ethernet.pm 2013-02-23 18:47:46.441079217 +0100 |
3 |
+++ e-smith-lib-2.4.0-fix_bonding/root/usr/share/perl5/vendor_perl/esmith/ethernet.pm 2013-02-23 18:48:57.386558526 +0100 |
4 |
@@ -66,8 +66,21 @@ |
5 |
# Now we should be left only wth ethernet adapters |
6 |
open HW, "/sys/class/net/$nic/address"; |
7 |
my $mac = join("", <HW>); |
8 |
- chomp($mac); |
9 |
close HW; |
10 |
+ # If the device is a slave of a bridge, it's real MAC |
11 |
+ # address can be found in /proc/net/bonding/bondX |
12 |
+ if (-l "/sys/class/net/$nic/master"){ |
13 |
+ my $bond = basename (readlink "/sys/class/net/$nic/master"); |
14 |
+ local $/ = ''; |
15 |
+ open SLAVES, "/proc/net/bonding/$bond"; |
16 |
+ my @slaves = <SLAVES>; |
17 |
+ close SLAVES; |
18 |
+ my @slaveInfo = grep { /^Slave\ Interface:\ $nic/m } @slaves; |
19 |
+ foreach (split /\n+/, (join "", @slaveInfo)){ |
20 |
+ $mac = $1 if (/^Permanent\ HW\ addr:\ (.*)$/); |
21 |
+ } |
22 |
+ } |
23 |
+ chomp($mac); |
24 |
my $driver = basename (readlink "/sys/class/net/$nic/device/driver"); |
25 |
my $bus = basename (readlink "/sys/class/net/$nic/device/subsystem"); |
26 |
my $desc = $nic; |