|
Lines 319-327
Link Here
|
| 319 |
# |
319 |
# |
| 320 |
# Adds the given address to the interface |
320 |
# Adds the given address to the interface |
| 321 |
ifconfig_add_address() { |
321 |
ifconfig_add_address() { |
| 322 |
local iface="$1" i=0 r e |
322 |
local iface="$1" i=0 r e real_iface=$(interface_device "$1") |
| 323 |
|
323 |
|
| 324 |
ifconfig_exists "${iface}" true || return 1 |
324 |
ifconfig_exists "${real_iface}" true || return 1 |
| 325 |
|
325 |
|
| 326 |
# Extract the config |
326 |
# Extract the config |
| 327 |
local -a config=( "$@" ) |
327 |
local -a config=( "$@" ) |
|
Lines 357-374
Link Here
|
| 357 |
fi |
357 |
fi |
| 358 |
|
358 |
|
| 359 |
# Ensure that the interface is up so we can add IPv6 addresses |
359 |
# Ensure that the interface is up so we can add IPv6 addresses |
| 360 |
interface_up "${iface}" |
360 |
interface_up "${real_iface}" |
| 361 |
|
361 |
|
| 362 |
# Some kernels like to apply lo with an address when they are brought up |
362 |
# Some kernels like to apply lo with an address when they are brought up |
| 363 |
if [[ ${iface} == "lo" && ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then |
363 |
if [[ ${iface} == "lo" && ${config[@]} == "127.0.0.1 netmask 255.0.0.0 broadcast 127.255.255.255" ]]; then |
| 364 |
ifconfig "${iface}" 0.0.0.0 |
364 |
ifconfig "${iface}" 0.0.0.0 |
| 365 |
fi |
365 |
fi |
| 366 |
|
366 |
|
| 367 |
ifconfig "${iface}" ${config[@]} |
367 |
ifconfig "${iface}" ${config[@]} |
| 368 |
r="$?" |
368 |
r="$?" |
| 369 |
[[ ${r} != "0" ]] && return ${r} |
369 |
[[ ${r} != "0" ]] && return ${r} |
| 370 |
|
370 |
|
| 371 |
local metric ifvar=$( bash_variable "${iface}" ) |
371 |
local metric ifvar=$(bash_variable "${real_iface}") |
| 372 |
# Remove the newly added route and replace with our metric |
372 |
# Remove the newly added route and replace with our metric |
| 373 |
eval metric=\"\$\{metric_${ifvar}\}\" |
373 |
eval metric=\"\$\{metric_${ifvar}\}\" |
| 374 |
[[ ${metric} == "0" || ${RC_AUTO_INTERFACE} != "yes" ]] && return ${r} |
374 |
[[ ${metric} == "0" || ${RC_AUTO_INTERFACE} != "yes" ]] && return ${r} |