aboutsummaryrefslogtreecommitdiffstats
path: root/SiteSummary.pm
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 /SiteSummary.pm
parent220eae3e005c17b2a24a4717c145d8c67da14112 (diff)
downloadsitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.gz
sitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.bz2
sitesummary-18a4802b53f2e9d0a44e117c052bf9c4aafbb940.tar.xz
* Add perl function to return all ethernet MAC addresses.
Diffstat (limited to 'SiteSummary.pm')
-rw-r--r--SiteSummary.pm21
1 files changed, 21 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 {