Fix bug in determination of public ips.

On some systems, the output of ifconfig contains:

    addr:127.0.0.1

rather than simply `127.0.0.1`. This patch detects when this is the case
and corrects for it if necessary.