|
|
else | else |
# IPv4 is tricky - ifconfig requires an aliased device | # IPv4 is tricky - ifconfig requires an aliased device |
# for multiple addresses | # for multiple addresses |
|
is_loopback "${iface}" || |
if ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then | if ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then |
# Get the last alias made for the interface and add 1 to it | # Get the last alias made for the interface and add 1 to it |
i=$(ifconfig | tac | grep -m 1 -o "^${iface}:[0-9]*" \ | i=$(ifconfig | tac | grep -m 1 -o "^${iface}:[0-9]*" \ |
|
|
config=( "${config[@]//peer/pointopoint}" ) | config=( "${config[@]//peer/pointopoint}" ) |
fi | fi |
| |
# Some kernels like to apply lo with an address when they are brought up |
|
if [[ ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then |
|
if is_loopback "${real_iface}" ; then |
|
ifconfig "${real_iface}" ${config[@]} |
|
return 0 |
|
fi |
|
fi |
|
|
|
ifconfig "${iface}" ${config[@]} | ifconfig "${iface}" ${config[@]} |
} | } |
| |