add fallback_routes support to network scripts
Add support for optional fallback_routes_* variables in the network scripts. This is similar to the fallback_route_* support in baselayout-1. However, if you do not have fallback_routes set for an interface but you do have routes set, that setting will be used, so you do not need this variable unless you want the fallback routes to be different from the primary routes. X-Gentoo-Bug: 250978 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=250978
This commit is contained in:
parent
07db27d220
commit
15660dbbfc
@ -67,10 +67,12 @@
|
|||||||
# If a specified module fails (like dhcp - see below), you can specify a
|
# If a specified module fails (like dhcp - see below), you can specify a
|
||||||
# fallback like so
|
# fallback like so
|
||||||
#fallback_eth0="192.168.0.2 netmask 255.255.255.0"
|
#fallback_eth0="192.168.0.2 netmask 255.255.255.0"
|
||||||
#fallback_route_eth0="default via 192.168.0.1"
|
#fallback_routes_eth0="default via 192.168.0.1"
|
||||||
|
|
||||||
# NOTE: fallback entry must match the entry location in config_eth0
|
# NOTE: fallback entry must match the entry location in config_eth0
|
||||||
# As such you can only have one fallback route.
|
# As such you can only have one fallback route.
|
||||||
|
# Also, if you do not set a fallback_routes entry for an interface, the
|
||||||
|
# routes entry will be used if that is set.
|
||||||
|
|
||||||
# Some users may need to alter the MTU - here's how
|
# Some users may need to alter the MTU - here's how
|
||||||
#mtu_eth0="1500"
|
#mtu_eth0="1500"
|
||||||
|
@ -94,10 +94,12 @@
|
|||||||
# If a specified module fails (like dhcp - see below), you can specify a
|
# If a specified module fails (like dhcp - see below), you can specify a
|
||||||
# fallback like so
|
# fallback like so
|
||||||
#fallback_eth0="192.168.0.2/24"
|
#fallback_eth0="192.168.0.2/24"
|
||||||
#fallback_route_eth0="default via 192.168.0.1"
|
#fallback_routes_eth0="default via 192.168.0.1"
|
||||||
|
|
||||||
# NOTE: fallback entry must match the entry location in config_eth0
|
# NOTE: fallback entry must match the entry location in config_eth0
|
||||||
# As such you can only have one fallback route.
|
# As such you can only have one fallback route.
|
||||||
|
# Also, if you do not set a fallback_routes entry for an interface, the
|
||||||
|
# routes entry will be used if that is set.
|
||||||
|
|
||||||
# Some users may need to alter the MTU - here's how
|
# Some users may need to alter the MTU - here's how
|
||||||
#mtu_eth0="1500"
|
#mtu_eth0="1500"
|
||||||
|
@ -476,7 +476,7 @@ interface_down()
|
|||||||
|
|
||||||
start()
|
start()
|
||||||
{
|
{
|
||||||
local IFACE=${RC_SVCNAME#*.} oneworked=false module=
|
local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
|
||||||
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
|
local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
|
||||||
local metric=0
|
local metric=0
|
||||||
|
|
||||||
@ -563,6 +563,7 @@ start()
|
|||||||
else
|
else
|
||||||
eval config=\$fallback_${config_index}
|
eval config=\$fallback_${config_index}
|
||||||
if [ -n "${config}" ]; then
|
if [ -n "${config}" ]; then
|
||||||
|
fallback=true
|
||||||
eoutdent
|
eoutdent
|
||||||
ewarn "Trying fallback configuration ${config}"
|
ewarn "Trying fallback configuration ${config}"
|
||||||
eindent
|
eindent
|
||||||
@ -585,8 +586,13 @@ start()
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local hidefirstroute=false first=true
|
local hidefirstroute=false first=true routes=
|
||||||
local routes="$(_get_array "routes_${IFVAR}")"
|
if ${fallback}; then
|
||||||
|
routes="$(_get_array "fallback_routes_${IFVAR}")"
|
||||||
|
fi
|
||||||
|
if [ -z "${routes}" ]; then
|
||||||
|
routes="$(_get_array "routes_${IFVAR}")"
|
||||||
|
fi
|
||||||
if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
|
if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
|
||||||
if [ "${config_0}" != "null" ]; then
|
if [ "${config_0}" != "null" ]; then
|
||||||
routes="127.0.0.0/8 via 127.0.0.1
|
routes="127.0.0.0/8 via 127.0.0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user