public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2011-04-09 19:56 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2011-04-09 19:56 UTC (permalink / raw
  To: gentoo-commits

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



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2011-04-10 21:20 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2011-04-10 21:20 UTC (permalink / raw
  To: gentoo-commits

commit:     8e925368b7a07df23bc168ce4f50dc826181411b
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 10 21:10:47 2011 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sun Apr 10 21:10:47 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=8e925368

bring up the loopback interface earlier

For most situations, the loopback interface can depend on root instead
of localmount, so this patch makes that happen. It also adds comments to
the net.example files explaining when a user might want to change this
and giving an example.

I would like to thank Robin Johnson for the original patch and suggested
examples.

X-Gentoo-Bug: 292894
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=292894

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

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

diff --git a/doc/net.example.BSD.in b/doc/net.example.BSD.in
index 2329fa2..eacfca6 100644
--- a/doc/net.example.BSD.in
+++ b/doc/net.example.BSD.in
@@ -359,6 +359,15 @@
 # manager like resolvconf-gentoo to manage this file for you. All packages
 # that baselayout supports use resolvconf-gentoo if installed.
 
+# If you run any services on net.lo which need localmount, either the
+# services or net.lo should explicitly bring in localmount.
+# If you do not do this, openrc will try to bring up net.lo as soon as
+# possible, which may be too early for your services.
+# If you use network file systems for your core system this may
+# interfere.
+# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
+#rc_net_lo0_need="localmount"
+
 #-----------------------------------------------------------------------------
 # Cable in/out detection
 # Sometimes the cable is in, others it's out. Obviously you don't want to

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 709e201..844a67a 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -962,6 +962,15 @@
 # manager like resolvconf-gentoo to manage this file for you. All packages
 # that baselayout supports use resolvconf-gentoo if installed.
 
+# If you run any services on net.lo which need localmount, either the
+# services or net.lo should explicitly bring in localmount.
+# If you do not do this, openrc will try to bring up net.lo as soon as
+# possible, which may be too early for your services.
+# If you use network file systems for your core system this may
+# interfere.
+# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
+#rc_net_lo_need="localmount"
+
 #-----------------------------------------------------------------------------
 # Cable in/out detection
 # Sometimes the cable is in, others it's out. Obviously you don't want to

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 8f4ea9b..1615b0c 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -18,14 +18,13 @@ depend()
 	local IFACE=${RC_SVCNAME#*.}
 	local IFVAR=$(shell_var "${IFACE}")
 
-	need localmount
 	after bootmisc
 	provide net
 	keyword -jail -prefix -vserver
 
 	case "${IFACE}" in
-		lo|lo0);;
-		*) after net.lo net.lo0;;
+		lo|lo0) need root ;;
+		*) after net.lo net.lo0 ; need localmount ;;
 	esac
 
 	if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2011-04-16  0:32 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2011-04-16  0:32 UTC (permalink / raw
  To: gentoo-commits

commit:     de0ded4ed05f1d52f92b22386fe7d5321ebf7e8e
Author:     William Hubbs <williamh <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 16 00:21:20 2011 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Sat Apr 16 00:21:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=de0ded4e

revert changes for bug #292894

This is being done because these dependency changes caused a regression.
We will need to revisit the previously mentioned bug.

X-Gentoo-Bug: 363693
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=363693

---
 doc/net.example.BSD.in   |    9 ---------
 doc/net.example.Linux.in |    9 ---------
 init.d/net.lo.in         |    6 ++++--
 3 files changed, 4 insertions(+), 20 deletions(-)

diff --git a/doc/net.example.BSD.in b/doc/net.example.BSD.in
index eacfca6..2329fa2 100644
--- a/doc/net.example.BSD.in
+++ b/doc/net.example.BSD.in
@@ -359,15 +359,6 @@
 # manager like resolvconf-gentoo to manage this file for you. All packages
 # that baselayout supports use resolvconf-gentoo if installed.
 
-# If you run any services on net.lo which need localmount, either the
-# services or net.lo should explicitly bring in localmount.
-# If you do not do this, openrc will try to bring up net.lo as soon as
-# possible, which may be too early for your services.
-# If you use network file systems for your core system this may
-# interfere.
-# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
-#rc_net_lo0_need="localmount"
-
 #-----------------------------------------------------------------------------
 # Cable in/out detection
 # Sometimes the cable is in, others it's out. Obviously you don't want to

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 844a67a..709e201 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -962,15 +962,6 @@
 # manager like resolvconf-gentoo to manage this file for you. All packages
 # that baselayout supports use resolvconf-gentoo if installed.
 
-# If you run any services on net.lo which need localmount, either the
-# services or net.lo should explicitly bring in localmount.
-# If you do not do this, openrc will try to bring up net.lo as soon as
-# possible, which may be too early for your services.
-# If you use network file systems for your core system this may
-# interfere.
-# Also, you may need this if 127.0.0.1 is in your /etc/resolv.conf.
-#rc_net_lo_need="localmount"
-
 #-----------------------------------------------------------------------------
 # Cable in/out detection
 # Sometimes the cable is in, others it's out. Obviously you don't want to

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 68c8895..8f4ea9b 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -18,12 +18,14 @@ depend()
 	local IFACE=${RC_SVCNAME#*.}
 	local IFVAR=$(shell_var "${IFACE}")
 
+	need localmount
+	after bootmisc
 	provide net
 	keyword -jail -prefix -vserver
 
 	case "${IFACE}" in
-		lo|lo0) before mtab ; need root ;;
-		*) after bootmisc net.lo net.lo0 ; need localmount ;;
+		lo|lo0);;
+		*) after net.lo net.lo0;;
 	esac
 
 	if [ "$(command -v "depend_${IFVAR}")" = "depend_${IFVAR}" ]; then



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2011-12-27  0:30 Robin H. Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson @ 2011-12-27  0:30 UTC (permalink / raw
  To: gentoo-commits

commit:     9a01f6851533c808ff0665a3749a20f710a3ee57
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 27 00:27:38 2011 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Tue Dec 27 00:27:38 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=9a01f685

net: Add up_before_preup variable for CAN devices

Historically, we have tried to up interfaces before running preup, so
that the kernel setups up the device and makes things like ethtool work
(some hardware cannot be correct probed until then). However this ends
up breaking other hardware, so a variable has been introduced to allow
the up prior to preup to be disabled: up_before_preup_IFVAR=no

X-Gentoo-Bug: 389475
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=389475
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 doc/net.example.Linux.in |   10 ++++++++++
 init.d/net.lo.in         |    6 ++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index 0ee83a6..d48983e 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -1102,6 +1102,16 @@
 #
 # ${IFACE} is set to the interface being brought up/down
 # ${IFVAR} is ${IFACE} converted to variable name bash allows
+#
+# For historical & compatbility reasons, preup is actually normally called in
+# the follow sequence: up ; preup ; up
+# In that case, the first up causes the kernel to initialize the device, so
+# that it is available for use in the preup function.  However, for some other
+# hardware, eg CAN devices, some configuration is needed before trying to up
+# the interface will actually work. For such harware, there are the
+# 'up_before_preup' variables, that skips the first up call.
+#up_before_preup_IFVAR=no
+#up_before_preup=no
 
 #preup() {
 #	# Test for link on the interface prior to bringing it up.  This

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index ae07b52..02d11a8 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -488,7 +488,9 @@ start()
 {
 	local IFACE=${RC_SVCNAME#*.} oneworked=false fallback=false module=
 	local IFVAR=$(shell_var "${IFACE}") cmd= our_metric=
-	local metric=0
+	local metric=0 _up_before_preup
+	eval _up_before_preup="\$up_before_preup_${IFVAR}"
+	[ -z "${_up_before_preup}" ] && _up_before_preup=$up_before_preup
 
 	einfo "Bringing up interface ${IFACE}"
 	eindent
@@ -502,7 +504,7 @@ start()
 	# available in preup and afterwards incase the user inadvertently
 	# brings it down
 	if [ "$(command -v preup)" = "preup" ]; then
-		_up 2>/dev/null
+		[ "${_up_before_preup}" = "no" ] ||  _up 2>/dev/null
 		ebegin "Running preup"
 		eindent
 		preup || return 1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2012-01-13 23:57 Robin H. Johnson
  0 siblings, 0 replies; 6+ messages in thread
From: Robin H. Johnson @ 2012-01-13 23:57 UTC (permalink / raw
  To: gentoo-commits

commit:     380752f4e0726ecd5267fc3d86b87923714c6d07
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Fri Jan 13 23:54:10 2012 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Fri Jan 13 23:57:22 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=380752f4

net: allow parameters to a single address config

In the case of a single line of configuration, where the address has
parameters, the parameters were being treated as seperate addresses.
Eg:
config_eth0="4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"

Also document usage of parameters in the net example, and note that
multiple addresses on a single line cannot be mixed with parameters.
Newlines are required to seperate the addresses.

X-Gentoo-Bug: 398827
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=398827

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 doc/net.example.Linux.in |    9 +++++++++
 init.d/net.lo.in         |   14 ++++++++------
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index fd14134..666b44f 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -68,6 +68,7 @@
 # NOTE: ifconfig creates an aliased device for each extra IPv4 address
 #       (eth0:1, eth0:2, etc)
 #       iproute2 does not do this as there is no need to
+# WARNING: You cannot mix multiple addresses on a line with other parameters!
 #config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
 # However, that only works with CIDR addresses, so you can't use netmask.
 
@@ -85,6 +86,14 @@
 # If you don't want ANY address (only useful when calling for advanced stuff)
 #config_eth0="null"
 
+# If you need to pass parameters to go with an address, you can do so on the
+# same line as the address. You should split multiple addresses with newlines.
+# WARNING: You cannot mix multiple addresses on a line with other parameters!
+#config_eth0="192.168.0.2/24 scope host"
+#config_eth0="4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
+#config_eth0="192.168.0.2/24 scope host
+#4321:0:1:2:3:4:567:89ab/64 nodad home preferred_lft 0"
+
 # Here's how to do routing if you need it
 # We add an IPv4 default route, IPv4 subnet route and an IPv6 unicast route
 #routes_eth0="default via 192.168.0.1

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index 2913561..9fdeaba 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -431,16 +431,18 @@ _load_config()
 	set -- ${config}
 
 	# We should support a space separated array for cidr configs
+	# But only as long as they do not contain other parameters for the address
 	if [ $# = 1 ]; then
 		unset IFS
 		set -- ${config}
 		# Of course, we may have a single address added old style.
-		case "$2" in
-			netmask|broadcast|brd|brd+|peer|pointopoint)
-				local IFS="$__IFS"
-				set -- ${config}
-				;;
-		esac
+		# If the NEXT argument is a v4 or v6 address, it's the next config.
+		# Otherwise, it's arguments to the first config...
+		if [ "${2#*.*}" = "${2}" -a "${2#*:*}" = "${2}" ]; then
+			# Not an IPv4/IPv6
+			local IFS="$__IFS"
+			set -- ${config}
+		fi
 	fi
 
 	# Ensure that loopback has the correct address



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [gentoo-commits] proj/openrc:master commit in: init.d/, doc/
@ 2013-02-11 15:10 William Hubbs
  0 siblings, 0 replies; 6+ messages in thread
From: William Hubbs @ 2013-02-11 15:10 UTC (permalink / raw
  To: gentoo-commits

commit:     1280b97749ec60b4cd3f77d1c68202f305ad79b4
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Feb 11 14:52:46 2013 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Feb 11 15:08:34 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1280b977

oldnet: add support for shutdown_network from newnet

This setting, already in use in newnet, allows the user to control
whether network interfaces are stopped when the system shuts down. By
default, under newnet, they are not, so I am making oldnet have the same
default.

A side-affect of this is that in the default configuration this fixes
bugs like the one below.

Reported-by: jerryfleming2006 <AT> gmail.com
X-Gentoo-Bug: 259183
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=259183

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

diff --git a/doc/net.example.BSD.in b/doc/net.example.BSD.in
index fb25215..38b6dbf 100644
--- a/doc/net.example.BSD.in
+++ b/doc/net.example.BSD.in
@@ -440,3 +440,6 @@
 #       # This function is mostly here for completeness... I haven't
 #       # thought of anything nifty to do with it yet ;-)
 #}
+
+# You should note that we don't stop the network at system shutdown by default.
+# If you really need this, then set shutdown_network=YES

diff --git a/doc/net.example.Linux.in b/doc/net.example.Linux.in
index f050c2a..ed3b80b 100644
--- a/doc/net.example.Linux.in
+++ b/doc/net.example.Linux.in
@@ -1242,3 +1242,6 @@
 #       # This function is mostly here for completeness... I haven't
 #       # thought of anything nifty to do with it yet ;-)
 #}
+
+# You should note that we don't stop the network at system shutdown by default.
+# If you really need this, then set shutdown_network=YES

diff --git a/init.d/net.lo.in b/init.d/net.lo.in
index fbc0124..10a7cb6 100644
--- a/init.d/net.lo.in
+++ b/init.d/net.lo.in
@@ -709,6 +709,11 @@ ${routes}"
 
 stop()
 {
+	# Don't stop the network at shutdown.
+ 	# We don't use the noshutdown keyword so that we are started again
+	# correctly if we go back to multiuser.
+	yesno ${shutdown_network:-YES} && yesno $RC_GOINGDOWN && return 0
+
 	local IFACE=${RC_SVCNAME#*.} module=
 	local IFVAR=$(shell_var "${IFACE}") opts=
 


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-11 15:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-09 19:56 [gentoo-commits] proj/openrc:master commit in: init.d/, doc/ William Hubbs
  -- strict thread matches above, loose matches on Subject: below --
2011-04-10 21:20 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox