src/libpcp/src/access.c pmGetHostAccess presumes that DNS-resolving the
machine's hostname(1) is an appropriate substitute for the string
'localhost' in a pmcd.conf [access] clause. This is wrong for several
reasons:
- there is no requirement that a machine's hostname even be present
in DNS or /etc/hosts, so machines that get machine-generated
random hostnames will all fail to start usable pmcds
- there is no requirement that all a machine's local network addresses
be resolved via DNS, even if we hope just one is, so a multihomed
machine may randomly get some but not others
To make the situation worse, if this hostname-dns-resolution fails,
pmGetHostAccess doesn't even try taking 'localhost' literally, and
resolve that (to 127.0.0.1 or whatever the OS would supply).
A more correct solution would:
- take 'localhost' literally
- not use 'hostname' at all in a vain quest to identify local network
interface addresses. Instead, use proper OS-specific query functions
such as getifaddrs() or ioctl(SIOCGIFCONF). Optionally trigger this
heuristic for another magic pseudo-hostname like LOCALHOST.