public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
Date: Sat,  9 Apr 2011 19:56:53 +0000 (UTC)	[thread overview]
Message-ID: <15660dbbfcbf8eace589a3284130036b481c1cdf.williamH@gentoo> (raw)

commit:     15660dbbfcbf8eace589a3284130036b481c1cdf
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Apr  9 18:54:01 2011 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Apr  9 18:54:01 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=15660dbb

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

---
 doc/net.example.BSD.in   |    4 +++-
 doc/net.example.Linux.in |    4 +++-
 init.d/net.lo.in         |   12 +++++++++---
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/doc/net.example.BSD.in b/doc/net.example.BSD.in
index 287c644..2329fa2 100644
--- a/doc/net.example.BSD.in
+++ b/doc/net.example.BSD.in
@@ -67,10 +67,12 @@
 # If a specified module fails (like dhcp - see below), you can specify a
 # fallback like so
 #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
 # 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
 #mtu_eth0="1500"

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 424c677..709e201 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -94,10 +94,12 @@
 # If a specified module fails (like dhcp - see below), you can specify a
 # fallback like so
 #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
 # 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
 #mtu_eth0="1500"

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 822e3f5..8f4ea9b 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



             reply	other threads:[~2011-04-09 19:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-09 19:56 William Hubbs [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-04-10 21:20 [gentoo-commits] proj/openrc:master commit in: init.d/, doc/ William Hubbs
2011-04-16  0:32 William Hubbs
2011-12-27  0:30 Robin H. Johnson
2012-01-13 23:57 Robin H. Johnson
2013-02-11 15:10 William Hubbs

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15660dbbfcbf8eace589a3284130036b481c1cdf.williamH@gentoo \
    --to=williamh@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox