aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2008-08-06 08:11:56 +0000
committerPetter Reinholdtsen <pere@hungry.com>2008-08-06 08:11:56 +0000
commit18a4802b53f2e9d0a44e117c052bf9c4aafbb940 (patch)
tree2ea70cdc8a1a9a77b1b5fde4d227e98dc17c4445
parent220eae3e005c17b2a24a4717c145d8c67da14112 (diff)
downloadsitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.gz
sitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.bz2
sitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.xz
* Add perl function to return all ethernet MAC addresses.
-rw-r--r--SiteSummary.pm21
-rw-r--r--debian/changelog1
2 files changed, 22 insertions, 0 deletions
diff --git a/SiteSummary.pm b/SiteSummary.pm
index 944d964..054f78d 100644
--- a/SiteSummary.pm
+++ b/SiteSummary.pm
@@ -15,6 +15,7 @@ our @EXPORT = qw(
get_sitegroup
get_hostname
get_dns_address
+ get_macaddress
get_primary_macaddress
get_primary_ip_address
get_linux_kernel_ver
@@ -102,6 +103,26 @@ sub get_primary_ip_address {
}
#
+# Return all MAC addresses
+sub get_macaddress {
+ my $hostid = shift;
+ my $path = get_filepath_current($hostid, "/system/ifconfig-a");
+ if (open (FILE, $path)) {
+ my @macs;
+ while(<FILE>) {
+ chomp;
+ if (m/Link encap:Ethernet\s+HWaddr (\S+)\s+/) {
+ push(@macs, $1);
+ }
+ }
+ close(FILE);
+ return @macs;
+ } else {
+ return undef;
+ }
+}
+
+#
# Return the IP address on the primary network interface
#
sub get_primary_macaddress {
diff --git a/debian/changelog b/debian/changelog
index aa53ea8..5164bee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ sitesummary (0.0.47) UNRELEASED; urgency=low
'update' argument when calling hook scripts on updates.
* Make sure to export the get_primary_ip_address function in the
SiteSummary perl module.
+ * Add perl function to return all ethernet MAC addresses.
* Add Swedish translation from Martin Ă…gren (Closes: #492067).
-- Petter Reinholdtsen <pere@debian.org> Mon, 28 Jul 2008 18:23:41 +0200