#!/bin/bash
#
# This script makes sure that 127.0.0.x is routable. On Darwin, there
# is a bug that it isn't routable and this causes errors.
#

# Fail if any commands fail (unchecked), namely sudo and ifconfig.
set -e

# Check if loopback is setup
if ping -c 1 -W 10 127.0.0.2 > /dev/null 2>&1
then
    exit
fi

# Setup loopback
echo "Using sudo to setup lo0 interface aliases for testing."
sudo -v
for ((i=2;i<256;i++))
do
    sudo -n ifconfig lo0 alias 127.0.0.$i up
done

#!/bin/bash
#
# This script makes sure that 127.0.0.x is routable. On Darwin, there
# is a bug that it isn't routable and this causes errors.
#

# Fail if any commands fail (unchecked), namely sudo and ifconfig.
set -e

# If we're not on OS X, then just bail out since lo should be routable
case $OSTYPE in
    darwin*)
        ;;
    *)
        exit 0
        ;;
esac

# Check if loopback is setup
if ping -c 1 -W 10 127.0.0.2 > /dev/null 2>&1
then
    exit
fi

# Setup loopback
echo "Using sudo to setup lo0 interface aliases for testing."
sudo -v
for ((i=2;i<256;i++))
do
    sudo -n ifconfig lo0 alias 127.0.0.$i up
done

Revert "Removes the Mac check for the subnet setup."
Revert "Removes the Mac check for the subnet setup."

This reverts commit bb67cec1657304d7f44ff07b2c826e3d1a2896cf.
