aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SiteSummary.pm10
-rw-r--r--debian/changelog2
2 files changed, 7 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;
}
diff --git a/debian/changelog b/debian/changelog
index 7a7716c..b46cb4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ sitesummary (0.0.45) UNRELEASED; urgency=low
* Add new statistics script hardware-models to list the different
hardware vendor and models.
* Report the hardware models in the default web page.
+ * Rewrite get_primary_macaddress() to return the same MAC address
+ independently from the interface ordering returned by ifconfig -a.
-- Petter Reinholdtsen <pere@debian.org> Fri, 25 Jul 2008 00:50:51 +0200