diff options
author | William Hubbs <williamh@gentoo.org> | 2011-04-09 13:54:01 -0500 |
---|---|---|
committer | William Hubbs <williamh@gentoo.org> | 2011-04-09 13:54:01 -0500 |
commit | 15660dbbfcbf8eace589a3284130036b481c1cdf (patch) | |
tree | 94b1fb8a80575af1a7a78ecb0a3c6a6298f7826d /init.d/net.lo.in | |
parent | 07db27d2201a1462e36bb34f37b9c1d4e8b048a3 (diff) |
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
Diffstat (limited to 'init.d/net.lo.in')
-rw-r--r-- | init.d/net.lo.in | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/init.d/net.lo.in b/init.d/net.lo.in index 822e3f58..8f4ea9ba 100644 --- a/init.d/net.lo.in +++ b/init.d/net.lo.in @@ -476,7 +476,7 @@ interface_down() 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 metric=0 @@ -563,6 +563,7 @@ start() else eval config=\$fallback_${config_index} if [ -n "${config}" ]; then + fallback=true eoutdent ewarn "Trying fallback configuration ${config}" eindent @@ -585,8 +586,13 @@ start() return 1 fi - local hidefirstroute=false first=true - local routes="$(_get_array "routes_${IFVAR}")" + local hidefirstroute=false first=true routes= + 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 [ "${config_0}" != "null" ]; then routes="127.0.0.0/8 via 127.0.0.1 |