Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jun 2011 23:14:49 +0000 (UTC)
From:      Doug Barton <dougb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r223553 - in stable/7: etc/defaults etc/rc.d share/man/man5
Message-ID:  <201106252314.p5PNEnfA026815@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dougb
Date: Sat Jun 25 23:14:49 2011
New Revision: 223553
URL: http://svn.freebsd.org/changeset/base/223553

Log:
  MFC r223310:
  
  Add the netwait rc.d script. It waits for the specified period for the
  network to become active.
  
  MFC r223311, r2233408:
  
  The script itself, and a minor fix to it.

Added:
  stable/7/etc/rc.d/netwait
     - copied, changed from r223311, head/etc/rc.d/netwait
Modified:
  stable/7/etc/defaults/rc.conf
  stable/7/etc/rc.d/Makefile
  stable/7/etc/rc.d/mountcritremote
  stable/7/share/man/man5/rc.conf.5
Directory Properties:
  stable/7/etc/   (props changed)
  stable/7/share/man/man5/   (props changed)

Modified: stable/7/etc/defaults/rc.conf
==============================================================================
--- stable/7/etc/defaults/rc.conf	Sat Jun 25 23:13:05 2011	(r223552)
+++ stable/7/etc/defaults/rc.conf	Sat Jun 25 23:14:49 2011	(r223553)
@@ -414,6 +414,13 @@ rfcomm_pppd_server_two_channel="3"	# Ove
 #rfcomm_pppd_server_two_register_sp="NO"	# Override SP and DUN register
 #rfcomm_pppd_server_two_register_dun="NO"	# for 'two'
 
+### Network link/usability verification options
+netwait_enable="NO"		# Enable rc.d/netwait (or NO)
+#netwait_ip=""			# IP addresses to be pinged by netwait.
+netwait_timeout="60"		# Total number of seconds to perform pings.
+#netwait_if=""			# Interface name to watch link state on.
+netwait_if_timeout="30"		# Total number of seconds to monitor link state.
+
 ### Miscellaneous network options: ###
 icmp_bmcastecho="NO"	# respond to broadcast ping packets
 

Modified: stable/7/etc/rc.d/Makefile
==============================================================================
--- stable/7/etc/rc.d/Makefile	Sat Jun 25 23:13:05 2011	(r223552)
+++ stable/7/etc/rc.d/Makefile	Sat Jun 25 23:14:49 2011	(r223553)
@@ -22,7 +22,7 @@ FILES=	DAEMON FILESYSTEMS LOGIN NETWORKI
 	ldconfig local localpkg lockd lpd \
 	mixer motd mountcritlocal mountcritremote mountlate \
 	mdconfig mdconfig2 mountd moused mroute6d mrouted msgs \
-	named natd netif netoptions \
+	named natd netif netoptions netwait \
 	network_ipv6 newsyslog nfsclient nfsd \
 	nfsserver nisdomain nsswitch ntpd ntpdate \
 	othermta \

Modified: stable/7/etc/rc.d/mountcritremote
==============================================================================
--- stable/7/etc/rc.d/mountcritremote	Sat Jun 25 23:13:05 2011	(r223552)
+++ stable/7/etc/rc.d/mountcritremote	Sat Jun 25 23:14:49 2011	(r223553)
@@ -4,7 +4,7 @@
 #
 
 # PROVIDE: mountcritremote
-# REQUIRE: NETWORKING FILESYSTEMS cleanvar ipsec
+# REQUIRE: NETWORKING FILESYSTEMS cleanvar ipsec netwait
 # KEYWORD: nojail
 
 . /etc/rc.subr

Copied and modified: stable/7/etc/rc.d/netwait (from r223311, head/etc/rc.d/netwait)
==============================================================================
--- head/etc/rc.d/netwait	Sun Jun 19 22:59:54 2011	(r223311, copy source)
+++ stable/7/etc/rc.d/netwait	Sat Jun 25 23:14:49 2011	(r223553)
@@ -14,7 +14,8 @@
 . /etc/rc.subr
 
 name="netwait"
-rc_var=`set_rcvar`
+rcvar=`set_rcvar`
+
 start_cmd="${name}_start"
 stop_cmd=":"
 

Modified: stable/7/share/man/man5/rc.conf.5
==============================================================================
--- stable/7/share/man/man5/rc.conf.5	Sat Jun 25 23:13:05 2011	(r223552)
+++ stable/7/share/man/man5/rc.conf.5	Sat Jun 25 23:14:49 2011	(r223553)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 18, 2011
+.Dd June 19, 2011
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -4140,6 +4140,61 @@ if it should register Dial-Up Networking
 RFCOMM channel.
 Default
 .Dq Li NO .
+.It Va netwait_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+delays the start of network-reliant services until
+.Va netwait_if
+is up and ICMP packets to a destination defined in
+.Va netwait_ip
+are flowing.
+Link state is examined first, followed by
+.Dq Li pinging
+an IP address to verify network usability.
+If no destination can be reached or timeouts are exceeded,
+network services are started anyway with no guarantee that
+the network is usable.
+Use of this variable requires both
+.Va netwait_ip
+and
+.Va netwait_if
+to be set.
+.It Va netwait_ip
+.Pq Vt str
+Empty by default.
+This variable contains a space-delimited list of IP addresses to
+.Xr ping 8 .
+DNS hostnames should not be used as resolution is not guaranteed
+to be functional at this point.
+If multiple IP addresses are specified,
+each will be tried until one is successful or the list is exhausted.
+.It Va netwait_timeout
+.Pq Vt int
+Indicates the total number of seconds to perform a
+.Dq Li ping
+against each IP address in
+.Va netwait_ip ,
+at a rate of one ping per second.
+If any of the pings are successful,
+full network connectivity is considered reliable.
+The default is 60.
+.It Va netwait_if
+.Pq Vt str
+Empty by default.
+Defines the name of the network interface on which watch for link.
+.Xr ifconfig 8
+is used to monitor the interface, looking for
+.Dq Li status: no carrier .
+Once gone, the link is considered up.
+This can be a
+.Xr vlan 4
+interface if desired.
+.It Va netwait_if_timeout
+.Pq Vt int
+Defines the total number of seconds to wait for link to become usable,
+polled at a 1-second interval.
+The default is 30.
 .El
 .Sh FILES
 .Bl -tag -width ".Pa /etc/defaults/rc.conf" -compact
@@ -4213,6 +4268,7 @@ Default
 .Xr ntpdate 8 ,
 .Xr pfctl 8 ,
 .Xr pflogd 8 ,
+.Xr ping 8 ,
 .Xr powerd 8 ,
 .Xr quotacheck 8 ,
 .Xr quotaon 8 ,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106252314.p5PNEnfA026815>