From 18a4802b53f2e9d0a44e117c052bf9c4aafbb940 Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Wed, 6 Aug 2008 08:11:56 +0000 Subject: * Add perl function to return all ethernet MAC addresses. --- SiteSummary.pm | 21 +++++++++++++++++++++ debian/changelog | 1 + 2 files changed, 22 insertions(+) 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 @@ -101,6 +102,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() { + 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 # 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 Mon, 28 Jul 2008 18:23:41 +0200 -- cgit v1.2.3