cfengine/core — pull request #460 by lpefferkorn (2013-03-24 20:13:42+00:00)
Title: Adding getifaddrs() fallback to collect MAC addresses on BSD systems

Hello,

I have found that MAC addresses were not detected on FreeBSD, only "mac_unknown" class is reported by cf-promises:

# cf-promises -v | hcgrep mac_
mac_unknown

Similar behavior happens on OpenBSD and NetBSD.

It's because these systems lack the SIOCGIFHWADDR ioctl, used by GetMacAddress().

Hopefully, getifaddrs() can help (and is available on Linux too), so I wrote support for a getifaddrs() fallback, in case of missing SIOCGIFHWADDR ioctl.

My tests were done on FreeBSD-8.2/9.0, checks for OpenBSD-5.2 and NetBSD-6.0.1 are in progress, but before I would like to have your opinion on this fallback.