|
Lines 325-331
Link Here
|
| 325 |
local iface="$1" i=0 r e |
325 |
local iface="$1" i=0 r e |
| 326 |
|
326 |
|
| 327 |
ifconfig_exists "${iface}" true || return 1 |
327 |
ifconfig_exists "${iface}" true || return 1 |
| 328 |
ifconfig_up "${iface}" |
|
|
| 329 |
|
328 |
|
| 330 |
# Extract the config |
329 |
# Extract the config |
| 331 |
local -a config=( "$@" ) |
330 |
local -a config=( "$@" ) |
|
Lines 360-378
Link Here
|
| 360 |
config=( "${config[@]//peer/pointtopoint}" ) |
359 |
config=( "${config[@]//peer/pointtopoint}" ) |
| 361 |
fi |
360 |
fi |
| 362 |
|
361 |
|
|
|
362 |
# Ensure that the interface is up so we can add IPv6 addresses |
| 363 |
interface_up "${iface}" |
| 364 |
|
| 363 |
# Some kernels like to apply lo with an address when they are brought up |
365 |
# Some kernels like to apply lo with an address when they are brought up |
| 364 |
if [[ ${iface} == "lo" \ |
366 |
if [[ ${iface} == "lo" && ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then |
| 365 |
|| ${config[@]} == "127.0.0.1/8 broadcast 127.255.255.255" ]]; then |
367 |
ifconfig "${iface}" 0.0.0.0 |
| 366 |
ifconfig "${iface}" ${config[@]} 2>/dev/null |
|
|
| 367 |
r="0" |
| 368 |
else |
| 369 |
e=$( ifconfig "${iface}" ${config[@]} 2>&1 ) |
| 370 |
r="$?" |
| 371 |
[[ ${r} != "0" ]] && echo "${e}" > /dev/stderr |
| 372 |
fi |
368 |
fi |
| 373 |
|
369 |
|
| 374 |
[[ ${r} != "0" || ${config[0]} == "inet6"* || ${iface} == *:* ]] \ |
370 |
ifconfig "${iface}" ${config[@]} |
| 375 |
&& return ${r} |
371 |
r="$?" |
|
|
372 |
[[ ${r} != "0" ]] && return ${r} |
| 376 |
|
373 |
|
| 377 |
local metric ifvar=$( bash_variable "${iface}" ) |
374 |
local metric ifvar=$( bash_variable "${iface}" ) |
| 378 |
# Remove the newly added route and replace with our metric |
375 |
# Remove the newly added route and replace with our metric |