aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
diff options
context:
space:
mode:
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm10
1 files changed, 5 insertions, 5 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index 033956b..591463c 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -106,18 +106,18 @@ sub get_primary_ip_address {
sub get_primary_macaddress {
my $hostid = shift;
my $path = get_filepath_current($hostid, "/system/ifconfig-a");
- # XXX Not properly implemented, just pick the first interface
- my $macaddress;
+ # XXX Not properly implemented, just pick the first MAC after
+ # sorting alphabetically.
if (open (FILE, $path)) {
+ my @macs;
while(<FILE>) {
chomp;
if (m/Link encap:Ethernet\s+HWaddr (\S+)\s+/) {
- $macaddress = $1;
- last;
+ push(@macs, $1);
}
}
close(FILE);
- return $macaddress;
+ return (sort @macs)[0];
} else {
return undef;
}