Module Name:    src
Committed By:   tls
Date:           Sun Aug 10 06:49:24 UTC 2014

Modified Files:
        src/etc/rc.d [tls-earlyentropy]: dhcpcd dhcpd mountall mountcritlocal
            mountcritremote named network random_seed

Log Message:
Rebase.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.4.1 src/etc/rc.d/dhcpcd
cvs rdiff -u -r1.6 -r1.6.70.1 src/etc/rc.d/dhcpd
cvs rdiff -u -r1.8 -r1.8.24.1 src/etc/rc.d/mountall
cvs rdiff -u -r1.13 -r1.13.24.1 src/etc/rc.d/mountcritlocal
cvs rdiff -u -r1.8 -r1.8.70.1 src/etc/rc.d/mountcritremote
cvs rdiff -u -r1.23 -r1.23.8.1 src/etc/rc.d/named
cvs rdiff -u -r1.63 -r1.63.6.1 src/etc/rc.d/network
cvs rdiff -u -r1.6 -r1.6.8.1 src/etc/rc.d/random_seed

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/etc/rc.d/dhcpcd
diff -u src/etc/rc.d/dhcpcd:1.2 src/etc/rc.d/dhcpcd:1.2.4.1
--- src/etc/rc.d/dhcpcd:1.2	Tue Jun 25 13:02:53 2013
+++ src/etc/rc.d/dhcpcd	Sun Aug 10 06:49:24 2014
@@ -9,6 +9,7 @@ $_rc_subr_loaded . /etc/rc.subr
 name=dhcpcd
 rcvar=$name
 command=/sbin/$name
+extra_commands="reload"
 
 load_rc_config $name
 

Index: src/etc/rc.d/dhcpd
diff -u src/etc/rc.d/dhcpd:1.6 src/etc/rc.d/dhcpd:1.6.70.1
--- src/etc/rc.d/dhcpd:1.6	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/dhcpd	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: dhcpd,v 1.6 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: dhcpd,v 1.6.70.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: dhcpd
@@ -12,8 +12,17 @@ $_rc_subr_loaded . /etc/rc.subr
 name="dhcpd"
 rcvar=$name
 command="/usr/sbin/${name}"
+start_precmd="dhcpd_precmd"
 pidfile="/var/run/${name}.pid"
-required_files="/etc/${name}.conf /var/db/${name}.leases"
+required_files="/etc/${name}.conf"
+
+dhcpd_precmd()
+{
+        if [ ! -e "/var/db/${name}.leases" ]; then
+                echo "Creating /var/db/${name}.leases"
+                touch /var/db/${name}.leases
+        fi
+}
 
 load_rc_config $name
 run_rc_command "$1"

Index: src/etc/rc.d/mountall
diff -u src/etc/rc.d/mountall:1.8 src/etc/rc.d/mountall:1.8.24.1
--- src/etc/rc.d/mountall:1.8	Sun Oct 18 21:58:37 2009
+++ src/etc/rc.d/mountall	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mountall,v 1.8 2009/10/18 21:58:37 haad Exp $
+# $NetBSD: mountall,v 1.8.24.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # REQUIRE: mountcritremote named ypbind
@@ -14,7 +14,7 @@ stop_cmd="mountall_stop"
 
 mountall_start()
 {
-	echo 'Mounting all filesystems...'
+	echo 'Mounting all file systems...'
 	if [ -f /etc/zfs/zpool.cache ]; then
 		# Get ZFS module loaded (and thereby, zvols created).
 		zfs list > /dev/null 2>&1
@@ -32,7 +32,7 @@ mountall_start()
 
 mountall_stop()
 {
-	echo 'Unmounting all filesystems...'
+	echo 'Unmounting all file systems...'
 	if [ -f /etc/zfs/zpool.cache ]; then
 		# Unmount ZFS file systems.
 		zfs unmount -a

Index: src/etc/rc.d/mountcritlocal
diff -u src/etc/rc.d/mountcritlocal:1.13 src/etc/rc.d/mountcritlocal:1.13.24.1
--- src/etc/rc.d/mountcritlocal:1.13	Thu Jan 13 22:30:09 2011
+++ src/etc/rc.d/mountcritlocal	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mountcritlocal,v 1.13 2011/01/13 22:30:09 haad Exp $
+# $NetBSD: mountcritlocal,v 1.13.24.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: mountcritlocal
@@ -14,7 +14,7 @@ stop_cmd=":"
 
 mountcritlocal_start()
 {
-	#	Mount critical filesystems that are `local'
+	#	Mount critical file systems that are `local'
 	#	(as specified in $critical_filesystems_local)
 	#	This usually includes /var.
 	#

Index: src/etc/rc.d/mountcritremote
diff -u src/etc/rc.d/mountcritremote:1.8 src/etc/rc.d/mountcritremote:1.8.70.1
--- src/etc/rc.d/mountcritremote:1.8	Fri Aug 13 18:08:03 2004
+++ src/etc/rc.d/mountcritremote	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: mountcritremote,v 1.8 2004/08/13 18:08:03 mycroft Exp $
+# $NetBSD: mountcritremote,v 1.8.70.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: mountcritremote
@@ -14,7 +14,7 @@ stop_cmd=":"
 
 mountcritremote_start()
 {
-	#	Mount critical filesystems that may be `remote'.
+	#	Mount critical file systems that may be `remote'.
 	#	(as specified in $critical_filesystems_remote)
 	#	This usually includes /usr.
 	#

Index: src/etc/rc.d/named
diff -u src/etc/rc.d/named:1.23 src/etc/rc.d/named:1.23.8.1
--- src/etc/rc.d/named:1.23	Mon Oct  1 18:46:43 2012
+++ src/etc/rc.d/named	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: named,v 1.23 2012/10/01 18:46:43 christos Exp $
+# $NetBSD: named,v 1.23.8.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: named
@@ -63,6 +63,11 @@ named_migrate()
 
 named_precmd()
 {
+	if [ ! -e "/etc/rndc.key" ]; then
+		echo "Generating rndc.key"
+		/usr/sbin/rndc-confgen -a
+	fi
+
 	if [ -z "$named_chrootdir" ]; then
 		if [ ! -d "/etc/namedb/keys" ]; then
 			mkdir -m 775 "/etc/namedb/keys"
@@ -96,7 +101,7 @@ named_precmd()
 		;;
 	esac
 
-	for i in null random; do
+	for i in null random urandom; do
 		if [ ! -c "${named_chrootdir}/dev/$i" ]; then
 			rm -f "${named_chrootdir}/dev/$i"
 			(cd /dev && 

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.63 src/etc/rc.d/network:1.63.6.1
--- src/etc/rc.d/network:1.63	Sat Apr 20 18:24:18 2013
+++ src/etc/rc.d/network	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.63 2013/04/20 18:24:18 christos Exp $
+# $NetBSD: network,v 1.63.6.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: network
@@ -16,11 +16,11 @@ stop_cmd="network_stop"
 nl='
 ' # a newline
 
-intmissing() {
+intmissing()
+{
 	local int="$1"
 	shift
-	for i
-	do
+	for i; do
 		if [ "$int" = "$i" ]; then
 			return 1
 		fi
@@ -28,12 +28,34 @@ intmissing() {
 	return 0
 }
 
+have_inet6()
+{
+	/sbin/ifconfig lo0 inet6 >/dev/null 2>&1
+}
+
 network_start()
 {
 	# set hostname, turn on network
 	#
 	echo "Starting network."
 
+	network_start_hostname
+	network_start_domainname
+	network_start_loopback
+	have_inet6 &&
+	network_start_ipv6_route
+	[ "$net_interfaces" != NO ] &&
+	network_start_interfaces
+	network_start_aliases
+	network_start_defaultroute
+	network_start_defaultroute6
+	have_inet6 &&
+	network_start_ipv6_autoconf
+	network_start_local
+}
+
+network_start_hostname()
+{
 	# If $hostname is set, use it for my Internet name,
 	# otherwise use /etc/myname
 	#
@@ -54,7 +76,10 @@ network_start()
 			warn "\$hostname not set."
 		fi
 	fi
+}
 
+network_start_domainname()
+{
 	# Check $domainname first, then /etc/defaultdomain,
 	# for NIS/YP domain name
 	#
@@ -70,7 +95,10 @@ network_start()
 	if checkyesno flushroutes; then
 		/sbin/route -qn flush
 	fi
+}
 
+network_start_loopback()
+{
 	# Set the address for the first loopback interface, so that the
 	# auto-route from a newly configured interface's address to lo0
 	# works correctly.
@@ -82,93 +110,97 @@ network_start()
 	# According to RFC1122, 127.0.0.0/8 must not leave the node.
 	#
 	/sbin/route -q add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject
+}
 
+network_start_ipv6_route()
+{
 	# IPv6 routing setups, and host/router mode selection.
 	#
-	if /sbin/ifconfig lo0 inet6 >/dev/null 2>&1; then
-		# We have IPv6 support in kernel.
+	# We have IPv6 support in kernel.
 
-		# disallow link-local unicast dest without outgoing scope
-		# identifiers.
-		#
-		/sbin/route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject
+	# disallow link-local unicast dest without outgoing scope
+	# identifiers.
+	#
+	/sbin/route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject
 
-		# disallow the use of the RFC3849 documentation address
-		#
-		/sbin/route -q add -inet6 2001:db8:: -prefixlen 32 ::1 -reject
+	# disallow the use of the RFC3849 documentation address
+	#
+	/sbin/route -q add -inet6 2001:db8:: -prefixlen 32 ::1 -reject
 
-		# IPv6 site-local scoped address prefix (fec0::/10)
-		# has been deprecated by RFC3879.
-		#
-		if [ -n "$ip6sitelocal" ]; then
-			warn "\$ip6sitelocal is no longer valid"
-		fi
+	# IPv6 site-local scoped address prefix (fec0::/10)
+	# has been deprecated by RFC3879.
+	#
+	if [ -n "$ip6sitelocal" ]; then
+		warn "\$ip6sitelocal is no longer valid"
+	fi
 
-		# disallow "internal" addresses to appear on the wire.
-		#
-		/sbin/route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
+	# disallow "internal" addresses to appear on the wire.
+	#
+	/sbin/route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
 
-		# disallow packets to malicious IPv4 compatible prefix
-		#
-		/sbin/route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject
-		/sbin/route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject
-		/sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject
-		/sbin/route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject
+	# disallow packets to malicious IPv4 compatible prefix
+	#
+	/sbin/route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject
+	/sbin/route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject
+	/sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject
+	/sbin/route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject
 
-		# disallow packets to malicious 6to4 prefix
-		#
-		/sbin/route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject
-		/sbin/route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject
-		/sbin/route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject
-		/sbin/route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject
-
-		# Completely disallow packets to IPv4 compatible prefix.
-		# This may conflict with RFC1933 under following circumstances:
-		# (1) An IPv6-only KAME node tries to originate packets to IPv4
-		#     compatible destination.  The KAME node has no IPv4
-		#     compatible support.  Under RFC1933, it should transmit
-		#     native IPv6 packets toward IPv4 compatible destination,
-		#     hoping it would reach a router that forwards the packet
-		#     toward auto-tunnel interface.
-		# (2) An IPv6-only node originates a packet to IPv4 compatible
-		#     destination.  A KAME node is acting as an IPv6 router, and
-		#     asked to forward it.
-		# Due to rare use of IPv4 compatible address, and security
-		# issues with it, we disable it by default.
-		#
-		/sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
+	# disallow packets to malicious 6to4 prefix
+	#
+	/sbin/route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject
+	/sbin/route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject
+	/sbin/route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject
+	/sbin/route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject
 
-		/sbin/sysctl -qw net.inet6.ip6.forwarding=0
-		/sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0
+	# Completely disallow packets to IPv4 compatible prefix.
+	# This may conflict with RFC1933 under following circumstances:
+	# (1) An IPv6-only KAME node tries to originate packets to IPv4
+	#     compatible destination.  The KAME node has no IPv4
+	#     compatible support.  Under RFC1933, it should transmit
+	#     native IPv6 packets toward IPv4 compatible destination,
+	#     hoping it would reach a router that forwards the packet
+	#     toward auto-tunnel interface.
+	# (2) An IPv6-only node originates a packet to IPv4 compatible
+	#     destination.  A KAME node is acting as an IPv6 router, and
+	#     asked to forward it.
+	# Due to rare use of IPv4 compatible address, and security
+	# issues with it, we disable it by default.
+	#
+	/sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
 
-		case $ip6mode in
-		router)
-			echo 'IPv6 mode: router'
-			/sbin/sysctl -qw net.inet6.ip6.forwarding=1
-
-			# disallow unique-local unicast forwarding without
-			# explicit configuration.
-			if ! checkyesno ip6uniquelocal; then
-				/sbin/route -q add -inet6 fc00:: -prefixlen 7 \
-				    ::1 -reject
-			fi
-			;;
+	/sbin/sysctl -qw net.inet6.ip6.forwarding=0
+	/sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0
 
-		autohost)
-			echo 'IPv6 mode: autoconfigured host'
-			/sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1
-			;;
+	case $ip6mode in
+	router)
+		echo 'IPv6 mode: router'
+		/sbin/sysctl -qw net.inet6.ip6.forwarding=1
 
-		host)	
-			echo 'IPv6 mode: host'
-			;;
+		# disallow unique-local unicast forwarding without
+		# explicit configuration.
+		if ! checkyesno ip6uniquelocal; then
+			/sbin/route -q add -inet6 fc00:: -prefixlen 7 \
+			    ::1 -reject
+		fi
+		;;
 
-		*)	warn "invalid \$ip6mode value "\"$ip6mode\"
-			;;
+	autohost)
+		echo 'IPv6 mode: autoconfigured host'
+		/sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1
+		;;
 
-		esac
-	fi
+	host)	
+		echo 'IPv6 mode: host'
+		;;
+
+	*)	warn "invalid \$ip6mode value "\"$ip6mode\"
+		;;
+
+	esac
+}
 
+network_start_interfaces()
+{
 	# Configure all of the network interfaces listed in $net_interfaces;
 	# if $auto_ifconfig is YES, grab all interfaces from ifconfig.
 	# In the following, "xxN" stands in for interface names, like "le0".
@@ -201,115 +233,116 @@ network_start()
 	# You can put shell script fragment into /etc/ifconfig.xxN by
 	# starting a line with "!".  Refer to ifconfig.if(5) for details.
 	#
-	if [ "$net_interfaces" != NO ]; then
-		ifaces="$(/sbin/ifconfig -l)"
-		if checkyesno auto_ifconfig; then
-			tmp="$ifaces"
-			for cloner in $(/sbin/ifconfig -C); do
-				for int in /etc/ifconfig.${cloner}[0-9]*; do
-					[ ! -f $int ] && break
-					tmp="$tmp ${int##*.}"
-				done
+	ifaces="$(/sbin/ifconfig -l)"
+	if checkyesno auto_ifconfig; then
+		tmp="$ifaces"
+		for cloner in $(/sbin/ifconfig -C); do
+			for int in /etc/ifconfig.${cloner}[0-9]*; do
+				[ ! -f $int ] && break
+				tmp="$tmp ${int##*.}"
 			done
-		else
-			tmp="$net_interfaces"
-		fi
-		echo -n 'Configuring network interfaces:'
-		for int in $tmp; do
-			eval argslist=\$ifconfig_$int
-
-			# Skip interfaces that do not have explicit
-			# configuration information.  If auto_ifconfig is
-			# false then also warn about such interfaces.
-			#
-			if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ]
-			then
-				if ! checkyesno auto_ifconfig; then
-					echo
-					warn \
-			"/etc/ifconfig.$int missing and ifconfig_$int not set;"
-					warn "interface $int not configured."
-				fi
-				continue
+		done
+	else
+		tmp="$net_interfaces"
+	fi
+	echo -n 'Configuring network interfaces:'
+	for int in $tmp; do
+		eval argslist=\$ifconfig_$int
+
+		# Skip interfaces that do not have explicit
+		# configuration information.  If auto_ifconfig is
+		# false then also warn about such interfaces.
+		#
+		if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ]
+		then
+			if ! checkyesno auto_ifconfig; then
+				echo
+				warn \
+		"/etc/ifconfig.$int missing and ifconfig_$int not set;"
+				warn "interface $int not configured."
 			fi
+			continue
+		fi
 
-			echo -n " $int"
+		echo -n " $int"
 
-			# Create the interface if necessary.
-			# If the interface did not exist before,
-			# then also resync ipf(4).
-			#
-			if intmissing $int $ifaces; then
-				if /sbin/ifconfig $int create && \
-				   checkyesno ipfilter; then
-					/sbin/ipf -y >/dev/null
-				fi
+		# Create the interface if necessary.
+		# If the interface did not exist before,
+		# then also resync ipf(4).
+		#
+		if intmissing $int $ifaces; then
+			if /sbin/ifconfig $int create && \
+			   checkyesno ipfilter; then
+				/sbin/ipf -y >/dev/null
 			fi
+		fi
 
-			# If $ifconfig_xxN is empty, then use
-			# /etc/ifconfig.xxN, which we know exists due to
-			# an earlier test.
-			#
-			# If $ifconfig_xxN is non-empty and contains a
-			# newline, then just use it as is.  (This allows
-			# semicolons through unmolested.)
-			#
-			# If $ifconfig_xxN is non-empty and does not
-			# contain a newline, then convert all semicolons
-			# to newlines.
-			#
-			case "$argslist" in
-			'')
-				cat /etc/ifconfig.$int
+		# If $ifconfig_xxN is empty, then use
+		# /etc/ifconfig.xxN, which we know exists due to
+		# an earlier test.
+		#
+		# If $ifconfig_xxN is non-empty and contains a
+		# newline, then just use it as is.  (This allows
+		# semicolons through unmolested.)
+		#
+		# If $ifconfig_xxN is non-empty and does not
+		# contain a newline, then convert all semicolons
+		# to newlines.
+		#
+		case "$argslist" in
+		'')
+			cat /etc/ifconfig.$int
+			;;
+		*"${nl}"*)
+			echo "$argslist"
+			;;
+		*)
+			(
+				set -o noglob
+				IFS=';'; set -- $argslist
+				#echo >&2 "[$#] [$1] [$2] [$3] [$4]"
+				IFS="$nl"; echo "$*"
+			)
+			;;
+		esac |
+		collapse_backslash_newline |
+		while read -r args; do
+			case "$args" in
+			''|"#"*|create)
+				;;
+			"!"*)
+				# Run arbitrary command in a subshell.
+				( eval "${args#*!}" )
 				;;
-			*"${nl}"*)
-				echo "$argslist"
+			dhcp)
+				if ! checkyesno dhcpcd; then
+					/sbin/dhcpcd -n \
+						${dhcpcd_flags} $int
+				fi
 				;;
 			*)
+				# Pass args to ifconfig.  Note
+				# that args may contain embedded
+				# shell metacharacters, such as
+				# "ssid 'foo;*>bar'". We eval
+				# one more time so that things
+				# like ssid "Columbia University" work.
 				(
 					set -o noglob
-					IFS=';'; set -- $argslist
-					#echo >&2 "[$#] [$1] [$2] [$3] [$4]"
-					IFS="$nl"; echo "$*"
+					eval set -- $args
+					#echo >&2 "[$#] [$1] [$2] [$3]"
+					/sbin/ifconfig $int "$@"
 				)
 				;;
-			esac |
-			collapse_backslash_newline |
-			while read -r args; do
-				case "$args" in
-				''|"#"*|create)
-					;;
-				"!"*)
-					# Run arbitrary command in a subshell.
-					( eval "${args#*!}" )
-					;;
-				dhcp)
-					if ! checkyesno dhcpcd; then
-						/sbin/dhcpcd -n \
-							${dhcpcd_flags} $int
-					fi
-					;;
-				*)
-					# Pass args to ifconfig.  Note
-					# that args may contain embedded
-					# shell metacharacters, such as
-					# "ssid 'foo;*>bar'". We eval
-					# one more time so that things
-					# like ssid "Columbia University" work.
-					(
-						set -o noglob
-						eval set -- $args
-						#echo >&2 "[$#] [$1] [$2] [$3]"
-						/sbin/ifconfig $int "$@"
-					)
-					;;
-				esac
-			done
-			configured_interfaces="$configured_interfaces $int"
+			esac
 		done
-		echo "."
-	fi
+		configured_interfaces="$configured_interfaces $int"
+	done
+	echo "."
+}
 
+network_start_aliases()
+{
 	echo -n "Adding interface aliases:"
 
 	# Check if each configured interface xxN has an $ifaliases_xxN variable
@@ -360,7 +393,10 @@ network_start()
 	fi
 
 	echo "." # for "Adding interface aliases:"
+}
 
+network_start_defaultroute()
+{
 	# Check $defaultroute, then /etc/mygate, for the name or address
 	# of my IPv4 gateway host. If using a name, that name must be in
 	# /etc/hosts.
@@ -371,7 +407,10 @@ network_start()
 	if [ -n "$defaultroute" ]; then
 		/sbin/route add default $defaultroute
 	fi
+}
 
+network_start_defaultroute6()
+{
 	# Check $defaultroute6, then /etc/mygate6, for the name or address
 	# of my IPv6 gateway host. If using a name, that name must be in
 	# /etc/hosts.  Note that the gateway host address must be a link-local
@@ -388,39 +427,43 @@ network_start()
 		fi
 		/sbin/route add -inet6 default $defaultroute6
 	fi
+}
 
+network_start_ipv6_autoconf()
+{
 	# IPv6 interface autoconfiguration.
 	#
-	if /sbin/ifconfig lo0 inet6 >/dev/null 2>&1; then
-		# wait till DAD is completed. always invoke it in case
-		# if are configured manually by ifconfig
+	# wait till DAD is completed. always invoke it in case
+	# if are configured manually by ifconfig
+	#
+	echo 'Waiting for DAD completion for' \
+	    'statically configured addresses...'
+	dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null)
+	sleep $dadcount
+	sleep 1
+
+	if checkyesno rtsol; then
+		if [ "$ip6mode" = "autohost" ]; then
+			echo 'Sending router solicitation...'
+			/sbin/rtsol $rtsol_flags
+		else
+			echo
+			warn \
+		    "ip6mode must be set to 'autohost' to use rtsol."
+		fi
+
+		# wait till DAD is completed, for global addresses
+		# configured by router advert message.
 		#
 		echo 'Waiting for DAD completion for' \
-		    'statically configured addresses...'
-		dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null)
+		    'addresses configured by router advert message...'
 		sleep $dadcount
 		sleep 1
-
-		if checkyesno rtsol; then
-			if [ "$ip6mode" = "autohost" ]; then
-				echo 'Sending router solicitation...'
-				/sbin/rtsol $rtsol_flags
-			else
-				echo
-				warn \
-			    "ip6mode must be set to 'autohost' to use rtsol."
-			fi
-
-			# wait till DAD is completed, for global addresses
-			# configured by router advert message.
-			#
-			echo 'Waiting for DAD completion for' \
-			    'addresses configured by router advert message...'
-			sleep $dadcount
-			sleep 1
-		fi
 	fi
+}
 
+network_start_local()
+{
 	# XXX this must die
 	if [ -s /etc/netstart.local ]; then
 		sh /etc/netstart.local start
@@ -431,11 +474,23 @@ network_stop()
 {
 	echo "Stopping network."
 
+	network_stop_local
+	network_stop_aliases
+	[ "$net_interfaces" != NO ] &&
+	network_stop_interfaces
+	network_stop_route
+}
+
+network_stop_local()
+{
 	# XXX this must die
 	if [ -s /etc/netstart.local ]; then
 		sh /etc/netstart.local stop
 	fi
+}
 
+network_stop_aliases()
+{
 	echo "Deleting aliases."
 	if [ -f /etc/ifaliases ]; then
 		while read addr int net; do
@@ -453,34 +508,38 @@ network_stop()
 			done
 		fi
 	done
+}
 
+network_stop_interfaces()
+{
 	# down interfaces
 	#
 	echo -n 'Downing network interfaces:'
-	if [ "$net_interfaces" != NO ]; then
-		if checkyesno auto_ifconfig; then
-			tmp=$(/sbin/ifconfig -l)
-		else
-			tmp="$net_interfaces"
-		fi
-		for int in $tmp; do
-			eval args=\$ifconfig_$int
-			if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
-				echo -n " $int"
-				if [ -f /var/run/dhcpcd-$int.pid ]; then
-					/sbin/dhcpcd -k $int 2> /dev/null
-				fi
-				/sbin/ifconfig $int down
-				if /sbin/ifconfig $int destroy 2>/dev/null && \
-				   checkyesno ipfilter; then
-					# resync ipf(4)
-					/sbin/ipf -y >/dev/null
-				fi
-			fi
-		done
-		echo "."
+	if checkyesno auto_ifconfig; then
+		tmp=$(/sbin/ifconfig -l)
+	else
+		tmp="$net_interfaces"
 	fi
+	for int in $tmp; do
+		eval args=\$ifconfig_$int
+		if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
+			echo -n " $int"
+			if [ -f /var/run/dhcpcd-$int.pid ]; then
+				/sbin/dhcpcd -k $int 2> /dev/null
+			fi
+			/sbin/ifconfig $int down
+			if /sbin/ifconfig $int destroy 2>/dev/null && \
+			   checkyesno ipfilter; then
+				# resync ipf(4)
+				/sbin/ipf -y >/dev/null
+			fi
+		fi
+	done
+	echo "."
+}
 
+network_stop_route()
+{
 	# flush routes
 	#
 	/sbin/route -qn flush

Index: src/etc/rc.d/random_seed
diff -u src/etc/rc.d/random_seed:1.6 src/etc/rc.d/random_seed:1.6.8.1
--- src/etc/rc.d/random_seed:1.6	Sat Dec 29 22:15:07 2012
+++ src/etc/rc.d/random_seed	Sun Aug 10 06:49:24 2014
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: random_seed,v 1.6 2012/12/29 22:15:07 christos Exp $
+# $NetBSD: random_seed,v 1.6.8.1 2014/08/10 06:49:24 tls Exp $
 #
 
 # PROVIDE: random_seed
@@ -42,7 +42,7 @@ getfstype() {
 fs_safe()
 {
 	#
-	# Enforce that the file's on a local filesystem.
+	# Enforce that the file's on a local file system.
 	# Include only the types we can actually write.
 	#
 	fstype="$(getfstype "$1")"
@@ -51,7 +51,7 @@ fs_safe()
 		return 0
 		;;
 	*)
-		message "Bad filesystem type ${fstype}"
+		message "Bad file system type ${fstype}"
 		return 1
 		;;
 	esac

Reply via email to