Massive whitespace cleanup
This commit is contained in:
		@@ -974,7 +974,7 @@
 | 
				
			|||||||
#
 | 
					#
 | 
				
			||||||
#	# Test to see if we're docked or not and configure like so
 | 
					#	# Test to see if we're docked or not and configure like so
 | 
				
			||||||
#	# config_docked="dhcp"
 | 
					#	# config_docked="dhcp"
 | 
				
			||||||
#	if grep -q "1" /sys/devices/platform/dock.0/docked ; then
 | 
					#	if grep -q "1" /sys/devices/platform/dock.0/docked; then
 | 
				
			||||||
#       einfo "${IFACE} is docked - configuring"
 | 
					#       einfo "${IFACE} is docked - configuring"
 | 
				
			||||||
#		_configure_variables "docked"
 | 
					#		_configure_variables "docked"
 | 
				
			||||||
#	fi
 | 
					#	fi
 | 
				
			||||||
@@ -1009,15 +1009,15 @@
 | 
				
			|||||||
#	#	'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
 | 
					#	#	'from 216.113.223.51/32 to 192.168.1.0/24 table localnet priority 100' \
 | 
				
			||||||
#	#"
 | 
					#	#"
 | 
				
			||||||
#	eval set -- $\rules_${IFVAR}
 | 
					#	eval set -- $\rules_${IFVAR}
 | 
				
			||||||
#	if [ $# != 0 ] ; then
 | 
					#	if [ $# != 0 ]; then
 | 
				
			||||||
#		einfo "Adding IP policy routing rules"
 | 
					#		einfo "Adding IP policy routing rules"
 | 
				
			||||||
#		eindent
 | 
					#		eindent
 | 
				
			||||||
#		# Ensure that the kernel supports policy routing
 | 
					#		# Ensure that the kernel supports policy routing
 | 
				
			||||||
#		if ! ip rule list | grep -q "^" ; then
 | 
					#		if ! ip rule list | grep -q "^"; then
 | 
				
			||||||
#			eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
 | 
					#			eerror "You need to enable IP Policy Routing (CONFIG_IP_MULTIPLE_TABLES)"
 | 
				
			||||||
#			eerror "in your kernel to use ip rules"
 | 
					#			eerror "in your kernel to use ip rules"
 | 
				
			||||||
#		else
 | 
					#		else
 | 
				
			||||||
#			for x in "$@" ; do
 | 
					#			for x in "$@"; do
 | 
				
			||||||
#				ebegin "${x}"
 | 
					#				ebegin "${x}"
 | 
				
			||||||
#				ip rule add ${x} dev "${IFACE}"
 | 
					#				ip rule add ${x} dev "${IFACE}"
 | 
				
			||||||
#				eend $?
 | 
					#				eend $?
 | 
				
			||||||
@@ -1037,11 +1037,11 @@
 | 
				
			|||||||
#	[ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
 | 
					#	[ "${IFACE}" != "lo" ] && ethtool -s "${IFACE}" wol g
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#	Automatically erase any ip rules created in the example postup above
 | 
					#	Automatically erase any ip rules created in the example postup above
 | 
				
			||||||
#	if interface_exists "${IFACE}" ; then
 | 
					#	if interface_exists "${IFACE}"; then
 | 
				
			||||||
#		# Remove any rules for this interface
 | 
					#		# Remove any rules for this interface
 | 
				
			||||||
#		local rule
 | 
					#		local rule
 | 
				
			||||||
#		ip rule list | grep " iif ${IFACE}[ ]*" | {
 | 
					#		ip rule list | grep " iif ${IFACE}[ ]*" | {
 | 
				
			||||||
#			while read rule ; do
 | 
					#			while read rule; do
 | 
				
			||||||
#				rule="${rule#*:}"	
 | 
					#				rule="${rule#*:}"	
 | 
				
			||||||
#				ip rule del ${rule}
 | 
					#				ip rule del ${rule}
 | 
				
			||||||
#			done
 | 
					#			done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,9 +41,9 @@ install::
 | 
				
			|||||||
	$(_SUBDIR)
 | 
						$(_SUBDIR)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install:: $(BIN) $(CONF) $(CONF_APPEND)
 | 
					install:: $(BIN) $(CONF) $(CONF_APPEND)
 | 
				
			||||||
	if test -n "$(DIR)" ; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi
 | 
						if test -n "$(DIR)"; then $(INSTALL) -d $(DESTDIR)$(DIR) || exit $$?; fi
 | 
				
			||||||
	if test -n "$(BIN)" ; then $(INSTALL) $(BIN) $(DESTDIR)$(DIR) || exit $$?; fi
 | 
						if test -n "$(BIN)"; then $(INSTALL) $(BIN) $(DESTDIR)$(DIR) || exit $$?; fi
 | 
				
			||||||
	if test -n "$(INC)" ; then $(INSTALL) -m 0644 $(INC) $(DESTDIR)$(DIR) || exit $$?; fi
 | 
						if test -n "$(INC)"; then $(INSTALL) -m 0644 $(INC) $(DESTDIR)$(DIR) || exit $$?; fi
 | 
				
			||||||
	for x in $(CONF); do \
 | 
						for x in $(CONF); do \
 | 
				
			||||||
	 	if ! test -e $(DESTDIR)$(DIR)/$$x; then \
 | 
						 	if ! test -e $(DESTDIR)$(DIR)/$$x; then \
 | 
				
			||||||
			$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
 | 
								$(INSTALL) -m 0644 $$x $(DESTDIR)$(DIR) || exit $$?; \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -69,7 +69,7 @@ stop() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ebegin "Stopping the System Clock Adjuster"
 | 
						ebegin "Stopping the System Clock Adjuster"
 | 
				
			||||||
	if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz ; then
 | 
						if start-stop-daemon --test --quiet --stop --exec /sbin/adjkerntz; then
 | 
				
			||||||
		start-stop-daemon --stop --exec /sbin/adjkerntz
 | 
							start-stop-daemon --stop --exec /sbin/adjkerntz
 | 
				
			||||||
		eend $?
 | 
							eend $?
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,7 +33,7 @@ depend() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
start() {
 | 
					start() {
 | 
				
			||||||
	# Setup any user requested dump device
 | 
						# Setup any user requested dump device
 | 
				
			||||||
	if [ -n "${dump_device}" ] ; then
 | 
						if [ -n "${dump_device}" ]; then
 | 
				
			||||||
		ebegin "Activating kernel core dump device (${dump_device})"
 | 
							ebegin "Activating kernel core dump device (${dump_device})"
 | 
				
			||||||
		dumpon ${dump_device}
 | 
							dumpon ${dump_device}
 | 
				
			||||||
		eend $?
 | 
							eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,8 +42,8 @@ ipfw() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
init() {
 | 
					init() {
 | 
				
			||||||
	# Load the kernel module
 | 
						# Load the kernel module
 | 
				
			||||||
	if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>/dev/null; then
 | 
						if ! sysctl net.inet.ip.fw.enable=1 >/dev/null 2>&1; then
 | 
				
			||||||
		if ! kldload ipfw ; then
 | 
							if ! kldload ipfw; then
 | 
				
			||||||
			eend 1 "Unable to load firewall module"
 | 
								eend 1 "Unable to load firewall module"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -68,7 +68,7 @@ init() {
 | 
				
			|||||||
start() {
 | 
					start() {
 | 
				
			||||||
	local i= p= log=
 | 
						local i= p= log=
 | 
				
			||||||
	ebegin "Starting firewall rules"
 | 
						ebegin "Starting firewall rules"
 | 
				
			||||||
	if ! init ; then
 | 
						if ! init; then
 | 
				
			||||||
		eend 1 "Failed to flush firewall ruleset"
 | 
							eend 1 "Failed to flush firewall ruleset"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -157,7 +157,7 @@ stop() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
panic() {
 | 
					panic() {
 | 
				
			||||||
	ebegin "Stopping firewall rules - hard"
 | 
						ebegin "Stopping firewall rules - hard"
 | 
				
			||||||
	if ! init ; then
 | 
						if ! init; then
 | 
				
			||||||
		eend 1 "Failed to flush firewall ruleset"
 | 
							eend 1 "Failed to flush firewall ruleset"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,7 +24,7 @@
 | 
				
			|||||||
# SUCH DAMAGE.
 | 
					# SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mouse=${SVCNAME##*.}
 | 
					mouse=${SVCNAME##*.}
 | 
				
			||||||
if [ -n "${name}" -a "${mouse}" != "moused" ] ; then
 | 
					if [ -n "${name}" -a "${mouse}" != "moused" ]; then
 | 
				
			||||||
	moused_device=/dev/"${mouse}"
 | 
						moused_device=/dev/"${mouse}"
 | 
				
			||||||
	pidfile=/var/run/moused-"${mouse}".pid
 | 
						pidfile=/var/run/moused-"${mouse}".pid
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
@@ -41,9 +41,9 @@ depend() {
 | 
				
			|||||||
start() {
 | 
					start() {
 | 
				
			||||||
	ebegin "Starting ${name}" 
 | 
						ebegin "Starting ${name}" 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${moused_device}" ] ; then
 | 
						if [ -z "${moused_device}" ]; then
 | 
				
			||||||
		local dev=
 | 
							local dev=
 | 
				
			||||||
		for dev in /dev/psm[0-9]* /dev/ums[0-9]* ; do
 | 
							for dev in /dev/psm[0-9]* /dev/ums[0-9]*; do
 | 
				
			||||||
			[ -c "${dev}" ] || continue
 | 
								[ -c "${dev}" ] || continue
 | 
				
			||||||
			[ -e /var/run/moused-"${dev##*/}".pid ] && continue 
 | 
								[ -e /var/run/moused-"${dev##*/}".pid ] && continue 
 | 
				
			||||||
			moused_device=${dev}
 | 
								moused_device=${dev}
 | 
				
			||||||
@@ -54,7 +54,7 @@ start() {
 | 
				
			|||||||
		done
 | 
							done
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${moused_device}" ] ; then
 | 
						if [ -z "${moused_device}" ]; then
 | 
				
			||||||
		eend 1 "No mouse device found" 
 | 
							eend 1 "No mouse device found" 
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ start() {
 | 
				
			|||||||
		chmod 700 "${dump_dir}"
 | 
							chmod 700 "${dump_dir}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${RC_UNAME}" = "FreeBSD" ] ; then
 | 
						if [ "${RC_UNAME}" = "FreeBSD" ]; then
 | 
				
			||||||
		# Don't quote ${dump_device}, so that if it's unset,
 | 
							# Don't quote ${dump_device}, so that if it's unset,
 | 
				
			||||||
		# savecore will check on the partitions listed in fstab
 | 
							# savecore will check on the partitions listed in fstab
 | 
				
			||||||
		# without errors in the output
 | 
							# without errors in the output
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -52,7 +52,7 @@ start() {
 | 
				
			|||||||
		ebegin "Changing function keys"
 | 
							ebegin "Changing function keys"
 | 
				
			||||||
		eval set -- "${keychange}"
 | 
							eval set -- "${keychange}"
 | 
				
			||||||
		eindent
 | 
							eindent
 | 
				
			||||||
		while [ $# -gt 0 ] ; do
 | 
							while [ $# -gt 0 ]; do
 | 
				
			||||||
			veinfo "F$1 -> \`$2'"
 | 
								veinfo "F$1 -> \`$2'"
 | 
				
			||||||
			kbdcontrol -f "$1" "$2" </dev/console
 | 
								kbdcontrol -f "$1" "$2" </dev/console
 | 
				
			||||||
			veend $?
 | 
								veend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ start() {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	ebegin "Configuring kernel parameters"
 | 
						ebegin "Configuring kernel parameters"
 | 
				
			||||||
	local retval=0 var= comments=
 | 
						local retval=0 var= comments=
 | 
				
			||||||
	while read var comments ; do
 | 
						while read var comments; do
 | 
				
			||||||
		case "${var}" in
 | 
							case "${var}" in
 | 
				
			||||||
			""|"#"*) continue;;
 | 
								""|"#"*) continue;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,9 +54,9 @@ setupopts() {
 | 
				
			|||||||
					TBLURB="s390"
 | 
										TBLURB="s390"
 | 
				
			||||||
					;;
 | 
										;;
 | 
				
			||||||
				*)
 | 
									*)
 | 
				
			||||||
					if [ -e /proc/devices ] && grep -q " cobd$" /proc/devices ; then
 | 
										if [ -e /proc/devices ] && grep -q " cobd$" /proc/devices; then
 | 
				
			||||||
						TBLURB="coLinux"
 | 
											TBLURB="coLinux"
 | 
				
			||||||
					elif [ "${CLOCK}" = "UTC" ] ; then
 | 
										elif [ "${CLOCK}" = "UTC" ]; then
 | 
				
			||||||
						utc="--utc"
 | 
											utc="--utc"
 | 
				
			||||||
						TBLURB="UTC"
 | 
											TBLURB="UTC"
 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
@@ -77,7 +77,7 @@ start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ebegin "Setting system clock using the hardware clock [${TBLURB}]"
 | 
						ebegin "Setting system clock using the hardware clock [${TBLURB}]"
 | 
				
			||||||
	if [ -n "${utc}" ]; then
 | 
						if [ -n "${utc}" ]; then
 | 
				
			||||||
		if [ -e /proc/modules -a ! -e /dev/rtc ] ; then
 | 
							if [ -e /proc/modules -a ! -e /dev/rtc ]; then
 | 
				
			||||||
			modprobe -q rtc || modprobe -q genrtc
 | 
								modprobe -q rtc || modprobe -q genrtc
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -120,7 +120,7 @@ stop() {
 | 
				
			|||||||
		fi
 | 
							fi
 | 
				
			||||||
		errstr="$(LC_ALL=C hwclock --systohc ${utc} ${clock_args} 2>&1 >/dev/null)"
 | 
							errstr="$(LC_ALL=C hwclock --systohc ${utc} ${clock_args} 2>&1 >/dev/null)"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if [ -n "${errstr}" ] ; then
 | 
						if [ -n "${errstr}" ]; then
 | 
				
			||||||
		ewarn "${errstr}"
 | 
							ewarn "${errstr}"
 | 
				
			||||||
		retval=1
 | 
							retval=1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@ start() {
 | 
				
			|||||||
	# Set the console font
 | 
						# Set the console font
 | 
				
			||||||
	local errmsg=
 | 
						local errmsg=
 | 
				
			||||||
	ebegin "Setting user font"
 | 
						ebegin "Setting user font"
 | 
				
			||||||
	if [ -x /bin/setfont ] ; then
 | 
						if [ -x /bin/setfont ]; then
 | 
				
			||||||
		# We patched setfont to have --tty support ...
 | 
							# We patched setfont to have --tty support ...
 | 
				
			||||||
		if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
 | 
							if [ -n "$(setfont --help 2>&1 | grep -e '--tty')" ] || \
 | 
				
			||||||
			[ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
 | 
								[ -n "$(setfont --help 2>&1 | grep -e '-C')" ]
 | 
				
			||||||
@@ -110,7 +110,7 @@ start() {
 | 
				
			|||||||
		for font in /usr/share/consolefonts/"${consolefont}".*; do :; done
 | 
							for font in /usr/share/consolefonts/"${consolefont}".*; do :; done
 | 
				
			||||||
		cp "${font}" "${RC_LIBDIR}"/console
 | 
							cp "${font}" "${RC_LIBDIR}"/console
 | 
				
			||||||
		echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font
 | 
							echo "$(basename "${font}")" > "${RC_LIBDIR}"/console/font
 | 
				
			||||||
		if yesno ${unicode:-${UNICODE}} ; then
 | 
							if yesno ${unicode:-${UNICODE}}; then
 | 
				
			||||||
			printf "" > "${RC_LIBDIR}"/console/unicode
 | 
								printf "" > "${RC_LIBDIR}"/console/unicode
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			rm -f "${RC_LIBDIR}"/console/unicode
 | 
								rm -f "${RC_LIBDIR}"/console/unicode
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ start() {
 | 
				
			|||||||
			;;
 | 
								;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${keymap}" ] ; then
 | 
						if [ -z "${keymap}" ]; then
 | 
				
			||||||
		eerror "You need to setup keymap in /etc/conf.d/keymaps first"
 | 
							eerror "You need to setup keymap in /etc/conf.d/keymaps first"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -59,7 +59,7 @@ start() {
 | 
				
			|||||||
		|| ttydev=/dev/tty
 | 
							|| ttydev=/dev/tty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Force linux keycodes for PPC.
 | 
						# Force linux keycodes for PPC.
 | 
				
			||||||
	if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
 | 
						if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then
 | 
				
			||||||
		echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
 | 
							echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -74,7 +74,7 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ebegin "Loading key mappings"
 | 
						ebegin "Loading key mappings"
 | 
				
			||||||
	if [ -x /bin/loadkeys ] ; then
 | 
						if [ -x /bin/loadkeys ]; then
 | 
				
			||||||
		yesno ${windowskeys} && wkeys="windowkeys"
 | 
							yesno ${windowskeys} && wkeys="windowkeys"
 | 
				
			||||||
		loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} 
 | 
							loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} 
 | 
				
			||||||
		eend $? "Error loading key mappings"
 | 
							eend $? "Error loading key mappings"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ load_modules() {
 | 
				
			|||||||
	eindent
 | 
						eindent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local x= cnt=0
 | 
						local x= cnt=0
 | 
				
			||||||
	for x in "$@" ; do
 | 
						for x in "$@"; do
 | 
				
			||||||
		set -- ${x}
 | 
							set -- ${x}
 | 
				
			||||||
		ebegin "Loading module $1"
 | 
							ebegin "Loading module $1"
 | 
				
			||||||
		eval modprobe -q "$@"
 | 
							eval modprobe -q "$@"
 | 
				
			||||||
@@ -92,16 +92,16 @@ start() {
 | 
				
			|||||||
		auto=/etc/modules.autoload
 | 
							auto=/etc/modules.autoload
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		local x= f="/etc/modules.autoload.d/kernel"
 | 
							local x= f="/etc/modules.autoload.d/kernel"
 | 
				
			||||||
		for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR} ; do
 | 
							for x in "${KV}" ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} ${KV_MAJOR}.${KV_MINOR}; do
 | 
				
			||||||
			if [ -f "${f}-${x}.${RC_SOFTLEVEL}" ] ; then
 | 
								if [ -f "${f}-${x}.${RC_SOFTLEVEL}" ]; then
 | 
				
			||||||
				auto="${f}-${x}.${RC_SOFTLEVEL}"
 | 
									auto="${f}-${x}.${RC_SOFTLEVEL}"
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			if [ "${RC_SOFTLEVEL}" = "${RC_BOOTLEVEL}" -a -f "${f}-${x}.${RC_DEFAULTLEVEL}" ] ; then
 | 
								if [ "${RC_SOFTLEVEL}" = "${RC_BOOTLEVEL}" -a -f "${f}-${x}.${RC_DEFAULTLEVEL}" ]; then
 | 
				
			||||||
				auto="${f}-${x}.${RC_DEFAULTLEVEL}"
 | 
									auto="${f}-${x}.${RC_DEFAULTLEVEL}"
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			if [ -f "${f}-${x}" ] ; then
 | 
								if [ -f "${f}-${x}" ]; then
 | 
				
			||||||
				auto="${f}-${x}"
 | 
									auto="${f}-${x}"
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -38,7 +38,7 @@ _setleds() {
 | 
				
			|||||||
	local dev=/dev/tty t= i=1 retval=0
 | 
						local dev=/dev/tty t= i=1 retval=0
 | 
				
			||||||
	[ -d /dev/vc ] && dev=/dev/vc/
 | 
						[ -d /dev/vc ] && dev=/dev/vc/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${i} -le ${ttyn} ] ; do
 | 
						while [ ${i} -le ${ttyn} ]; do
 | 
				
			||||||
		setleds -D "$1"num < ${dev}${i} || retval=1
 | 
							setleds -D "$1"num < ${dev}${i} || retval=1
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,7 +44,7 @@ start() {
 | 
				
			|||||||
	if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
 | 
						if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then
 | 
				
			||||||
		local usbfs=$(grep -Fow usbfs /proc/filesystems ||
 | 
							local usbfs=$(grep -Fow usbfs /proc/filesystems ||
 | 
				
			||||||
					  grep -Fow usbdevfs /proc/filesystems)
 | 
										  grep -Fow usbdevfs /proc/filesystems)
 | 
				
			||||||
		if [ -n "${usbfs}" ] ; then
 | 
							if [ -n "${usbfs}" ]; then
 | 
				
			||||||
			ebegin "Mounting USB device filesystem (${usbfs})"
 | 
								ebegin "Mounting USB device filesystem (${usbfs})"
 | 
				
			||||||
			local usbgid="$(getent group usb | \
 | 
								local usbgid="$(getent group usb | \
 | 
				
			||||||
				sed -e 's/.*:.*:\(.*\):.*/\1/')"
 | 
									sed -e 's/.*:.*:\(.*\):.*/\1/')"
 | 
				
			||||||
@@ -56,8 +56,8 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup Kernel Support for the NFS daemon status
 | 
						# Setup Kernel Support for the NFS daemon status
 | 
				
			||||||
	if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd ; then
 | 
						if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then
 | 
				
			||||||
		if grep -qs nfsd /proc/filesystems ; then
 | 
							if grep -qs nfsd /proc/filesystems; then
 | 
				
			||||||
			ebegin "Mounting nfsd filesystem"
 | 
								ebegin "Mounting nfsd filesystem"
 | 
				
			||||||
			mount -t nfsd -o nodev,noexec,nosuid \
 | 
								mount -t nfsd -o nodev,noexec,nosuid \
 | 
				
			||||||
				nfsd /proc/fs/nfsd
 | 
									nfsd /proc/fs/nfsd
 | 
				
			||||||
@@ -66,8 +66,8 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup Kernel Support for miscellaneous Binary Formats
 | 
						# Setup Kernel Support for miscellaneous Binary Formats
 | 
				
			||||||
	if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc ; then
 | 
						if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc; then
 | 
				
			||||||
		if grep -qs binfmt_misc /proc/filesystems ; then
 | 
							if grep -qs binfmt_misc /proc/filesystems; then
 | 
				
			||||||
			ebegin "Mounting misc binary format filesystem"
 | 
								ebegin "Mounting misc binary format filesystem"
 | 
				
			||||||
			mount -t binfmt_misc -o nodev,noexec,nosuid \
 | 
								mount -t binfmt_misc -o nodev,noexec,nosuid \
 | 
				
			||||||
				binfmt_misc /proc/sys/fs/binfmt_misc
 | 
									binfmt_misc /proc/sys/fs/binfmt_misc
 | 
				
			||||||
@@ -76,8 +76,8 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup Kernel Support for securityfs
 | 
						# Setup Kernel Support for securityfs
 | 
				
			||||||
	if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security ; then
 | 
						if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then
 | 
				
			||||||
		if grep -qs securityfs /proc/filesystems ; then
 | 
							if grep -qs securityfs /proc/filesystems; then
 | 
				
			||||||
			ebegin "Mounting security filesystem"
 | 
								ebegin "Mounting security filesystem"
 | 
				
			||||||
			mount -t securityfs securityfs /sys/kernel/security \
 | 
								mount -t securityfs securityfs /sys/kernel/security \
 | 
				
			||||||
				-o nodev,noexec,nosuid
 | 
									-o nodev,noexec,nosuid
 | 
				
			||||||
@@ -86,8 +86,8 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup Kernel Support for debugfs
 | 
						# Setup Kernel Support for debugfs
 | 
				
			||||||
	if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug ; then
 | 
						if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then
 | 
				
			||||||
		if grep -qs debugfs /proc/filesystems ; then
 | 
							if grep -qs debugfs /proc/filesystems; then
 | 
				
			||||||
			ebegin "Mounting debug filesystem"
 | 
								ebegin "Mounting debug filesystem"
 | 
				
			||||||
			mount -t debugfs debugfs /sys/kernel/debug \
 | 
								mount -t debugfs debugfs /sys/kernel/debug \
 | 
				
			||||||
				-o nodev,noexec,nosuid
 | 
									-o nodev,noexec,nosuid
 | 
				
			||||||
@@ -96,8 +96,8 @@ start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup Kernel Support for SELinux
 | 
						# Setup Kernel Support for SELinux
 | 
				
			||||||
	if [ -d /selinux ] && ! mountinfo -q /selinux ; then
 | 
						if [ -d /selinux ] && ! mountinfo -q /selinux; then
 | 
				
			||||||
		if grep -qs selinuxfs /proc/filesystems ; then
 | 
							if grep -qs selinuxfs /proc/filesystems; then
 | 
				
			||||||
			ebegin "Mounting SELinux filesystem"
 | 
								ebegin "Mounting SELinux filesystem"
 | 
				
			||||||
			mount -t selinuxfs selinuxfs /selinux
 | 
								mount -t selinuxfs selinuxfs /selinux
 | 
				
			||||||
			eend $?
 | 
								eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -96,8 +96,8 @@ start_pre() {
 | 
				
			|||||||
			local getuser="stat -f%Su"
 | 
								local getuser="stat -f%Su"
 | 
				
			||||||
			[ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U"
 | 
								[ "${RC_UNAME}" = "Linux" ] && getuser="stat -c%U"
 | 
				
			||||||
			case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in
 | 
								case $(${getuser} "${named_chroot}${namedb}"/rndc.key) in
 | 
				
			||||||
				root|"${named_uid}") ;;
 | 
									root|"${named_uid}");;
 | 
				
			||||||
				*) ${confgen} ;;
 | 
									*) ${confgen};;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			${confgen}
 | 
								${confgen}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,7 +34,7 @@ name="Network Time Protocol Daemon"
 | 
				
			|||||||
depend() {
 | 
					depend() {
 | 
				
			||||||
	use dns
 | 
						use dns
 | 
				
			||||||
	need localmount
 | 
						need localmount
 | 
				
			||||||
	after bootmisc ntpdate ntp-client
 | 
						after bootmisc ntp-client
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
start_pre() {
 | 
					start_pre() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@
 | 
				
			|||||||
command=/usr/sbin/sshd
 | 
					command=/usr/sbin/sshd
 | 
				
			||||||
command_args=${sshd_args}
 | 
					command_args=${sshd_args}
 | 
				
			||||||
pidfile=/var/run/sshd.pid
 | 
					pidfile=/var/run/sshd.pid
 | 
				
			||||||
required_files=/etc/sshd/sshd_config
 | 
					required_files=/etc/ssh/sshd_config
 | 
				
			||||||
required_dirs=/var/empty
 | 
					required_dirs=/var/empty
 | 
				
			||||||
 | 
					
 | 
				
			||||||
depend() {
 | 
					depend() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,12 +37,12 @@ do_checkfs() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ebegin "Checking all filesystems"
 | 
						ebegin "Checking all filesystems"
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if  [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
 | 
						if  [ -e /forcefsck ] || get_bootparam "forcefsck"; then
 | 
				
			||||||
		ewarn "A full fsck has been forced"
 | 
							ewarn "A full fsck has been forced"
 | 
				
			||||||
		mode="-f -n"
 | 
							mode="-f -n"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
						if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
		opts="-A -C0 -R -T"
 | 
							opts="-A -C0 -R -T"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		parts="$(fstabinfo --passno ">1")"
 | 
							parts="$(fstabinfo --passno ">1")"
 | 
				
			||||||
@@ -52,14 +52,14 @@ do_checkfs() {
 | 
				
			|||||||
	fsck ${opts} ${mode} ${parts}
 | 
						fsck ${opts} ${mode} ${parts}
 | 
				
			||||||
	retval=$?
 | 
						retval=$?
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if [ ${retval} -eq 0 ] ; then
 | 
						if [ ${retval} -eq 0 ]; then
 | 
				
			||||||
		eend 0
 | 
							eend 0
 | 
				
			||||||
	elif [ ${retval} -eq 1 ] ; then
 | 
						elif [ ${retval} -eq 1 ]; then
 | 
				
			||||||
		ewend 1 "Filesystem errors corrected."
 | 
							ewend 1 "Filesystem errors corrected."
 | 
				
			||||||
		retval=0
 | 
							retval=0
 | 
				
			||||||
	elif [ ${retval} -eq 2 ] ; then
 | 
						elif [ ${retval} -eq 2 ]; then
 | 
				
			||||||
		ewend 1 "System should be rebooted"
 | 
							ewend 1 "System should be rebooted"
 | 
				
			||||||
	elif [ ${retval} -eq 8 ] ; then
 | 
						elif [ ${retval} -eq 8 ]; then
 | 
				
			||||||
		ewend 1 "Operational error, continuing"
 | 
							ewend 1 "Operational error, continuing"
 | 
				
			||||||
		retval=0
 | 
							retval=0
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@@ -70,7 +70,7 @@ do_checkfs() {
 | 
				
			|||||||
			eend ${retval}
 | 
								eend ${retval}
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ ${retval} -gt 3 ] ; then
 | 
							if [ ${retval} -gt 3 ]; then
 | 
				
			||||||
			eend 2 "Fsck could not correct all errors, manual repair needed"
 | 
								eend 2 "Fsck could not correct all errors, manual repair needed"
 | 
				
			||||||
			exec rc-abort || exit 1
 | 
								exec rc-abort || exit 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@ and optionally repair them."
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
do_mtab() {
 | 
					do_mtab() {
 | 
				
			||||||
	# Don't create mtab if /etc is readonly
 | 
						# Don't create mtab if /etc is readonly
 | 
				
			||||||
	if ! printf "" 2>/dev/null >/etc/mtab ; then
 | 
						if ! printf "" 2>/dev/null >/etc/mtab; then
 | 
				
			||||||
		ewarn "Skipping /etc/mtab initialization (ro root?)"
 | 
							ewarn "Skipping /etc/mtab initialization (ro root?)"
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -59,7 +59,7 @@ do_fsck() {
 | 
				
			|||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Don't bother doing a fsck on these
 | 
						# Don't bother doing a fsck on these
 | 
				
			||||||
	if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs / ; then
 | 
						if [ -n "${CDBOOT}" ] || is_net_fs / || is_union_fs /; then
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -71,7 +71,7 @@ do_fsck() {
 | 
				
			|||||||
	root=$(fstabinfo --blockdevice /)
 | 
						root=$(fstabinfo --blockdevice /)
 | 
				
			||||||
	[ ! -e "${root}" -a -e /dev/root ] && root=/dev/root
 | 
						[ ! -e "${root}" -a -e /dev/root ] && root=/dev/root
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -e /forcefsck ] || get_bootparam "forcefsck" ; then
 | 
						if [ -e /forcefsck ] || get_bootparam "forcefsck"; then
 | 
				
			||||||
		ebegin "Checking root filesystem (full fsck forced)"
 | 
							ebegin "Checking root filesystem (full fsck forced)"
 | 
				
			||||||
		fsck ${opts} -f -n "${root}"
 | 
							fsck ${opts} -f -n "${root}"
 | 
				
			||||||
		# /forcefsck isn't deleted because checkfs needs it.
 | 
							# /forcefsck isn't deleted because checkfs needs it.
 | 
				
			||||||
@@ -80,7 +80,7 @@ do_fsck() {
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		# Obey the fs_passno setting for / (see fstab(5))
 | 
							# Obey the fs_passno setting for / (see fstab(5))
 | 
				
			||||||
		local pass=$(fstabinfo --passno /)
 | 
							local pass=$(fstabinfo --passno /)
 | 
				
			||||||
		if [ ${pass:-0} != "0" ] ; then
 | 
							if [ ${pass:-0} != "0" ]; then
 | 
				
			||||||
			ebegin "Checking root filesystem"
 | 
								ebegin "Checking root filesystem"
 | 
				
			||||||
			fsck ${opts} -p "${root}"
 | 
								fsck ${opts} -p "${root}"
 | 
				
			||||||
			retval=$?
 | 
								retval=$?
 | 
				
			||||||
@@ -90,15 +90,15 @@ do_fsck() {
 | 
				
			|||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ${retval} -eq 0 ] ; then
 | 
						if [ ${retval} -eq 0 ]; then
 | 
				
			||||||
		eend 0
 | 
							eend 0
 | 
				
			||||||
	elif [ ${retval} -eq 1 ] ; then
 | 
						elif [ ${retval} -eq 1 ]; then
 | 
				
			||||||
		ewend 1 "Filesystem repaired"
 | 
							ewend 1 "Filesystem repaired"
 | 
				
			||||||
		retval=0
 | 
							retval=0
 | 
				
			||||||
	elif [ ${retval} -eq 8 ] ; then
 | 
						elif [ ${retval} -eq 8 ]; then
 | 
				
			||||||
		ewend 1 $"Operational error, continuing"
 | 
							ewend 1 $"Operational error, continuing"
 | 
				
			||||||
		retval=0
 | 
							retval=0
 | 
				
			||||||
	elif [ ${retval} -eq 2 -o ${retval} -eq 3 ] ; then
 | 
						elif [ ${retval} -eq 2 -o ${retval} -eq 3 ]; then
 | 
				
			||||||
		ewend 1 "Filesystem repaired, but reboot needed!"
 | 
							ewend 1 "Filesystem repaired, but reboot needed!"
 | 
				
			||||||
		if ! yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
 | 
							if ! yesno ${rc_force_auto:-${RC_FORCE_AUTO}}; then
 | 
				
			||||||
			printf "\a"; sleep 1; printf "\a"; sleep 1
 | 
								printf "\a"; sleep 1; printf "\a"; sleep 1
 | 
				
			||||||
@@ -117,9 +117,9 @@ do_fsck() {
 | 
				
			|||||||
			eend 2 "Filesystem couldn't be fixed :("
 | 
								eend 2 "Filesystem couldn't be fixed :("
 | 
				
			||||||
			exec rc-abort || exit 1
 | 
								exec rc-abort || exit 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if [ ${retval} != "0" ] ; then
 | 
							if [ ${retval} != "0" ]; then
 | 
				
			||||||
			einfo "Unmounting filesystems"
 | 
								einfo "Unmounting filesystems"
 | 
				
			||||||
			if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
								if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
				mount -a -o remount,ro /
 | 
									mount -a -o remount,ro /
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				mount -u -o ro /
 | 
									mount -u -o ro /
 | 
				
			||||||
@@ -135,7 +135,7 @@ start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if ! root_rw; then
 | 
						if ! root_rw; then
 | 
				
			||||||
		ebegin "Remounting root filesystem read/write"
 | 
							ebegin "Remounting root filesystem read/write"
 | 
				
			||||||
		if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
							if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
			mount -n -o remount,rw /
 | 
								mount -n -o remount,rw /
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			mount -u -o rw /
 | 
								mount -u -o rw /
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,7 +29,7 @@
 | 
				
			|||||||
[ -r /etc/rc.conf ] && . /etc/rc.conf
 | 
					[ -r /etc/rc.conf ] && . /etc/rc.conf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Support LiveCD foo
 | 
					# Support LiveCD foo
 | 
				
			||||||
if [ -r /sbin/livecd-functions.sh ] ; then
 | 
					if [ -r /sbin/livecd-functions.sh ]; then
 | 
				
			||||||
	. /sbin/livecd-functions.sh
 | 
						. /sbin/livecd-functions.sh
 | 
				
			||||||
	livecd_read_commandline
 | 
						livecd_read_commandline
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -38,7 +38,7 @@ stop_addon devfs
 | 
				
			|||||||
stop_addon udev
 | 
					stop_addon udev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Really kill things off before unmounting
 | 
					# Really kill things off before unmounting
 | 
				
			||||||
if [ -x /sbin/killall5 ] ; then
 | 
					if [ -x /sbin/killall5 ]; then
 | 
				
			||||||
	killall5 -15
 | 
						killall5 -15
 | 
				
			||||||
	killall5 -9
 | 
						killall5 -9
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
@@ -50,7 +50,7 @@ sync; sync
 | 
				
			|||||||
#   1) we don't need (and by default can't) umount anything (VServer) or
 | 
					#   1) we don't need (and by default can't) umount anything (VServer) or
 | 
				
			||||||
#   2) the host utils take care of all umounting stuff (OpenVZ)
 | 
					#   2) the host utils take care of all umounting stuff (OpenVZ)
 | 
				
			||||||
if [ "${RC_SYS}" = "VPS" ]; then
 | 
					if [ "${RC_SYS}" = "VPS" ]; then
 | 
				
			||||||
	if [ -e /etc/init.d/"$1".sh ] ; then
 | 
						if [ -e /etc/init.d/"$1".sh ]; then
 | 
				
			||||||
		. /etc/init.d/"$1".sh
 | 
							. /etc/init.d/"$1".sh
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		exit 0
 | 
							exit 0
 | 
				
			||||||
@@ -60,11 +60,11 @@ fi
 | 
				
			|||||||
# If $svcdir is still mounted, preserve it if we can
 | 
					# If $svcdir is still mounted, preserve it if we can
 | 
				
			||||||
 | 
					
 | 
				
			||||||
mnt=$(mountinfo --node "${RC_SVCDIR}")
 | 
					mnt=$(mountinfo --node "${RC_SVCDIR}")
 | 
				
			||||||
if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ] ; then
 | 
					if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ]; then
 | 
				
			||||||
	f_opts="-m -c"
 | 
						f_opts="-m -c"
 | 
				
			||||||
	[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
 | 
						[ "${RC_UNAME}" = "Linux" ] && f_opts="-c"
 | 
				
			||||||
	if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ] ; then
 | 
						if [ -n "$(fuser ${f_opts} "${svcdir}" 2>/dev/null)" ]; then
 | 
				
			||||||
		fuser -k ${f_opts} "${svcdir}" 1>/dev/null 2>/dev/null
 | 
							fuser -k ${f_opts} "${svcdir}" >/dev/null 2>&1
 | 
				
			||||||
		sleep 2
 | 
							sleep 2
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
 | 
						cp -p "${RC_SVCDIR}"/deptree "${RC_SVCDIR}"/depconfig \
 | 
				
			||||||
@@ -83,20 +83,20 @@ if [ -n "${mnt}" -a -w "${RC_LIBDIR}" ] ; then
 | 
				
			|||||||
		"${RC_LIBDIR}"/rc.log
 | 
							"${RC_LIBDIR}"/rc.log
 | 
				
			||||||
	# Release the memory disk if we used it
 | 
						# Release the memory disk if we used it
 | 
				
			||||||
	case "${mnt}" in
 | 
						case "${mnt}" in
 | 
				
			||||||
		"/dev/md"[0-9]*) mdconfig -d -u "${mnt#/dev/md*}" ;;
 | 
							"/dev/md"[0-9]*) mdconfig -d -u "${mnt#/dev/md*}";;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unmounted=0
 | 
					unmounted=0
 | 
				
			||||||
# Remount the remaining filesystems read-only
 | 
					# Remount the remaining filesystems read-only
 | 
				
			||||||
# Most BSD's don't need this as the kernel handles it nicely
 | 
					# Most BSD's don't need this as the kernel handles it nicely
 | 
				
			||||||
if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
					if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
	ebegin "Remounting remaining filesystems read-only"
 | 
						ebegin "Remounting remaining filesystems read-only"
 | 
				
			||||||
	# We need the do_unmount function
 | 
						# We need the do_unmount function
 | 
				
			||||||
	. "${RC_LIBDIR}"/sh/rc-mount.sh
 | 
						. "${RC_LIBDIR}"/sh/rc-mount.sh
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
	fs=
 | 
						fs=
 | 
				
			||||||
	for x in ${net_fs_list} ; do
 | 
						for x in ${net_fs_list}; do
 | 
				
			||||||
		fs="${fs}${fs:+|}${x}"
 | 
							fs="${fs}${fs:+|}${x}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	[ -n "${fs}" ] && fs="^(${fs})$"
 | 
						[ -n "${fs}" ] && fs="^(${fs})$"
 | 
				
			||||||
@@ -109,14 +109,14 @@ if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# This UPS code should be moved to out of here and to an addon
 | 
					# This UPS code should be moved to out of here and to an addon
 | 
				
			||||||
if [ -f /etc/killpower ] ; then
 | 
					if [ -f /etc/killpower ]; then
 | 
				
			||||||
	UPS_CTL=/sbin/upsdrvctl
 | 
						UPS_CTL=/sbin/upsdrvctl
 | 
				
			||||||
	UPS_POWERDOWN="${UPS_CTL} shutdown"
 | 
						UPS_POWERDOWN="${UPS_CTL} shutdown"
 | 
				
			||||||
elif [ -f /etc/apcupsd/powerfail ] ; then
 | 
					elif [ -f /etc/apcupsd/powerfail ]; then
 | 
				
			||||||
	UPS_CTL=/etc/apcupsd/apccontrol
 | 
						UPS_CTL=/etc/apcupsd/apccontrol
 | 
				
			||||||
	UPS_POWERDOWN="${UPS_CTL} killpower"
 | 
						UPS_POWERDOWN="${UPS_CTL} killpower"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [ -x "${UPS_CTL}" ] ; then
 | 
					if [ -x "${UPS_CTL}" ]; then
 | 
				
			||||||
	ewarn "Signalling ups driver(s) to kill the load!"
 | 
						ewarn "Signalling ups driver(s) to kill the load!"
 | 
				
			||||||
	${UPS_POWERDOWN}
 | 
						${UPS_POWERDOWN}
 | 
				
			||||||
	ewarn "Halt system and wait for the UPS to kill our power"
 | 
						ewarn "Halt system and wait for the UPS to kill our power"
 | 
				
			||||||
@@ -124,7 +124,7 @@ if [ -x "${UPS_CTL}" ] ; then
 | 
				
			|||||||
	sleep 60
 | 
						sleep 60
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ ${unmounted} -ne 0 ] ; then
 | 
					if [ ${unmounted} -ne 0 ]; then
 | 
				
			||||||
	[ -x /sbin/sulogin ] && sulogin -t 10 /dev/console
 | 
						[ -x /sbin/sulogin ] && sulogin -t 10 /dev/console
 | 
				
			||||||
	exit 1
 | 
						exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Add any misc programs that should be started
 | 
						# Add any misc programs that should be started
 | 
				
			||||||
	# to /etc/conf.d/local.start
 | 
						# to /etc/conf.d/local.start
 | 
				
			||||||
	if [ -e /etc/conf.d/local.start ] ; then
 | 
						if [ -e /etc/conf.d/local.start ]; then
 | 
				
			||||||
		. /etc/conf.d/local.start
 | 
							. /etc/conf.d/local.start
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -48,7 +48,7 @@ stop() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Add any misc programs that should be stopped
 | 
						# Add any misc programs that should be stopped
 | 
				
			||||||
	# to /etc/conf.d/local.stop
 | 
						# to /etc/conf.d/local.stop
 | 
				
			||||||
	if [ -e /etc/conf.d/local.stop ] ; then
 | 
						if [ -e /etc/conf.d/local.stop ]; then
 | 
				
			||||||
		. /etc/conf.d/local.stop
 | 
							. /etc/conf.d/local.stop
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,7 +58,7 @@ stop() {
 | 
				
			|||||||
	for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
 | 
						for x in ${no_umounts} ${RC_NO_UMOUNTS}; do
 | 
				
			||||||
		no_umounts="${no_umounts}|${x}"
 | 
							no_umounts="${no_umounts}|${x}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	if [ "${SIFS}" = "y" ] ; then
 | 
						if [ "${SIFS}" = "y" ]; then
 | 
				
			||||||
		IFS=$OIFS
 | 
							IFS=$OIFS
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -30,9 +30,9 @@ need_portmap() {
 | 
				
			|||||||
	local mnt opts ret IFS="
 | 
						local mnt opts ret IFS="
 | 
				
			||||||
"
 | 
					"
 | 
				
			||||||
	set -- $(fstabinfo --fstype nfs,nfs4)
 | 
						set -- $(fstabinfo --fstype nfs,nfs4)
 | 
				
			||||||
	for mnt in "$@" ; do
 | 
						for mnt in "$@"; do
 | 
				
			||||||
		case ,$(fstabinfo --options "${mnt}"), in
 | 
							case ,$(fstabinfo --options "${mnt}"), in
 | 
				
			||||||
			*,noauto,*|*,nolock,*) ;;
 | 
								*,noauto,*|*,nolock,*);;
 | 
				
			||||||
			*) return 0;;
 | 
								*) return 0;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -89,7 +89,7 @@ stop() {
 | 
				
			|||||||
	ebegin "Unmounting network filesystems"
 | 
						ebegin "Unmounting network filesystems"
 | 
				
			||||||
	. "${RC_LIBDIR}/sh/rc-mount.sh"
 | 
						. "${RC_LIBDIR}/sh/rc-mount.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for x in ${net_fs_list} ; do
 | 
						for x in ${net_fs_list}; do
 | 
				
			||||||
		fs="${fs}${fs:+,}${x}"
 | 
							fs="${fs}${fs:+,}${x}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	if [ -n "${fs}" ]; then
 | 
						if [ -n "${fs}" ]; then
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ depend() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
start() {
 | 
					start() {
 | 
				
			||||||
	if [ -f /etc/nologin.boot ] ; then
 | 
						if [ -f /etc/nologin.boot ]; then
 | 
				
			||||||
		rm -f /etc/nologin /etc/nologin.boot
 | 
							rm -f /etc/nologin /etc/nologin.boot
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ depend() {
 | 
				
			|||||||
save_seed() {
 | 
					save_seed() {
 | 
				
			||||||
	local poolsize=1
 | 
						local poolsize=1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -e /proc/sys/kernel/random/poolsize ] ; then
 | 
						if [ -e /proc/sys/kernel/random/poolsize ]; then
 | 
				
			||||||
		poolsize=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
 | 
							poolsize=$(($(cat /proc/sys/kernel/random/poolsize) / 4096))
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,7 +47,7 @@ save_seed() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
start() {
 | 
					start() {
 | 
				
			||||||
	[ -c /dev/urandom ] || return
 | 
						[ -c /dev/urandom ] || return
 | 
				
			||||||
	if [ -f "${urandom_seed}" ] ; then
 | 
						if [ -f "${urandom_seed}" ]; then
 | 
				
			||||||
		ebegin "Initializing random number generator"
 | 
							ebegin "Initializing random number generator"
 | 
				
			||||||
		cat "${urandom_seed}" > /dev/urandom
 | 
							cat "${urandom_seed}" > /dev/urandom
 | 
				
			||||||
		eend $? "Error initializing random number generator"
 | 
							eend $? "Error initializing random number generator"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ ifconfig_depend() {
 | 
				
			|||||||
_exists() {
 | 
					_exists() {
 | 
				
			||||||
	# Only FreeBSD sees to have /dev/net .... is there something
 | 
						# Only FreeBSD sees to have /dev/net .... is there something
 | 
				
			||||||
	# other than ifconfig we can use for the others?
 | 
						# other than ifconfig we can use for the others?
 | 
				
			||||||
	if [ -d /dev/net ] ; then
 | 
						if [ -d /dev/net ]; then
 | 
				
			||||||
		[ -e /dev/net/"${IFACE}" ]
 | 
							[ -e /dev/net/"${IFACE}" ]
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		ifconfig "${IFACE}" >/dev/null 2>&1
 | 
							ifconfig "${IFACE}" >/dev/null 2>&1
 | 
				
			||||||
@@ -43,10 +43,10 @@ _get_mac_address() {
 | 
				
			|||||||
	sed -n -e 's/^[[:space:]]*ether \(..:..:..:..:..:..\).*/\1/p')
 | 
						sed -n -e 's/^[[:space:]]*ether \(..:..:..:..:..:..\).*/\1/p')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "${mac}" in
 | 
						case "${mac}" in
 | 
				
			||||||
		00:00:00:00:00:00) ;;
 | 
							00:00:00:00:00:00);;
 | 
				
			||||||
		44:44:44:44:44:44) ;;
 | 
							44:44:44:44:44:44);;
 | 
				
			||||||
		FF:FF:FF:FF:FF:FF) ;;
 | 
							FF:FF:FF:FF:FF:FF);;
 | 
				
			||||||
		*) echo "${mac}"; return 0 ;;
 | 
							*) echo "${mac}"; return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1
 | 
						return 1
 | 
				
			||||||
@@ -64,8 +64,8 @@ _ifindex() {
 | 
				
			|||||||
	local x= i=1
 | 
						local x= i=1
 | 
				
			||||||
	case "${RC_UNAME}" in
 | 
						case "${RC_UNAME}" in
 | 
				
			||||||
		FreeBSD|DragonFly)
 | 
							FreeBSD|DragonFly)
 | 
				
			||||||
			for x in /dev/net[0-9]* ; do
 | 
								for x in /dev/net[0-9]*; do
 | 
				
			||||||
				if [ "${x}" -ef /dev/net/"${IFACE}" ] ; then
 | 
									if [ "${x}" -ef /dev/net/"${IFACE}" ]; then
 | 
				
			||||||
					echo "${x#/dev/net}"
 | 
										echo "${x#/dev/net}"
 | 
				
			||||||
					return 0
 | 
										return 0
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
@@ -73,8 +73,8 @@ _ifindex() {
 | 
				
			|||||||
			done
 | 
								done
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
		default)
 | 
							default)
 | 
				
			||||||
			for x in $(ifconfig -a | sed -n -e 's/^\([^[:space:]]*\):.*/\1/p') ; do
 | 
								for x in $(ifconfig -a | sed -n -e 's/^\([^[:space:]]*\):.*/\1/p'); do
 | 
				
			||||||
				if [ "${x}" = "${IFACE}" ] ; then
 | 
									if [ "${x}" = "${IFACE}" ]; then
 | 
				
			||||||
					echo "${i}"
 | 
										echo "${i}"
 | 
				
			||||||
					return 0
 | 
										return 0
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
@@ -107,10 +107,10 @@ _add_address() {
 | 
				
			|||||||
	local inet6=
 | 
						local inet6=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "$@" in
 | 
						case "$@" in
 | 
				
			||||||
		*:*) inet6=inet6 ;;
 | 
							*:*) inet6=inet6;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${metric:-0}" != "0" ] ; then
 | 
						if [ "${metric:-0}" != "0" ]; then
 | 
				
			||||||
		set -- "$@" metric ${metric}
 | 
							set -- "$@" metric ${metric}
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -130,32 +130,32 @@ _add_address() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_add_route() {
 | 
					_add_route() {
 | 
				
			||||||
	if [ $# -gt 3 ] ; then
 | 
						if [ $# -gt 3 ]; then
 | 
				
			||||||
		if [ "$3" = "gw" -o "$3" = "via" ] ; then
 | 
							if [ "$3" = "gw" -o "$3" = "via" ]; then
 | 
				
			||||||
			local one=$1 two=$2
 | 
								local one=$1 two=$2
 | 
				
			||||||
			shift ; shift; shift
 | 
								shift; shift; shift
 | 
				
			||||||
			set -- "${one}" "${two}" "$@"
 | 
								set -- "${one}" "${two}" "$@"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "$@" in
 | 
						case "$@" in
 | 
				
			||||||
		*:*) route add -inet6 "$@" ;;
 | 
							*:*) route add -inet6 "$@";;
 | 
				
			||||||
		*)   route add        "$@" ;;
 | 
							*)   route add        "$@";;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_delete_addresses() {
 | 
					_delete_addresses() {
 | 
				
			||||||
	# We don't remove addresses from aliases
 | 
						# We don't remove addresses from aliases
 | 
				
			||||||
	case "${IFACE}" in
 | 
						case "${IFACE}" in
 | 
				
			||||||
		*:*) return 0 ;;
 | 
							*:*) return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	einfo "Removing addresses"
 | 
						einfo "Removing addresses"
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
	local addr=
 | 
						local addr=
 | 
				
			||||||
	for addr in $(LC_ALL=C ifconfig "${IFACE}" |
 | 
						for addr in $(LC_ALL=C ifconfig "${IFACE}" |
 | 
				
			||||||
		sed -n -e 's/^[[:space:]]*inet \([^ ]*\).*/\1/p') ; do
 | 
							sed -n -e 's/^[[:space:]]*inet \([^ ]*\).*/\1/p'); do
 | 
				
			||||||
		if [ "${addr}" = "127.0.0.1" ] ; then
 | 
							if [ "${addr}" = "127.0.0.1" ]; then
 | 
				
			||||||
			# Don't delete the loopback address
 | 
								# Don't delete the loopback address
 | 
				
			||||||
			[ "$1" = "lo" -o "$1" = "lo0" ] && continue
 | 
								[ "$1" = "lo" -o "$1" = "lo0" ] && continue
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -166,10 +166,10 @@ _delete_addresses() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Remove IPv6 addresses
 | 
						# Remove IPv6 addresses
 | 
				
			||||||
	for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
 | 
						for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
 | 
				
			||||||
		sed -n -e 's/^[[:space:]]*inet6 \([^ ]*\).*/\1/p') ; do
 | 
							sed -n -e 's/^[[:space:]]*inet6 \([^ ]*\).*/\1/p'); do
 | 
				
			||||||
		case "${addr}" in
 | 
							case "${addr}" in
 | 
				
			||||||
			*"%${IFACE}") continue ;;
 | 
								*"%${IFACE}") continue;;
 | 
				
			||||||
			::1) continue ;;
 | 
								::1) continue;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		einfo "${addr}"
 | 
							einfo "${addr}"
 | 
				
			||||||
		ifconfig "${IFACE}" inet6 delete "${addr}"
 | 
							ifconfig "${IFACE}" inet6 delete "${addr}"
 | 
				
			||||||
@@ -203,11 +203,11 @@ ifconfig_pre_start() {
 | 
				
			|||||||
		args=
 | 
							args=
 | 
				
			||||||
		for arg in ${conf}; do
 | 
							for arg in ${conf}; do
 | 
				
			||||||
			case ${arg} in
 | 
								case ${arg} in
 | 
				
			||||||
				[Dd][Hh][Cc][Pp]) ;;
 | 
									[Dd][Hh][Cc][Pp]);;
 | 
				
			||||||
				[Nn][Oo][Aa][Uu][Tt][Oo]) ;;
 | 
									[Nn][Oo][Aa][Uu][Tt][Oo]);;
 | 
				
			||||||
				[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
 | 
									[Nn][Oo][Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]);;
 | 
				
			||||||
				[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]) ;;
 | 
									[Ss][Yy][Nn][Cc][Dd][Hh][Cc][Pp]);;
 | 
				
			||||||
				[Ww][Pp][Aa]) ;;
 | 
									[Ww][Pp][Aa]);;
 | 
				
			||||||
				*) args="${args} ${arg}";;
 | 
									*) args="${args} ${arg}";;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ iwconfig_get_wep_status() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
_iwconfig_get() {
 | 
					_iwconfig_get() {
 | 
				
			||||||
	LC_ALL=C ifconfig "${IFACE}" | \
 | 
						LC_ALL=C ifconfig "${IFACE}" | \
 | 
				
			||||||
	sed -n -e "s/^[[:space:]]*ssid \(.*\) channel \([0-9]*\) bssid \(..:..:..:..:..:..\)\$/\\$1/p"
 | 
						sed -n -e "s/^[[:space:]]*ssid \(.*\) channel \([0-9]*\).* bssid \(..:..:..:..:..:..\)\$/\\$1/p"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_get_ssid() {
 | 
					_get_ssid() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -28,8 +28,9 @@ apipa_depend() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_random() {
 | 
					_random() {
 | 
				
			||||||
	if [ -n "${BASH}" ] ; then
 | 
						local r=${RANDOM}
 | 
				
			||||||
		echo "${RANDOM}"
 | 
						if [ -n "${r}" ]; then
 | 
				
			||||||
 | 
							echo "${r}"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		uuidgen | sed -n -e 's/[^[:digit:]]//g' -e 's/\(^.\{1,7\}\).*/\1/p'
 | 
							uuidgen | sed -n -e 's/[^[:digit:]]//g' -e 's/\(^.\{1,7\}\).*/\1/p'
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -49,7 +50,7 @@ apipa_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		addr="169.254.${i1}.${i2}"
 | 
							addr="169.254.${i1}.${i2}"
 | 
				
			||||||
		vebegin "${addr}/16"
 | 
							vebegin "${addr}/16"
 | 
				
			||||||
		if ! arping_address "${addr}" ; then
 | 
							if ! arping_address "${addr}"; then
 | 
				
			||||||
			eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
 | 
								eval config_${config_index}="\"${addr}/16 broadcast 169.254.255.255\""
 | 
				
			||||||
			config_index=$((${config_index} - 1))
 | 
								config_index=$((${config_index} - 1))
 | 
				
			||||||
			veend 0
 | 
								veend 0
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,9 +33,9 @@ arping_address() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# We only handle IPv4 addresses
 | 
						# We only handle IPv4 addresses
 | 
				
			||||||
	case "${ip}" in
 | 
						case "${ip}" in
 | 
				
			||||||
		0.0.0.0|0) return 1 ;;
 | 
							0.0.0.0|0) return 1;;
 | 
				
			||||||
		*.*.*.*) ;;
 | 
							*.*.*.*);;
 | 
				
			||||||
		*) return 1 ;;
 | 
							*) return 1;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We need to bring the interface up to test
 | 
						# We need to bring the interface up to test
 | 
				
			||||||
@@ -64,8 +64,8 @@ arping_address() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
	[ -z "${foundmac}" ] && return 1
 | 
						[ -z "${foundmac}" ] && return 1
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if [ -n "${mac}" ] ; then
 | 
						if [ -n "${mac}" ]; then
 | 
				
			||||||
		if [ "${mac}" != "${foundmac}" ] ; then
 | 
							if [ "${mac}" != "${foundmac}" ]; then
 | 
				
			||||||
			vewarn "Found ${ip} but MAC ${foundmac} does not match"
 | 
								vewarn "Found ${ip} but MAC ${foundmac} does not match"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -86,7 +86,7 @@ arping_start() {
 | 
				
			|||||||
	einfo "Pinging gateways on ${IFACE} for configuration"
 | 
						einfo "Pinging gateways on ${IFACE} for configuration"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eval gateways=\$gateways_${IFVAR}
 | 
						eval gateways=\$gateways_${IFVAR}
 | 
				
			||||||
	if [ -z "${gateways}" ] ; then
 | 
						if [ -z "${gateways}" ]; then
 | 
				
			||||||
		eerror "No gateways have been defined (gateways_${IFVAR}=\"...\")"
 | 
							eerror "No gateways have been defined (gateways_${IFVAR}=\"...\")"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -99,18 +99,18 @@ arping_start() {
 | 
				
			|||||||
		local ip=$1 mac=$2 spoof=$3 extra=
 | 
							local ip=$1 mac=$2 spoof=$3 extra=
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ -n "${mac}" ] ; then
 | 
							if [ -n "${mac}" ]; then
 | 
				
			||||||
			mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')"
 | 
								mac="$(echo "${mac}" | tr '[:lower:]' '[:upper:]')"
 | 
				
			||||||
			extra="(MAC ${mac})"
 | 
								extra="(MAC ${mac})"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		vebegin "${ip} ${extra}"
 | 
							vebegin "${ip} ${extra}"
 | 
				
			||||||
		if arping_address "${ip}" "${mac}" "${spoof}" ; then
 | 
							if arping_address "${ip}" "${mac}" "${spoof}"; then
 | 
				
			||||||
			local IFS=.
 | 
								local IFS=.
 | 
				
			||||||
			for i in ${ip} ; do
 | 
								for i in ${ip}; do
 | 
				
			||||||
				if [ "${#i}" = "2" ] ; then
 | 
									if [ "${#i}" = "2" ]; then
 | 
				
			||||||
					conf="${conf}0${i}"
 | 
										conf="${conf}0${i}"
 | 
				
			||||||
				elif [ "${#i}" = "1" ] ; then
 | 
									elif [ "${#i}" = "1" ]; then
 | 
				
			||||||
					conf="${conf}00${i}"
 | 
										conf="${conf}00${i}"
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					conf="${conf}${i}"
 | 
										conf="${conf}${i}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,8 +40,8 @@ bonding_pre_start() {
 | 
				
			|||||||
	[ -z "${slaves}" ] && return 0
 | 
						[ -z "${slaves}" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Load the kernel module if required
 | 
						# Load the kernel module if required
 | 
				
			||||||
	if [ ! -d /proc/net/bonding ] ; then
 | 
						if [ ! -d /proc/net/bonding ]; then
 | 
				
			||||||
		if ! modprobe bonding ; then
 | 
							if ! modprobe bonding; then
 | 
				
			||||||
			eerror "Cannot load the bonding module"
 | 
								eerror "Cannot load the bonding module"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -49,12 +49,12 @@ bonding_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# We can create the interface name we like now, but this
 | 
						# We can create the interface name we like now, but this
 | 
				
			||||||
	# requires sysfs
 | 
						# requires sysfs
 | 
				
			||||||
	if ! _exists && [ -d /sys/class/net ] ; then
 | 
						if ! _exists && [ -d /sys/class/net ]; then
 | 
				
			||||||
		echo "+${IFACE}" > /sys/class/net/bonding_masters
 | 
							echo "+${IFACE}" > /sys/class/net/bonding_masters
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	_exists true || return 1
 | 
						_exists true || return 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! _is_bond ; then
 | 
						if ! _is_bond; then
 | 
				
			||||||
		eerror "${IFACE} is not capable of bonding"
 | 
							eerror "${IFACE} is not capable of bonding"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -107,7 +107,7 @@ bonding_stop() {
 | 
				
			|||||||
	# reset all slaves
 | 
						# reset all slaves
 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
	for IFACE in ${slaves}; do
 | 
						for IFACE in ${slaves}; do
 | 
				
			||||||
		if _exists ; then
 | 
							if _exists; then
 | 
				
			||||||
			_delete_addresses
 | 
								_delete_addresses
 | 
				
			||||||
			_down
 | 
								_down
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,7 +35,7 @@ br2684ctl_pre_start() {
 | 
				
			|||||||
	eval opts=\$br2684ctl_${IFVAR}
 | 
						eval opts=\$br2684ctl_${IFVAR}
 | 
				
			||||||
	[ -z "${opts}" ] && return 0
 | 
						[ -z "${opts}" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${IFACE#nas[0-9]*}" = "${IFACE}" ] ; then
 | 
						if [ "${IFACE#nas[0-9]*}" = "${IFACE}" ]; then
 | 
				
			||||||
		eerror "Interface must be called nas[0-9] for RFC 2684 Bridging"
 | 
							eerror "Interface must be called nas[0-9] for RFC 2684 Bridging"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -45,7 +45,7 @@ br2684ctl_pre_start() {
 | 
				
			|||||||
			eerror "The -b and -c options are not allowed for br2684ctl_${IVAR}"
 | 
								eerror "The -b and -c options are not allowed for br2684ctl_${IVAR}"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
		*" -a "*) ;;
 | 
							*" -a "*);;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
			eerror "-a option (VPI and VCI) is required in br2684ctl_${IFVAR}"
 | 
								eerror "-a option (VPI and VCI) is required in br2684ctl_${IFVAR}"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,7 +45,7 @@ bridge_pre_start() {
 | 
				
			|||||||
	[ -n "${ports}" ] && bridge_post_stop
 | 
						[ -n "${ports}" ] && bridge_post_stop
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	(
 | 
						(
 | 
				
			||||||
	if [ -z "${ports}" -a -n "${brif}" ] ; then
 | 
						if [ -z "${ports}" -a -n "${brif}" ]; then
 | 
				
			||||||
		ports="${IFACE}"
 | 
							ports="${IFACE}"
 | 
				
			||||||
		IFACE="${brif}"
 | 
							IFACE="${brif}"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@@ -100,7 +100,7 @@ bridge_pre_start() {
 | 
				
			|||||||
bridge_post_stop() {
 | 
					bridge_post_stop() {
 | 
				
			||||||
	local port= ports= delete=false extra=
 | 
						local port= ports= delete=false extra=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if _is_bridge ; then
 | 
						if _is_bridge; then
 | 
				
			||||||
		ebegin "Destroying bridge ${IFACE}"
 | 
							ebegin "Destroying bridge ${IFACE}"
 | 
				
			||||||
		_down
 | 
							_down
 | 
				
			||||||
		ports="$(brctl show 2>/dev/null | \
 | 
							ports="$(brctl show 2>/dev/null | \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,9 +33,9 @@ ccwgroup_pre_start() {
 | 
				
			|||||||
	local ccwgroup="$(_get_array "ccwgroup_${IFVAR}")"
 | 
						local ccwgroup="$(_get_array "ccwgroup_${IFVAR}")"
 | 
				
			||||||
	[ -z "${ccwgroup}" ] && return 0
 | 
						[ -z "${ccwgroup}" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ! -d /sys/bus/ccwgroup ] ; then
 | 
						if [ ! -d /sys/bus/ccwgroup ]; then
 | 
				
			||||||
		modprobe qeth
 | 
							modprobe qeth
 | 
				
			||||||
		if [ ! -d /sys/bus/ccwgroup ] ; then
 | 
							if [ ! -d /sys/bus/ccwgroup ]; then
 | 
				
			||||||
			eerror "ccwgroup support missing in kernel"
 | 
								eerror "ccwgroup support missing in kernel"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -47,7 +47,7 @@ ccwgroup_pre_start() {
 | 
				
			|||||||
		[ -z "${first}" ] && first=${x}
 | 
							[ -z "${first}" ] && first=${x}
 | 
				
			||||||
		ccw="${ccw}${ccw:+,}${x}"
 | 
							ccw="${ccw}${ccw:+,}${x}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
	if [ -e /sys/devices/qeth/"${first}" ] ; then
 | 
						if [ -e /sys/devices/qeth/"${first}" ]; then
 | 
				
			||||||
		echo "0" > /sys/devices/qeth/"${first}"/online
 | 
							echo "0" > /sys/devices/qeth/"${first}"/online
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		echo "${ccw}" > /sys/bus/ccwgroup/drivers/qeth/group
 | 
							echo "${ccw}" > /sys/bus/ccwgroup/drivers/qeth/group
 | 
				
			||||||
@@ -65,8 +65,8 @@ ccwgroup_pre_stop() {
 | 
				
			|||||||
	[ ! -L /sys/class/net/"${FACE}"/driver ] && return 0
 | 
						[ ! -L /sys/class/net/"${FACE}"/driver ] && return 0
 | 
				
			||||||
	local driver="$(readlink /sys/class/net/"${IFACE}"/driver)"
 | 
						local driver="$(readlink /sys/class/net/"${IFACE}"/driver)"
 | 
				
			||||||
	case "${diver}" in
 | 
						case "${diver}" in
 | 
				
			||||||
		*/bus/ccwgroup/*) ;;
 | 
							*/bus/ccwgroup/*);;
 | 
				
			||||||
		*) return 0 ;;
 | 
							*) return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local device="$(readlink /sys/class/net/"${IFACE}"/device)"
 | 
						local device="$(readlink /sys/class/net/"${IFACE}"/device)"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -83,24 +83,24 @@ clip_pre_start() {
 | 
				
			|||||||
	eval clip=\$clip_${IFVAR}
 | 
						eval clip=\$clip_${IFVAR}
 | 
				
			||||||
	[ -z "${clip}" ] && return 0
 | 
						[ -z "${clip}" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ ! -r /proc/net/atm/arp ] ; then
 | 
					    if [ ! -r /proc/net/atm/arp ]; then
 | 
				
			||||||
		modprobe clip && sleep 2
 | 
							modprobe clip && sleep 2
 | 
				
			||||||
		if [ ! -r /proc/net/atm/arp ] ; then
 | 
							if [ ! -r /proc/net/atm/arp ]; then
 | 
				
			||||||
	    	eerror "You need first to enable kernel support for ATM CLIP"
 | 
						    	eerror "You need first to enable kernel support for ATM CLIP"
 | 
				
			||||||
	    	return 1
 | 
						    	return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    local started_here=
 | 
					    local started_here=
 | 
				
			||||||
    if ! are_atmclip_svcs_running ; then
 | 
					    if ! are_atmclip_svcs_running; then
 | 
				
			||||||
		atmclip_svcs_start || return 1
 | 
							atmclip_svcs_start || return 1
 | 
				
			||||||
		started_here=1
 | 
							started_here=1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ! _exists ; then
 | 
					    if ! _exists; then
 | 
				
			||||||
		ebegin "Creating CLIP interface ${IFACE}"
 | 
							ebegin "Creating CLIP interface ${IFACE}"
 | 
				
			||||||
		atmarp -c "${IFACE}"
 | 
							atmarp -c "${IFACE}"
 | 
				
			||||||
		if ! eend $? ; then
 | 
							if ! eend $?; then
 | 
				
			||||||
			[ -z "${started_here}" ] && atmclip_svcs_stop
 | 
								[ -z "${started_here}" ] && atmclip_svcs_stop
 | 
				
			||||||
	    	return 1
 | 
						    	return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -130,7 +130,7 @@ clip_post_start() {
 | 
				
			|||||||
    # reporting problems. Also, when no defined VC can be established,
 | 
					    # reporting problems. Also, when no defined VC can be established,
 | 
				
			||||||
    # we stop the ATM daemons.
 | 
					    # we stop the ATM daemons.
 | 
				
			||||||
    local has_failures= i=
 | 
					    local has_failures= i=
 | 
				
			||||||
	for i in ${clip} ; do
 | 
						for i in ${clip}; do
 | 
				
			||||||
		local IFS=","
 | 
							local IFS=","
 | 
				
			||||||
		set -- ${i}
 | 
							set -- ${i}
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
@@ -139,14 +139,14 @@ clip_post_start() {
 | 
				
			|||||||
		ebegin "Creating PVC ${ifvpivci} for peer ${peerip}"
 | 
							ebegin "Creating PVC ${ifvpivci} for peer ${peerip}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		local nleftretries=10 emsg= ecode=
 | 
							local nleftretries=10 emsg= ecode=
 | 
				
			||||||
		while [ ${nleftretries} -gt 0 ] ; do
 | 
							while [ ${nleftretries} -gt 0 ]; do
 | 
				
			||||||
			nleftretries=$((${nleftretries} - 1))
 | 
								nleftretries=$((${nleftretries} - 1))
 | 
				
			||||||
	    	emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
 | 
						    	emsg="$(atmarp -s "${peerip}" "${ifvpivci}" "$@" 2>&1)"
 | 
				
			||||||
	    	ecode=$? && break
 | 
						    	ecode=$? && break
 | 
				
			||||||
	    	sleep 2
 | 
						    	sleep 2
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ! eend ${ecode} ; then
 | 
							if ! eend ${ecode}; then
 | 
				
			||||||
	    	eerror "Creation failed for PVC ${ifvpivci}: ${emsg}"
 | 
						    	eerror "Creation failed for PVC ${ifvpivci}: ${emsg}"
 | 
				
			||||||
	    	has_failures=1
 | 
						    	has_failures=1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -175,7 +175,7 @@ clip_pre_stop() {
 | 
				
			|||||||
	eindent
 | 
						eindent
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		read left && \
 | 
							read left && \
 | 
				
			||||||
		while read itf t encp idle ipaddr left ; do
 | 
							while read itf t encp idle ipaddr left; do
 | 
				
			||||||
			if [ "${itf}" = "${IFACE}" ]; then
 | 
								if [ "${itf}" = "${IFACE}" ]; then
 | 
				
			||||||
				ebegin "Removing PVC to ${ipaddr}"
 | 
									ebegin "Removing PVC to ${ipaddr}"
 | 
				
			||||||
				atmarp -d "${ipaddr}"
 | 
									atmarp -d "${ipaddr}"
 | 
				
			||||||
@@ -197,15 +197,15 @@ clip_post_stop() {
 | 
				
			|||||||
    local itf= left= hasothers=
 | 
					    local itf= left= hasothers=
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
		read left && \
 | 
							read left && \
 | 
				
			||||||
		while read itf left ; do
 | 
							while read itf left; do
 | 
				
			||||||
	    	if [ "${itf}" != "${IFACE}" ] ; then
 | 
						    	if [ "${itf}" != "${IFACE}" ]; then
 | 
				
			||||||
				hasothers=1
 | 
									hasothers=1
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
	    	fi
 | 
						    	fi
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
    } < /proc/net/atm/arp
 | 
					    } < /proc/net/atm/arp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ -z "${hasothers}" ] ; then
 | 
					    if [ -z "${hasothers}" ]; then
 | 
				
			||||||
		atmclip_svcs_stop || return 1
 | 
							atmclip_svcs_stop || return 1
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ _exists() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
_ifindex() {
 | 
					_ifindex() {
 | 
				
			||||||
	local line= i=-2
 | 
						local line= i=-2
 | 
				
			||||||
	while read line ; do
 | 
						while read line; do
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
		[ ${i} -lt 1 ] && continue
 | 
							[ ${i} -lt 1 ] && continue
 | 
				
			||||||
		case "${line}" in
 | 
							case "${line}" in
 | 
				
			||||||
@@ -74,11 +74,11 @@ _get_mac_address() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "${mac}" in
 | 
						case "${mac}" in
 | 
				
			||||||
		00:00:00:00:00:00) ;;
 | 
							00:00:00:00:00:00);;
 | 
				
			||||||
		44:44:44:44:44:44) ;;
 | 
							44:44:44:44:44:44);;
 | 
				
			||||||
		FF:FF:FF:FF:FF:FF) ;;
 | 
							FF:FF:FF:FF:FF:FF);;
 | 
				
			||||||
		"") ;;
 | 
							"");;
 | 
				
			||||||
		*) echo "${mac}"; return 0 ;;
 | 
							*) echo "${mac}"; return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1
 | 
						return 1
 | 
				
			||||||
@@ -102,7 +102,7 @@ _get_inet_addresses() {
 | 
				
			|||||||
	local iface=${IFACE} i=0
 | 
						local iface=${IFACE} i=0
 | 
				
			||||||
	local addrs="$(_get_inet_address)"
 | 
						local addrs="$(_get_inet_address)"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		local IFACE="${iface}:${i}"
 | 
							local IFACE="${iface}:${i}"
 | 
				
			||||||
		_exists || break
 | 
							_exists || break
 | 
				
			||||||
		local addr="$(_get_inet_address)"
 | 
							local addr="$(_get_inet_address)"
 | 
				
			||||||
@@ -118,14 +118,14 @@ _cidr2netmask() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local octets=$((${cidr} / 8))
 | 
						local octets=$((${cidr} / 8))
 | 
				
			||||||
	local frac=$((${cidr} % 8))
 | 
						local frac=$((${cidr} % 8))
 | 
				
			||||||
	while [ ${octets} -gt 0 ] ; do
 | 
						while [ ${octets} -gt 0 ]; do
 | 
				
			||||||
		netmask="${netmask}.255"
 | 
							netmask="${netmask}.255"
 | 
				
			||||||
		octets=$((${octets} - 1))
 | 
							octets=$((${octets} - 1))
 | 
				
			||||||
		done=$((${done} + 1))
 | 
							done=$((${done} + 1))
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ${done} -lt 4 ] ; then
 | 
						if [ ${done} -lt 4 ]; then
 | 
				
			||||||
		while [ ${i} -lt ${frac} ] ; do
 | 
							while [ ${i} -lt ${frac} ]; do
 | 
				
			||||||
			sum=$((${sum} + ${cur}))
 | 
								sum=$((${sum} + ${cur}))
 | 
				
			||||||
			cur=$((${cur} / 2))
 | 
								cur=$((${cur} / 2))
 | 
				
			||||||
			i=$((${i} + 1))
 | 
								i=$((${i} + 1))
 | 
				
			||||||
@@ -133,7 +133,7 @@ _cidr2netmask() {
 | 
				
			|||||||
		netmask="${netmask}.${sum}"
 | 
							netmask="${netmask}.${sum}"
 | 
				
			||||||
		done=$((${done} + 1))
 | 
							done=$((${done} + 1))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while [ ${done} -lt 4 ] ; do
 | 
							while [ ${done} -lt 4 ]; do
 | 
				
			||||||
			netmask="${netmask}.0"
 | 
								netmask="${netmask}.0"
 | 
				
			||||||
			done=$((${done} + 1))
 | 
								done=$((${done} + 1))
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
@@ -143,7 +143,7 @@ _cidr2netmask() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_add_address() {
 | 
					_add_address() {
 | 
				
			||||||
	if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ] ; then
 | 
						if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ]; then
 | 
				
			||||||
		ifconfig "${IFACE}" "$@" 2>/dev/null
 | 
							ifconfig "${IFACE}" "$@" 2>/dev/null
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -155,7 +155,7 @@ _add_address() {
 | 
				
			|||||||
	# IPv4 is tricky - ifconfig requires an aliased device
 | 
						# IPv4 is tricky - ifconfig requires an aliased device
 | 
				
			||||||
	# for multiple addresses
 | 
						# for multiple addresses
 | 
				
			||||||
	local iface="${IFACE}"
 | 
						local iface="${IFACE}"
 | 
				
			||||||
	if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*" ; then
 | 
						if LC_ALL=C ifconfig "${iface}" | grep -Eq "\<inet addr:.*"; then
 | 
				
			||||||
		# Get the last alias made for the interface and add 1 to it
 | 
							# Get the last alias made for the interface and add 1 to it
 | 
				
			||||||
		i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
 | 
							i=$(ifconfig | sed '1!G;h;$!d' | grep -m 1 -o "^${iface}:[0-9]*" \
 | 
				
			||||||
			| sed -n -e 's/'"${iface}"'://p')
 | 
								| sed -n -e 's/'"${iface}"'://p')
 | 
				
			||||||
@@ -172,17 +172,17 @@ _add_address() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local arg= cmd=
 | 
						local arg= cmd=
 | 
				
			||||||
	while [ -n "$1" ] ; do
 | 
						while [ -n "$1" ]; do
 | 
				
			||||||
		case "$1" in
 | 
							case "$1" in
 | 
				
			||||||
			brd)
 | 
								brd)
 | 
				
			||||||
				if [ "$2" = "+" ] ; then
 | 
									if [ "$2" = "+" ]; then
 | 
				
			||||||
					shift
 | 
										shift
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					cmd="${cmd} broadcast"
 | 
										cmd="${cmd} broadcast"
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
			peer) cmd="${cmd} pointtopoint";;
 | 
								peer) cmd="${cmd} pointtopoint";;
 | 
				
			||||||
			*) cmd="${cmd} $1" ;;
 | 
								*) cmd="${cmd} $1";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		shift
 | 
							shift
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -193,15 +193,15 @@ _add_address() {
 | 
				
			|||||||
_add_route() {
 | 
					_add_route() {
 | 
				
			||||||
	local inet6=
 | 
						local inet6=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -n "${metric}" ] ; then
 | 
						if [ -n "${metric}" ]; then
 | 
				
			||||||
		set -- "$@" metric ${metric}
 | 
							set -- "$@" metric ${metric}
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ $# -eq 3 ] ; then
 | 
						if [ $# -eq 3 ]; then
 | 
				
			||||||
		set -- "$1" "$2" gw "$3"
 | 
							set -- "$1" "$2" gw "$3"
 | 
				
			||||||
	elif [ "$3" = "via" ] ; then
 | 
						elif [ "$3" = "via" ]; then
 | 
				
			||||||
		local one=$1 two=$2
 | 
							local one=$1 two=$2
 | 
				
			||||||
		shift ; shift; shift
 | 
							shift; shift; shift
 | 
				
			||||||
		set -- "${one}" "${two}" gw "$@"
 | 
							set -- "${one}" "${two}" gw "$@"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -218,7 +218,7 @@ _add_route() {
 | 
				
			|||||||
_delete_addresses() {
 | 
					_delete_addresses() {
 | 
				
			||||||
	# We don't remove addresses from aliases
 | 
						# We don't remove addresses from aliases
 | 
				
			||||||
	case "${IFACE}" in
 | 
						case "${IFACE}" in
 | 
				
			||||||
		*:*) return 0 ;;
 | 
							*:*) return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	einfo "Removing addresses"
 | 
						einfo "Removing addresses"
 | 
				
			||||||
@@ -227,11 +227,11 @@ _delete_addresses() {
 | 
				
			|||||||
	# iproute2 added addresses cause problems for ifconfig
 | 
						# iproute2 added addresses cause problems for ifconfig
 | 
				
			||||||
	# as we delete an address, a new one appears, so we have to
 | 
						# as we delete an address, a new one appears, so we have to
 | 
				
			||||||
	# keep polling
 | 
						# keep polling
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		local addr=$(_get_inet_address)
 | 
							local addr=$(_get_inet_address)
 | 
				
			||||||
		[ -z "${addr}" ] && break
 | 
							[ -z "${addr}" ] && break
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		if [ "${addr}" = "127.0.0.1/8" ] ; then
 | 
							if [ "${addr}" = "127.0.0.1/8" ]; then
 | 
				
			||||||
			# Don't delete the loopback address
 | 
								# Don't delete the loopback address
 | 
				
			||||||
			[ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break
 | 
								[ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] && break
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -242,7 +242,7 @@ _delete_addresses() {
 | 
				
			|||||||
	# Remove IPv6 addresses
 | 
						# Remove IPv6 addresses
 | 
				
			||||||
	local addr=
 | 
						local addr=
 | 
				
			||||||
	for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
 | 
						for addr in $(LC_ALL=C ifconfig "${IFACE}" | \
 | 
				
			||||||
		sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p') ; do
 | 
							sed -n -e 's/^.*inet6 addr: \([^ ]*\) Scope:[^L].*/\1/p'); do
 | 
				
			||||||
		[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue
 | 
							[ "${addr}" = "::1/128" -a "${IFACE}" = "lo" ] && continue
 | 
				
			||||||
		einfo "${addr}"
 | 
							einfo "${addr}"
 | 
				
			||||||
		ifconfig "${IFACE}" inet6 del "${addr}"
 | 
							ifconfig "${IFACE}" inet6 del "${addr}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -35,22 +35,22 @@ ifplugd_depend() {
 | 
				
			|||||||
ifplugd_pre_start() {
 | 
					ifplugd_pre_start() {
 | 
				
			||||||
	local pidfile="/var/run/ifplugd.${IFACE}.pid" timeout= args=
 | 
						local pidfile="/var/run/ifplugd.${IFACE}.pid" timeout= args=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We don't start netplug if we're being called from the background
 | 
						# We don't start ifplugd if we're being called from the background
 | 
				
			||||||
	yesno ${IN_BACKGROUND} && return 0
 | 
						yesno ${IN_BACKGROUND} && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	_exists || return 0
 | 
						_exists || return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We need a valid MAC address
 | 
						# We need a valid MAC address
 | 
				
			||||||
	# It's a basic test to ensure it's not a virtual interface
 | 
						# It's a basic test to ensure it's not a virtual interface
 | 
				
			||||||
	if ! _get_mac_address >/dev/null 2>/dev/null ; then
 | 
						if ! _get_mac_address >/dev/null 2>&1; then
 | 
				
			||||||
		vewarn "netplug only works on interfaces with a valid MAC address"
 | 
							vewarn "ifplugd only works on interfaces with a valid MAC address"
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We don't work on bonded, bridges, tun/tap, vlan or wireless
 | 
						# We don't work on bonded, bridges, tun/tap, vlan or wireless
 | 
				
			||||||
	for f in bond bridge tuntap vlan wireless ; do
 | 
						for f in bond bridge tuntap vlan wireless; do
 | 
				
			||||||
		if type "_is_${f}" >/dev/null 2>/dev/null ; then
 | 
							if type "_is_${f}" >/dev/null 2>&1; then
 | 
				
			||||||
			if _is_${f} ; then
 | 
								if _is_${f}; then
 | 
				
			||||||
				veinfo "netplug does not work with" "${f}"
 | 
									veinfo "netplug does not work with" "${f}"
 | 
				
			||||||
				return 0
 | 
									return 0
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -73,28 +73,28 @@ ifplugd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	eval timeout=\$plug_timeout_${IFVAR}
 | 
						eval timeout=\$plug_timeout_${IFVAR}
 | 
				
			||||||
	[ -z "${timeout}" ] && timeout=-1
 | 
						[ -z "${timeout}" ] && timeout=-1
 | 
				
			||||||
	if [ ${timeout} -eq 0 ] ; then
 | 
						if [ ${timeout} -eq 0 ]; then
 | 
				
			||||||
		ewarn "WARNING: infinite timeout set for" "${IFACE}" "to come up"
 | 
							ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
 | 
				
			||||||
	elif [ ${timeout} -lt 0 ] ; then
 | 
						elif [ ${timeout} -lt 0 ]; then
 | 
				
			||||||
		einfo "Backgrounding ..."
 | 
							einfo "Backgrounding ..."
 | 
				
			||||||
		exit 1 
 | 
							exit 1 
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	veinfo "Waiting for" "${IFACE}" "to be marked as started"
 | 
						veinfo "Waiting for ${IFACE} to be marked as started"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local i=0
 | 
						local i=0
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		if service_started "${SVCNAME}" ; then
 | 
							if service_started "${SVCNAME}"; then
 | 
				
			||||||
			_show_address
 | 
								_show_address
 | 
				
			||||||
			exit 0
 | 
								exit 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		sleep 1
 | 
							sleep 1
 | 
				
			||||||
		[ ${timeout} -eq 0 ]] && continue
 | 
							[ ${timeout} -eq 0 ] && continue
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
		[ ${i} -ge ${timeout} ] && break
 | 
							[ ${i} -ge ${timeout} ] && break
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eend 1 "Failed to configure" "${IFACE}" "in the background"
 | 
						eend 1 "Failed to configure ${IFACE} in the background"
 | 
				
			||||||
	exit 1
 | 
						exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ ip6to4_depend() {
 | 
				
			|||||||
ip6to4_start() {
 | 
					ip6to4_start() {
 | 
				
			||||||
	case " ${MODULES} " in
 | 
						case " ${MODULES} " in
 | 
				
			||||||
		*" ifconfig "*)
 | 
							*" ifconfig "*)
 | 
				
			||||||
			if [ "${IFACE}" != "sit0" ] ; then
 | 
								if [ "${IFACE}" != "sit0" ]; then
 | 
				
			||||||
				eerror "ip6to4 can only work on the sit0 interface using ifconfig"
 | 
									eerror "ip6to4 can only work on the sit0 interface using ifconfig"
 | 
				
			||||||
				eerror "emerge sys-apps/iproute2 to use other interfaces"
 | 
									eerror "emerge sys-apps/iproute2 to use other interfaces"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
@@ -41,7 +41,7 @@ ip6to4_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local host= suffix= relay= addr= iface=${IFACE} new= localip=
 | 
						local host= suffix= relay= addr= iface=${IFACE} new= localip=
 | 
				
			||||||
	eval host=\$link_${IFVAR}
 | 
						eval host=\$link_${IFVAR}
 | 
				
			||||||
	if [ -z "${host}" ] ; then
 | 
						if [ -z "${host}" ]; then
 | 
				
			||||||
		eerror "link_${IFVAR} not set"
 | 
							eerror "link_${IFVAR} not set"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -52,24 +52,24 @@ ip6to4_start() {
 | 
				
			|||||||
	IFACE=${host}
 | 
						IFACE=${host}
 | 
				
			||||||
	addrs=$(_get_inet_addresses)
 | 
						addrs=$(_get_inet_addresses)
 | 
				
			||||||
	IFACE=${iface}
 | 
						IFACE=${iface}
 | 
				
			||||||
	if [ -z "${addrs}" ] ; then
 | 
						if [ -z "${addrs}" ]; then
 | 
				
			||||||
		eerror "${host} is not configured with an IPv4 address"
 | 
							eerror "${host} is not configured with an IPv4 address"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for addr in ${addrs} ; do
 | 
						for addr in ${addrs}; do
 | 
				
			||||||
		# Strip the subnet
 | 
							# Strip the subnet
 | 
				
			||||||
		local ip="${addr%/*}" subnet="${addr#*/}"
 | 
							local ip="${addr%/*}" subnet="${addr#*/}"
 | 
				
			||||||
		# We don't work on private IPv4 addresses
 | 
							# We don't work on private IPv4 addresses
 | 
				
			||||||
		case "${ip}" in
 | 
							case "${ip}" in
 | 
				
			||||||
			127.*) continue ;;
 | 
								127.*) continue;;
 | 
				
			||||||
			10.*) continue ;;
 | 
								10.*) continue;;
 | 
				
			||||||
			192.168.*) continue ;;
 | 
								192.168.*) continue;;
 | 
				
			||||||
			172.*)
 | 
								172.*)
 | 
				
			||||||
				local i=16
 | 
									local i=16
 | 
				
			||||||
				while [ ${i} -lt 32 ] ; do
 | 
									while [ ${i} -lt 32 ]; do
 | 
				
			||||||
					case "${ip}" in
 | 
										case "${ip}" in
 | 
				
			||||||
						172.${i}.*) break ;;
 | 
											172.${i}.*) break;;
 | 
				
			||||||
					esac
 | 
										esac
 | 
				
			||||||
					i=$((${i} + 1))
 | 
										i=$((${i} + 1))
 | 
				
			||||||
				done
 | 
									done
 | 
				
			||||||
@@ -89,19 +89,19 @@ ip6to4_start() {
 | 
				
			|||||||
		# Now apply our IPv6 address to our config
 | 
							# Now apply our IPv6 address to our config
 | 
				
			||||||
		new="${new}${new:+ }${ip6}/16"
 | 
							new="${new}${new:+ }${ip6}/16"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ -n "${localip}" ] ; then
 | 
							if [ -n "${localip}" ]; then
 | 
				
			||||||
			localip="any"
 | 
								localip="any"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			localip="${ip}"
 | 
								localip="${ip}"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${new}" ] ; then
 | 
						if [ -z "${new}" ]; then
 | 
				
			||||||
		eerror "No global IPv4 addresses found on interface ${host}"
 | 
							eerror "No global IPv4 addresses found on interface ${host}"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${IFACE}" != "sit0" ] ; then
 | 
						if [ "${IFACE}" != "sit0" ]; then
 | 
				
			||||||
		ebegin "Creating 6to4 tunnel on ${IFACE}"
 | 
							ebegin "Creating 6to4 tunnel on ${IFACE}"
 | 
				
			||||||
		_tunnel add "${IFACE}" mode sit ttl 255 remote any local "${localip}"
 | 
							_tunnel add "${IFACE}" mode sit ttl 255 remote any local "${localip}"
 | 
				
			||||||
		eend $? || return 1
 | 
							eend $? || return 1
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -37,8 +37,8 @@ ipppd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Check that we are a valid ippp interface
 | 
						# Check that we are a valid ippp interface
 | 
				
			||||||
	case "${IFACE}" in
 | 
						case "${IFACE}" in
 | 
				
			||||||
		ippp[0-9]*) ;;
 | 
							ippp[0-9]*);;
 | 
				
			||||||
		*) return 0 ;;
 | 
							*) return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Check that the interface exists
 | 
						# Check that the interface exists
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,7 +43,7 @@ _exists() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
_ifindex() {
 | 
					_ifindex() {
 | 
				
			||||||
	local line= i=-2
 | 
						local line= i=-2
 | 
				
			||||||
	while read line ; do
 | 
						while read line; do
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
		[ ${i} -lt 1 ] && continue
 | 
							[ ${i} -lt 1 ] && continue
 | 
				
			||||||
		case "${line}" in
 | 
							case "${line}" in
 | 
				
			||||||
@@ -80,11 +80,11 @@ _get_mac_address() {
 | 
				
			|||||||
		-e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p')
 | 
							-e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case "${mac}" in
 | 
						case "${mac}" in
 | 
				
			||||||
		00:00:00:00:00:00) ;;
 | 
							00:00:00:00:00:00);;
 | 
				
			||||||
		44:44:44:44:44:44) ;;
 | 
							44:44:44:44:44:44);;
 | 
				
			||||||
		FF:FF:FF:FF:FF:FF) ;;
 | 
							FF:FF:FF:FF:FF:FF);;
 | 
				
			||||||
		"") ;;
 | 
							"");;
 | 
				
			||||||
		*) echo "${mac}"; return 0 ;;
 | 
							*) echo "${mac}"; return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 1
 | 
						return 1
 | 
				
			||||||
@@ -106,22 +106,22 @@ _get_inet_address() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_add_address() {
 | 
					_add_address() {
 | 
				
			||||||
	if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ] ; then
 | 
						if [ "$1" = "127.0.0.1/8" -a "${IFACE}" = "lo" ]; then
 | 
				
			||||||
		ip addr add "$@" dev "${IFACE}" 2>/dev/null
 | 
							ip addr add "$@" dev "${IFACE}" 2>/dev/null
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Convert an ifconfig line to iproute2
 | 
						# Convert an ifconfig line to iproute2
 | 
				
			||||||
	if [ "$2" = "netmask" ] ; then
 | 
						if [ "$2" = "netmask" ]; then
 | 
				
			||||||
		local one="$1" three="$3"
 | 
							local one="$1" three="$3"
 | 
				
			||||||
		shift ; shift ; shift
 | 
							shift; shift; shift
 | 
				
			||||||
		set -- "${one}/$(_netmask2cidr "${three}")" "$@"
 | 
							set -- "${one}/$(_netmask2cidr "${three}")" "$@"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	#config=( "${config[@]//pointopoint/peer}" )
 | 
						#config=( "${config[@]//pointopoint/peer}" )
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# Always scope lo addresses as host unless specified otherwise
 | 
						# Always scope lo addresses as host unless specified otherwise
 | 
				
			||||||
	if [ "${IFACE}" = "lo" ] ; then
 | 
						if [ "${IFACE}" = "lo" ]; then
 | 
				
			||||||
		set -- "$@" "scope" "host"
 | 
							set -- "$@" "scope" "host"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -129,9 +129,9 @@ _add_address() {
 | 
				
			|||||||
	case "$1" in
 | 
						case "$1" in
 | 
				
			||||||
		*.*.*.*)
 | 
							*.*.*.*)
 | 
				
			||||||
			case "$@" in
 | 
								case "$@" in
 | 
				
			||||||
				*" brd "*) ;;
 | 
									*" brd "*);;
 | 
				
			||||||
				*" broadcast "*) ;;
 | 
									*" broadcast "*);;
 | 
				
			||||||
				*) set -- "$@" brd + ;;
 | 
									*) set -- "$@" brd +;;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
@@ -140,27 +140,27 @@ _add_address() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_add_route() {
 | 
					_add_route() {
 | 
				
			||||||
	if [ $# -eq 3 ] ; then
 | 
						if [ $# -eq 3 ]; then
 | 
				
			||||||
		set -- "$1" "$2" via "$3"
 | 
							set -- "$1" "$2" via "$3"
 | 
				
			||||||
	elif [ "$3" = "gw" ] ; then
 | 
						elif [ "$3" = "gw" ]; then
 | 
				
			||||||
		local one=$1 two=$2
 | 
							local one=$1 two=$2
 | 
				
			||||||
		shift ; shift; shift
 | 
							shift; shift; shift
 | 
				
			||||||
		set -- "${one}" "${two}" gw "$@"
 | 
							set -- "${one}" "${two}" gw "$@"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local cmd= have_metric=false 
 | 
						local cmd= have_metric=false 
 | 
				
			||||||
	while [ -n "$1" ] ; do
 | 
						while [ -n "$1" ]; do
 | 
				
			||||||
		case "$1" in
 | 
							case "$1" in
 | 
				
			||||||
			metric) cmd="${cmd} $1"; have_metric=true ;;
 | 
								metric) cmd="${cmd} $1"; have_metric=true;;
 | 
				
			||||||
			netmask) cmd="${cmd}/$(_netmask2cidr "$2")"; shift ;;
 | 
								netmask) cmd="${cmd}/$(_netmask2cidr "$2")"; shift;;
 | 
				
			||||||
			-host|-net) ;;
 | 
								-host|-net);;
 | 
				
			||||||
			-A)	[ "$2" = "inet6" ] && shift ;;
 | 
								-A)	[ "$2" = "inet6" ] && shift;;
 | 
				
			||||||
			*) cmd="${cmd} $1" ;;
 | 
								*) cmd="${cmd} $1";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		shift
 | 
							shift
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! ${have_metric} && [ -n "${metric}" ] ; then
 | 
						if ! ${have_metric} && [ -n "${metric}" ]; then
 | 
				
			||||||
		cmd="${cmd} metric ${metric}"
 | 
							cmd="${cmd} metric ${metric}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,7 +171,7 @@ _add_route() {
 | 
				
			|||||||
_delete_addresses() {
 | 
					_delete_addresses() {
 | 
				
			||||||
	ip addr flush dev "${IFACE}" scope global 2>/dev/null
 | 
						ip addr flush dev "${IFACE}" scope global 2>/dev/null
 | 
				
			||||||
	ip addr flush dev "${IFACE}" scope site 2>/dev/null
 | 
						ip addr flush dev "${IFACE}" scope site 2>/dev/null
 | 
				
			||||||
	if [ "${IFACE}" != "lo" ] ; then
 | 
						if [ "${IFACE}" != "lo" ]; then
 | 
				
			||||||
		ip addr flush dev "${IFACE}" scope host 2>/dev/null
 | 
							ip addr flush dev "${IFACE}" scope host 2>/dev/null
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	return 0
 | 
						return 0
 | 
				
			||||||
@@ -198,7 +198,7 @@ iproute2_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local tunnel=
 | 
						local tunnel=
 | 
				
			||||||
	eval tunnel=\$iptunnel_${IFVAR}
 | 
						eval tunnel=\$iptunnel_${IFVAR}
 | 
				
			||||||
	if [ -n "${tunnel}" ] ; then
 | 
						if [ -n "${tunnel}" ]; then
 | 
				
			||||||
		# Set our base metric to 1000
 | 
							# Set our base metric to 1000
 | 
				
			||||||
		metric=1000
 | 
							metric=1000
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,8 +220,8 @@ iproute2_post_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
iproute2_post_stop() {
 | 
					iproute2_post_stop() {
 | 
				
			||||||
	# Don't delete sit0 as it's a special tunnel
 | 
						# Don't delete sit0 as it's a special tunnel
 | 
				
			||||||
	if [ "${IFACE}" != "sit0" ] ; then
 | 
						if [ "${IFACE}" != "sit0" ]; then
 | 
				
			||||||
		if [ -n "$(ip tunnel show "${IFACE}" 2>/dev/null)" ] ; then
 | 
							if [ -n "$(ip tunnel show "${IFACE}" 2>/dev/null)" ]; then
 | 
				
			||||||
			ebegin "Destroying tunnel ${IFACE}"
 | 
								ebegin "Destroying tunnel ${IFACE}"
 | 
				
			||||||
			ip tunnel del "${IFACE}"
 | 
								ip tunnel del "${IFACE}"
 | 
				
			||||||
			eend $?
 | 
								eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -36,7 +36,7 @@ iwconfig_get_wep_status() {
 | 
				
			|||||||
	local mode= status="disabled"
 | 
						local mode= status="disabled"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# No easy way of doing this grep in bash regex :/
 | 
						# No easy way of doing this grep in bash regex :/
 | 
				
			||||||
	if LC_ALL=C iwconfig "${IFACE}" | grep -qE "^ +Encryption key:[*0-9,A-F]" ; then
 | 
						if LC_ALL=C iwconfig "${IFACE}" | grep -qE "^ +Encryption key:[*0-9,A-F]"; then
 | 
				
			||||||
		status="enabled"
 | 
							status="enabled"
 | 
				
			||||||
		mode=$(LC_ALL=C iwconfig "${IFACE}" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p')
 | 
							mode=$(LC_ALL=C iwconfig "${IFACE}" | sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p')
 | 
				
			||||||
		[ -n "${mode}" ] && mode=" - ${mode}"
 | 
							[ -n "${mode}" ] && mode=" - ${mode}"
 | 
				
			||||||
@@ -48,9 +48,9 @@ iwconfig_get_wep_status() {
 | 
				
			|||||||
_get_ssid() {
 | 
					_get_ssid() {
 | 
				
			||||||
	local i=5 ssid=
 | 
						local i=5 ssid=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${i} -gt 0 ] ; do
 | 
						while [ ${i} -gt 0 ]; do
 | 
				
			||||||
		ssid=$(iwgetid --raw "${IFACE}")
 | 
							ssid=$(iwgetid --raw "${IFACE}")
 | 
				
			||||||
		if [ -n "${ssid}" ] ; then
 | 
							if [ -n "${ssid}" ]; then
 | 
				
			||||||
			echo "${ssid}"
 | 
								echo "${ssid}"
 | 
				
			||||||
			return 0
 | 
								return 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -64,11 +64,11 @@ _get_ssid() {
 | 
				
			|||||||
_get_ap_mac_address() {
 | 
					_get_ap_mac_address() {
 | 
				
			||||||
	local mac="$(iwgetid --raw --ap "${IFACE}")" 
 | 
						local mac="$(iwgetid --raw --ap "${IFACE}")" 
 | 
				
			||||||
	case "${mac}" in
 | 
						case "${mac}" in
 | 
				
			||||||
		"00:00:00:00:00:00") return 1 ;;
 | 
							"00:00:00:00:00:00") return 1;;
 | 
				
			||||||
		"44:44:44:44:44:44") return 1 ;;
 | 
							"44:44:44:44:44:44") return 1;;
 | 
				
			||||||
		"FF:00:00:00:00:00") return 1 ;;
 | 
							"FF:00:00:00:00:00") return 1;;
 | 
				
			||||||
		"FF:FF:FF:FF:FF:FF") return 1 ;;
 | 
							"FF:FF:FF:FF:FF:FF") return 1;;
 | 
				
			||||||
		*) echo "${mac}" ;;
 | 
							*) echo "${mac}";;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -117,13 +117,13 @@ iwconfig_get_wep_key() {
 | 
				
			|||||||
	[ -n "${mac}" ] && mac="$(echo "${mac}" | sed -e 's/://g')"
 | 
						[ -n "${mac}" ] && mac="$(echo "${mac}" | sed -e 's/://g')"
 | 
				
			||||||
	eval key=\$mac_key_${mac}
 | 
						eval key=\$mac_key_${mac}
 | 
				
			||||||
	[ -z "${key}" ] && eval key=\$key_${SSIDVAR}
 | 
						[ -z "${key}" ] && eval key=\$key_${SSIDVAR}
 | 
				
			||||||
	if [ -z "${key}" ] ; then
 | 
						if [ -z "${key}" ]; then
 | 
				
			||||||
		echo "off"
 | 
							echo "off"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		set -- ${key}
 | 
							set -- ${key}
 | 
				
			||||||
		local x= e=false
 | 
							local x= e=false
 | 
				
			||||||
		for x in "$@" ; do
 | 
							for x in "$@"; do
 | 
				
			||||||
			if [ "${x}" = "enc" ] ; then
 | 
								if [ "${x}" = "enc" ]; then
 | 
				
			||||||
				e=true
 | 
									e=true
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -141,7 +141,7 @@ iwconfig_user_config() {
 | 
				
			|||||||
	local IFS="$__IFS"
 | 
						local IFS="$__IFS"
 | 
				
			||||||
	for conf in ${config}; do
 | 
						for conf in ${config}; do
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
		if ! eval iwconfig "${IFACE}" "${conf}" ; then
 | 
							if ! eval iwconfig "${IFACE}" "${conf}"; then
 | 
				
			||||||
			ewarn "${IFACE} does not support the following configuration commands"
 | 
								ewarn "${IFACE} does not support the following configuration commands"
 | 
				
			||||||
			ewarn "  ${conf}"
 | 
								ewarn "  ${conf}"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -152,7 +152,7 @@ iwconfig_user_config() {
 | 
				
			|||||||
	local IFS="$__IFS"
 | 
						local IFS="$__IFS"
 | 
				
			||||||
	for conf in ${config}; do
 | 
						for conf in ${config}; do
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
		if ! eval iwpriv "${IFACE}" "${conf}" ; then
 | 
							if ! eval iwpriv "${IFACE}" "${conf}"; then
 | 
				
			||||||
			ewarn "${IFACE} does not support the following private ioctls"
 | 
								ewarn "${IFACE} does not support the following private ioctls"
 | 
				
			||||||
			ewarn "  ${conf}"
 | 
								ewarn "  ${conf}"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -172,7 +172,7 @@ iwconfig_setup_specific() {
 | 
				
			|||||||
	iwconfig_set_mode "${mode}"
 | 
						iwconfig_set_mode "${mode}"
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	# Now set the key
 | 
						# Now set the key
 | 
				
			||||||
	if ! eval iwconfig "${IFACE}" key "${key}" ; then
 | 
						if ! eval iwconfig "${IFACE}" key "${key}"; then
 | 
				
			||||||
		if [ "${key}" != "off" ]; then
 | 
							if [ "${key}" != "off" ]; then
 | 
				
			||||||
			ewarn "${IFACE} does not support setting keys"
 | 
								ewarn "${IFACE} does not support setting keys"
 | 
				
			||||||
			ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
 | 
								ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
 | 
				
			||||||
@@ -180,7 +180,7 @@ iwconfig_setup_specific() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Then set the SSID
 | 
						# Then set the SSID
 | 
				
			||||||
	if ! iwconfig "${IFACE}" essid "${SSID}" ; then
 | 
						if ! iwconfig "${IFACE}" essid "${SSID}"; then
 | 
				
			||||||
		eerror "${IFACE} does not support setting SSID to \"${SSID}\""
 | 
							eerror "${IFACE} does not support setting SSID to \"${SSID}\""
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -188,7 +188,7 @@ iwconfig_setup_specific() {
 | 
				
			|||||||
	eval channel=\$channel_${SSIDVAR}
 | 
						eval channel=\$channel_${SSIDVAR}
 | 
				
			||||||
	[ -z "${channel}" ] && eval channel=\$channel_${IFVAR}
 | 
						[ -z "${channel}" ] && eval channel=\$channel_${IFVAR}
 | 
				
			||||||
	# We default the channel to 3
 | 
						# We default the channel to 3
 | 
				
			||||||
	if ! iwconfig "${IFACE}" channel "${channel:-3}" ; then
 | 
						if ! iwconfig "${IFACE}" channel "${channel:-3}"; then
 | 
				
			||||||
		ewarn "${IFACE} does not support setting the channel to \"${channel:-3}\""
 | 
							ewarn "${IFACE} does not support setting the channel to \"${channel:-3}\""
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -210,8 +210,8 @@ iwconfig_wait_for_association() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	while true; do
 | 
						while true; do
 | 
				
			||||||
		# Use sysfs if we can
 | 
							# Use sysfs if we can
 | 
				
			||||||
		if [ -e /sys/class/net/"${IFACE}"/carrier ] ; then
 | 
							if [ -e /sys/class/net/"${IFACE}"/carrier ]; then
 | 
				
			||||||
			if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ] ; then
 | 
								if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ]; then
 | 
				
			||||||
				# Double check we have an ssid. This is mainly for buggy
 | 
									# Double check we have an ssid. This is mainly for buggy
 | 
				
			||||||
				# prism54 drivers that always set their carrier on :/
 | 
									# prism54 drivers that always set their carrier on :/
 | 
				
			||||||
				[ -n "$(iwgetid --raw "${IFACE}")" ] && return 0
 | 
									[ -n "$(iwgetid --raw "${IFACE}")" ] && return 0
 | 
				
			||||||
@@ -220,10 +220,10 @@ iwconfig_wait_for_association() {
 | 
				
			|||||||
			local atest=
 | 
								local atest=
 | 
				
			||||||
			eval atest=\$associate_test_${IFVAR}
 | 
								eval atest=\$associate_test_${IFVAR}
 | 
				
			||||||
			atest=${atest:-mac}
 | 
								atest=${atest:-mac}
 | 
				
			||||||
			if [ "${atest}" = "mac" -o "${atest}" = "all" ] ; then
 | 
								if [ "${atest}" = "mac" -o "${atest}" = "all" ]; then
 | 
				
			||||||
				[ -n "$(_get_ap_mac_address)" ] && return 0
 | 
									[ -n "$(_get_ap_mac_address)" ] && return 0
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			if [ "${atest}" = "quality" -o "${atest}" = "all" ] ; then
 | 
								if [ "${atest}" = "quality" -o "${atest}" = "all" ]; then
 | 
				
			||||||
				[ "$(sed -n -e 's/^.*'"${IFACE}"': *[0-9]* *\([0-9]*\).*/\1/p' \
 | 
									[ "$(sed -n -e 's/^.*'"${IFACE}"': *[0-9]* *\([0-9]*\).*/\1/p' \
 | 
				
			||||||
					/proc/net/wireless)" != "0" ] && return 0
 | 
										/proc/net/wireless)" != "0" ] && return 0
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -249,17 +249,17 @@ iwconfig_associate() {
 | 
				
			|||||||
	else
 | 
						else
 | 
				
			||||||
		SSIDVAR=$(_shell_var "${SSID}")
 | 
							SSIDVAR=$(_shell_var "${SSID}")
 | 
				
			||||||
		key="$(iwconfig_get_wep_key "${mac}")"
 | 
							key="$(iwconfig_get_wep_key "${mac}")"
 | 
				
			||||||
		if [ "${wep_required}" = "on" -a "${key}" = "off" ] ; then
 | 
							if [ "${wep_required}" = "on" -a "${key}" = "off" ]; then
 | 
				
			||||||
			ewarn "WEP key is not set for \"${SSID}\" - not connecting"
 | 
								ewarn "WEP key is not set for \"${SSID}\" - not connecting"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if [ "${wep_required}" = "off" -a "${key}" != "off" ] ; then
 | 
							if [ "${wep_required}" = "off" -a "${key}" != "off" ]; then
 | 
				
			||||||
			key="off"
 | 
								key="off"
 | 
				
			||||||
			ewarn "\"${SSID}\" is not WEP enabled - ignoring setting"
 | 
								ewarn "\"${SSID}\" is not WEP enabled - ignoring setting"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ! eval iwconfig "${IFACE}" key "${key}" ; then
 | 
							if ! eval iwconfig "${IFACE}" key "${key}"; then
 | 
				
			||||||
			if [ "${key}" != "off" ] ; then
 | 
								if [ "${key}" != "off" ]; then
 | 
				
			||||||
				ewarn "${IFACE} does not support setting keys"
 | 
									ewarn "${IFACE} does not support setting keys"
 | 
				
			||||||
				ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
 | 
									ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
@@ -268,16 +268,16 @@ iwconfig_associate() {
 | 
				
			|||||||
		[ "${key}" != "off" ] && w="$(iwconfig_get_wep_status "${iface}")"
 | 
							[ "${key}" != "off" ] && w="$(iwconfig_get_wep_status "${iface}")"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! iwconfig "${IFACE}" essid "${SSID}" ; then
 | 
						if ! iwconfig "${IFACE}" essid "${SSID}"; then
 | 
				
			||||||
		if [ "${SSID}" != "any" ] ; then
 | 
							if [ "${SSID}" != "any" ]; then
 | 
				
			||||||
			ewarn "${IFACE} does not support setting SSID to \"${SSID}\""
 | 
								ewarn "${IFACE} does not support setting SSID to \"${SSID}\""
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Only use channel or frequency
 | 
						# Only use channel or frequency
 | 
				
			||||||
	if [ -n "${chan}" ] ; then
 | 
						if [ -n "${chan}" ]; then
 | 
				
			||||||
		iwconfig "${IFACE}" channel "${chan}"
 | 
							iwconfig "${IFACE}" channel "${chan}"
 | 
				
			||||||
	elif [ -n "${freq}" ] ; then
 | 
						elif [ -n "${freq}" ]; then
 | 
				
			||||||
		iwconfig "${IFACE}" freq "${freq}"
 | 
							iwconfig "${IFACE}" freq "${freq}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	[ -n "${mac}" ] && iwconfig "${IFACE}" ap "${mac}"
 | 
						[ -n "${mac}" ] && iwconfig "${IFACE}" ap "${mac}"
 | 
				
			||||||
@@ -287,19 +287,19 @@ iwconfig_associate() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
 | 
						ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>/dev/null ; then
 | 
						if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>&1; then
 | 
				
			||||||
		veinfo "Running preassociate function"
 | 
							veinfo "Running preassociate function"
 | 
				
			||||||
		veindent
 | 
							veindent
 | 
				
			||||||
		( preassociate )
 | 
							( preassociate )
 | 
				
			||||||
		local e=$?
 | 
							local e=$?
 | 
				
			||||||
		veoutdent
 | 
							veoutdent
 | 
				
			||||||
		if [ ${e} -eq 0 ] ; then
 | 
							if [ ${e} -eq 0 ]; then
 | 
				
			||||||
			veend 1 "preassociate \"${SSID}\" on ${IFACE} failed"
 | 
								veend 1 "preassociate \"${SSID}\" on ${IFACE} failed"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! iwconfig_wait_for_association  ; then
 | 
						if ! iwconfig_wait_for_association; then
 | 
				
			||||||
		eend 1
 | 
							eend 1
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -313,7 +313,7 @@ iwconfig_associate() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	iwconfig_report
 | 
						iwconfig_report
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if type postassociate >/dev/null 2>/dev/null ; then
 | 
						if type postassociate >/dev/null 2>&1; then
 | 
				
			||||||
		veinfo "Running postassociate function"
 | 
							veinfo "Running postassociate function"
 | 
				
			||||||
		veindent
 | 
							veindent
 | 
				
			||||||
		( postassociate )
 | 
							( postassociate )
 | 
				
			||||||
@@ -332,12 +332,12 @@ iwconfig_scan() {
 | 
				
			|||||||
	eval x=\$sleep_scan_${IFVAR}
 | 
						eval x=\$sleep_scan_${IFVAR}
 | 
				
			||||||
	[ -n "${x}" ] && sleep "${x}"
 | 
						[ -n "${x}" ] && sleep "${x}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${i} -lt 3 ] ; do
 | 
						while [ ${i} -lt 3 ]; do
 | 
				
			||||||
	    local scan="${scan}${scan:+ }$(LC_ALL=C iwlist "${IFACE}" scan 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")"
 | 
						    local scan="${scan}${scan:+ }$(LC_ALL=C iwlist "${IFACE}" scan 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")"
 | 
				
			||||||
		# If this is the first pass and txpower as off and we have no results
 | 
							# If this is the first pass and txpower as off and we have no results
 | 
				
			||||||
		# then we need to wait for at least 2 seconds whilst the interface
 | 
							# then we need to wait for at least 2 seconds whilst the interface
 | 
				
			||||||
		# does an initial scan.
 | 
							# does an initial scan.
 | 
				
			||||||
		if [ "${i}" = "0" -a "${txpowerwasoff}" = "0" ] ; then
 | 
							if [ "${i}" = "0" -a "${txpowerwasoff}" = "0" ]; then
 | 
				
			||||||
			case "${scan}" in
 | 
								case "${scan}" in
 | 
				
			||||||
				"'${IFACE} "*"No scan results"*)
 | 
									"'${IFACE} "*"No scan results"*)
 | 
				
			||||||
					sleep 2
 | 
										sleep 2
 | 
				
			||||||
@@ -349,12 +349,12 @@ iwconfig_scan() {
 | 
				
			|||||||
	    i=$((${i} + 1))
 | 
						    i=$((${i} + 1))
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${scan}" ] ; then
 | 
						if [ -z "${scan}" ]; then
 | 
				
			||||||
		ewarn "${iface} does not support scanning"
 | 
							ewarn "${iface} does not support scanning"
 | 
				
			||||||
		eoutdent
 | 
							eoutdent
 | 
				
			||||||
		eval x=\$adhoc_ssid_${IFVAR}
 | 
							eval x=\$adhoc_ssid_${IFVAR}
 | 
				
			||||||
		[ -n "${x}" ] && return 0
 | 
							[ -n "${x}" ] && return 0
 | 
				
			||||||
		if [ -n "${preferred_aps}" ] ; then
 | 
							if [ -n "${preferred_aps}" ]; then
 | 
				
			||||||
			[ "${associate_order}" = "forcepreferred" ] || \
 | 
								[ "${associate_order}" = "forcepreferred" ] || \
 | 
				
			||||||
			[ "${associate_order}" = "forcepreferredonly" ] && return 0
 | 
								[ "${associate_order}" = "forcepreferredonly" ] && return 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -373,12 +373,12 @@ iwconfig_scan() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	APS=-1
 | 
						APS=-1
 | 
				
			||||||
	eval set -- ${scan}
 | 
						eval set -- ${scan}
 | 
				
			||||||
	for line in "$@" ; do
 | 
						for line in "$@"; do
 | 
				
			||||||
		case "${line}" in
 | 
							case "${line}" in
 | 
				
			||||||
			*Address:*)
 | 
								*Address:*)
 | 
				
			||||||
				APS=$((${APS} + 1)) 
 | 
									APS=$((${APS} + 1)) 
 | 
				
			||||||
		    eval MAC_${APS}=\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\"
 | 
									eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
 | 
				
			||||||
		    eval QUALITY_${APS}=0
 | 
									eva	l QUALITY_${APS}=0
 | 
				
			||||||
				;;	
 | 
									;;	
 | 
				
			||||||
			*ESSID:*)
 | 
								*ESSID:*)
 | 
				
			||||||
				x=${line#*\"}
 | 
									x=${line#*\"}
 | 
				
			||||||
@@ -387,8 +387,8 @@ iwconfig_scan() {
 | 
				
			|||||||
				;;
 | 
									;;
 | 
				
			||||||
			*Mode:*)
 | 
								*Mode:*)
 | 
				
			||||||
				x="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]')"
 | 
									x="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]')"
 | 
				
			||||||
		    if [ "${x}" = "master" ] ; then
 | 
									if [ "${x}" = "master" ]; then
 | 
				
			||||||
			eval MODE_${APS}=\"managed\"
 | 
										eval MODE_${APS}=managed
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					eval MODE_${APS}=\$x
 | 
										eval MODE_${APS}=\$x
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
@@ -425,14 +425,14 @@ iwconfig_scan() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Sort based on quality
 | 
						# Sort based on quality
 | 
				
			||||||
	local i=0 k=1 a= b= x= t=
 | 
						local i=0 k=1 a= b= x= t=
 | 
				
			||||||
	while [ ${i} -lt ${APS} ] ; do
 | 
						while [ ${i} -lt ${APS} ]; do
 | 
				
			||||||
	    k=$((${i} + 1))
 | 
						    k=$((${i} + 1))
 | 
				
			||||||
	    while [ ${k} -le ${APS} ] ; do
 | 
						    while [ ${k} -le ${APS} ]; do
 | 
				
			||||||
		eval a=\$QUALITY_${i}
 | 
							eval a=\$QUALITY_${i}
 | 
				
			||||||
		[ -z "${a}" ] && break
 | 
							[ -z "${a}" ] && break
 | 
				
			||||||
		eval b=\$QUALITY_${k}
 | 
							eval b=\$QUALITY_${k}
 | 
				
			||||||
		if [ -n "${b}" -a "${a}" -lt "${b}" ] ; then
 | 
							if [ -n "${b}" -a "${a}" -lt "${b}" ]; then
 | 
				
			||||||
		    for x in MAC SSID CHAN QUALITY ENC ; do
 | 
							    for x in MAC SSID CHAN QUALITY ENC; do
 | 
				
			||||||
			eval t=\$${x}_${i}
 | 
								eval t=\$${x}_${i}
 | 
				
			||||||
			eval ${x}_${i}=\$${x}_${k}
 | 
								eval ${x}_${i}=\$${x}_${k}
 | 
				
			||||||
			eval ${x}_${k}=\$t
 | 
								eval ${x}_${k}=\$t
 | 
				
			||||||
@@ -445,12 +445,12 @@ iwconfig_scan() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Strip any duplicates
 | 
						# Strip any duplicates
 | 
				
			||||||
	local i=0 k=1 a= b=
 | 
						local i=0 k=1 a= b=
 | 
				
			||||||
	while [ ${i} -lt ${APS} ] ; do
 | 
						while [ ${i} -lt ${APS} ]; do
 | 
				
			||||||
		k=$((${i} + 1))
 | 
							k=$((${i} + 1))
 | 
				
			||||||
		while [ ${k} -le ${APS} ] ; do
 | 
							while [ ${k} -le ${APS} ]; do
 | 
				
			||||||
			eval a=\$MAC_${i}
 | 
								eval a=\$MAC_${i}
 | 
				
			||||||
			eval b=\$MAC_${k}
 | 
								eval b=\$MAC_${k}
 | 
				
			||||||
			if [ "${a}" = "${b}" ] ; then
 | 
								if [ "${a}" = "${b}" ]; then
 | 
				
			||||||
				eval a=\$QUALITY_${i}
 | 
									eval a=\$QUALITY_${i}
 | 
				
			||||||
				eval b=\$QUALITY_${k}
 | 
									eval b=\$QUALITY_${k}
 | 
				
			||||||
				local u=${k}
 | 
									local u=${k}
 | 
				
			||||||
@@ -465,9 +465,9 @@ iwconfig_scan() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local i=0 e= m= s=
 | 
						local i=0 e= m= s=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${i} -le ${APS} ] ; do
 | 
						while [ ${i} -le ${APS} ]; do
 | 
				
			||||||
		eval x=\$MAC_${i}
 | 
							eval x=\$MAC_${i}
 | 
				
			||||||
		if [ -z "${x}" ] ; then
 | 
							if [ -z "${x}" ]; then
 | 
				
			||||||
		    i=$((${i} + 1))
 | 
							    i=$((${i} + 1))
 | 
				
			||||||
		    continue
 | 
							    continue
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -476,12 +476,12 @@ iwconfig_scan() {
 | 
				
			|||||||
		eval s=\$SSID_${i}
 | 
							eval s=\$SSID_${i}
 | 
				
			||||||
		eval q=\$QUALITY_${i}
 | 
							eval q=\$QUALITY_${i}
 | 
				
			||||||
		eval e=\$ENC_${i}
 | 
							eval e=\$ENC_${i}
 | 
				
			||||||
		if [ -n "${e}" -a "${e}" != "off" ] ; then
 | 
							if [ -n "${e}" -a "${e}" != "off" ]; then
 | 
				
			||||||
		    e=", encrypted"
 | 
							    e=", encrypted"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
		    e=""
 | 
							    e=""
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if [ -z "${s}" ] ; then
 | 
							if [ -z "${s}" ]; then
 | 
				
			||||||
			einfo "Found ${x}, ${m}${e}"
 | 
								einfo "Found ${x}, ${m}${e}"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			einfo "Found \"${s}\" at ${x}, ${m}${e}"
 | 
								einfo "Found \"${s}\" at ${x}, ${m}${e}"
 | 
				
			||||||
@@ -489,7 +489,7 @@ iwconfig_scan() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		x="$(echo "${x}" | sed -e 's/://g')"
 | 
							x="$(echo "${x}" | sed -e 's/://g')"
 | 
				
			||||||
		eval x=\$mac_ssid_${x}
 | 
							eval x=\$mac_ssid_${x}
 | 
				
			||||||
		if [ -n "${x}" ] ; then
 | 
							if [ -n "${x}" ]; then
 | 
				
			||||||
			eval SSID_${i}=\$x
 | 
								eval SSID_${i}=\$x
 | 
				
			||||||
			s=${x}
 | 
								s=${x}
 | 
				
			||||||
			eindent
 | 
								eindent
 | 
				
			||||||
@@ -500,7 +500,7 @@ iwconfig_scan() {
 | 
				
			|||||||
		eval set -- $(_flatten_array "blacklist_aps_${IFVAR}")
 | 
							eval set -- $(_flatten_array "blacklist_aps_${IFVAR}")
 | 
				
			||||||
		[ $# = 0 ] && eval set -- $(_flatten_array "blacklist_aps")
 | 
							[ $# = 0 ] && eval set -- $(_flatten_array "blacklist_aps")
 | 
				
			||||||
		for x in "$@"; do
 | 
							for x in "$@"; do
 | 
				
			||||||
			if [ "${x}" = "${s}" ] ; then
 | 
								if [ "${x}" = "${s}" ]; then
 | 
				
			||||||
				ewarn "${s} has been blacklisted - not connecting"
 | 
									ewarn "${s} has been blacklisted - not connecting"
 | 
				
			||||||
				unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i}
 | 
									unset SSID_${i} MAC_${i} CHAN_${i} QUALITY_${i} ENC_${i}
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -518,15 +518,15 @@ iwconfig_force_preferred() {
 | 
				
			|||||||
	ewarn "Trying to force preferred in case they are hidden"
 | 
						ewarn "Trying to force preferred in case they are hidden"
 | 
				
			||||||
	for ssid in "$@"; do
 | 
						for ssid in "$@"; do
 | 
				
			||||||
		local found_AP=false i=0 e=
 | 
							local found_AP=false i=0 e=
 | 
				
			||||||
		while [ ${i} -le ${APS} ] ; do
 | 
							while [ ${i} -le ${APS} ]; do
 | 
				
			||||||
			eval e=\$SSID_${i}
 | 
								eval e=\$SSID_${i}
 | 
				
			||||||
			if [ "${e}" = "${ssid}" ] ; then
 | 
								if [ "${e}" = "${ssid}" ]; then
 | 
				
			||||||
				found_AP=true
 | 
									found_AP=true
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			i=$((${i} + 1))
 | 
								i=$((${i} + 1))
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
		if ! ${found_AP} ; then
 | 
							if ! ${found_AP}; then
 | 
				
			||||||
			SSID=${e}
 | 
								SSID=${e}
 | 
				
			||||||
			iwconfig_associate && return 0
 | 
								iwconfig_associate && return 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -544,9 +544,9 @@ iwconfig_connect_preferred() {
 | 
				
			|||||||
	for ssid in "$@"; do
 | 
						for ssid in "$@"; do
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
		i=0
 | 
							i=0
 | 
				
			||||||
		while [ ${i} -le ${APS} ]  ; do
 | 
							while [ ${i} -le ${APS} ]; do
 | 
				
			||||||
			eval e=\$SSID_${i}
 | 
								eval e=\$SSID_${i}
 | 
				
			||||||
			if [ "${e}" = "${ssid}" ] ; then
 | 
								if [ "${e}" = "${ssid}" ]; then
 | 
				
			||||||
				SSID=${e}
 | 
									SSID=${e}
 | 
				
			||||||
				eval mode=\$MODE_${i}
 | 
									eval mode=\$MODE_${i}
 | 
				
			||||||
				eval mac=\$MAC_${i}
 | 
									eval mac=\$MAC_${i}
 | 
				
			||||||
@@ -566,19 +566,19 @@ iwconfig_connect_preferred() {
 | 
				
			|||||||
iwconfig_connect_not_preferred() {
 | 
					iwconfig_connect_not_preferred() {
 | 
				
			||||||
	local ssid= i=0 mode= mac= enc= freq= chan= pref=false
 | 
						local ssid= i=0 mode= mac= enc= freq= chan= pref=false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${i} -le ${APS} ] ; do
 | 
						while [ ${i} -le ${APS} ]; do
 | 
				
			||||||
		eval e=\$SSID_${i}
 | 
							eval e=\$SSID_${i}
 | 
				
			||||||
		if [ -n "${e}" ] ; then
 | 
							if [ -n "${e}" ]; then
 | 
				
			||||||
			eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
 | 
								eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
 | 
				
			||||||
			[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
 | 
								[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
 | 
				
			||||||
			for ssid in "$@"; do
 | 
								for ssid in "$@"; do
 | 
				
			||||||
				if [ "${e}" = "${ssid}" ] ; then
 | 
									if [ "${e}" = "${ssid}" ]; then
 | 
				
			||||||
					pref=true
 | 
										pref=true
 | 
				
			||||||
					break
 | 
										break
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
			if ! ${pref} ; then
 | 
								if ! ${pref}; then
 | 
				
			||||||
				SSID=${e}
 | 
									SSID=${e}
 | 
				
			||||||
				eval mode=\$MODE_${i}
 | 
									eval mode=\$MODE_${i}
 | 
				
			||||||
				eval mac=\$MAC_${i}
 | 
									eval mac=\$MAC_${i}
 | 
				
			||||||
@@ -597,7 +597,7 @@ iwconfig_connect_not_preferred() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
iwconfig_defaults() {
 | 
					iwconfig_defaults() {
 | 
				
			||||||
	local x=
 | 
						local x=
 | 
				
			||||||
	for x in txpower rate rts frag ; do
 | 
						for x in txpower rate rts frag; do
 | 
				
			||||||
	    iwconfig "${IFACE}" "${x}" auto 2>/dev/null
 | 
						    iwconfig "${IFACE}" "${x}" auto 2>/dev/null
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -617,12 +617,12 @@ iwconfig_configure() {
 | 
				
			|||||||
	# Setup ad-hoc mode?
 | 
						# Setup ad-hoc mode?
 | 
				
			||||||
	eval x=\$mode_${IFVAR}
 | 
						eval x=\$mode_${IFVAR}
 | 
				
			||||||
	x=${x:-managed}
 | 
						x=${x:-managed}
 | 
				
			||||||
	if [ "${x}" = "ad-hoc" -o "${x}" = "master" ] ; then
 | 
						if [ "${x}" = "ad-hoc" -o "${x}" = "master" ]; then
 | 
				
			||||||
		iwconfig_setup_specific "${x}"
 | 
							iwconfig_setup_specific "${x}"
 | 
				
			||||||
		return $?
 | 
							return $?
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${x}" != "managed" -a "${x}" != "auto" ] ; then
 | 
						if [ "${x}" != "managed" -a "${x}" != "auto" ]; then
 | 
				
			||||||
		eerror "Only managed, ad-hoc, master and auto modes are supported"
 | 
							eerror "Only managed, ad-hoc, master and auto modes are supported"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -690,13 +690,13 @@ iwconfig_pre_start() {
 | 
				
			|||||||
	save_options "SSID" ""
 | 
						save_options "SSID" ""
 | 
				
			||||||
	_exists || return 0
 | 
						_exists || return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! _is_wireless ; then
 | 
						if ! _is_wireless; then
 | 
				
			||||||
		veinfo "Wireless extensions not found for ${IFACE}"
 | 
							veinfo "Wireless extensions not found for ${IFACE}"
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Warn about old file - we want to punt it really
 | 
						# Warn about old file - we want to punt it really
 | 
				
			||||||
	if [ -e /etc/conf.d/wireless ] ; then
 | 
						if [ -e /etc/conf.d/wireless ]; then
 | 
				
			||||||
		ewarn "/etc/conf.d/wireless is deprecated"
 | 
							ewarn "/etc/conf.d/wireless is deprecated"
 | 
				
			||||||
		ewarn "Please put all settings into /etc/conf.d/net"
 | 
							ewarn "Please put all settings into /etc/conf.d/net"
 | 
				
			||||||
		. /etc/conf.d/wireless
 | 
							. /etc/conf.d/wireless
 | 
				
			||||||
@@ -715,8 +715,8 @@ iwconfig_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Check for rf_kill - only ipw supports this at present, but other
 | 
						# Check for rf_kill - only ipw supports this at present, but other
 | 
				
			||||||
	# cards may in the future.
 | 
						# cards may in the future.
 | 
				
			||||||
	if [ -e /sys/class/net/"${IFACE}"/device/rf_kill ] ; then
 | 
						if [ -e /sys/class/net/"${IFACE}"/device/rf_kill ]; then
 | 
				
			||||||
		if [ $(cat /sys/class/net/"${IFACE}"/device/rf_kill) != "0" ] ; then
 | 
							if [ $(cat /sys/class/net/"${IFACE}"/device/rf_kill) != "0" ]; then
 | 
				
			||||||
			eerror "Wireless radio has been killed for interface ${IFACE}"
 | 
								eerror "Wireless radio has been killed for interface ${IFACE}"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -736,7 +736,7 @@ iwconfig_pre_start() {
 | 
				
			|||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if iwconfig_configure ; then
 | 
						if iwconfig_configure; then
 | 
				
			||||||
		save_options "SSID" "${SSID}"
 | 
							save_options "SSID" "${SSID}"
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -45,15 +45,15 @@ netplugd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# We need a valid MAC address
 | 
						# We need a valid MAC address
 | 
				
			||||||
	# It's a basic test to ensure it's not a virtual interface
 | 
						# It's a basic test to ensure it's not a virtual interface
 | 
				
			||||||
	if ! _get_mac_address >/dev/null 2>/dev/null ; then
 | 
						if ! _get_mac_address >/dev/null 2>&1; then
 | 
				
			||||||
		vewarn "netplug only works on interfaces with a valid MAC address"
 | 
							vewarn "netplug only works on interfaces with a valid MAC address"
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We don't work on bonded, bridges, tun/tap, vlan or wireless
 | 
						# We don't work on bonded, bridges, tun/tap, vlan or wireless
 | 
				
			||||||
	for f in bond bridge tuntap vlan wireless ; do
 | 
						for f in bond bridge tuntap vlan wireless; do
 | 
				
			||||||
		if type "_is_${f}" >/dev/null 2>/dev/null ; then
 | 
							if type "_is_${f}" >/dev/null 2>&1; then
 | 
				
			||||||
			if _is_${f} ; then
 | 
								if _is_${f}; then
 | 
				
			||||||
				veinfo "netplug does not work with" "${f}"
 | 
									veinfo "netplug does not work with" "${f}"
 | 
				
			||||||
				return 0
 | 
									return 0
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -75,28 +75,28 @@ netplugd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	eval timeout=\$plug_timeout_${IFVAR}
 | 
						eval timeout=\$plug_timeout_${IFVAR}
 | 
				
			||||||
	[ -z "${timeout}" ] && timeout=-1
 | 
						[ -z "${timeout}" ] && timeout=-1
 | 
				
			||||||
	if [ ${timeout} -eq 0 ] ; then
 | 
						if [ ${timeout} -eq 0 ]; then
 | 
				
			||||||
		ewarn "WARNING: infinite timeout set for" "${IFACE}" "to come up"
 | 
							ewarn "WARNING: infinite timeout set for ${IFACE} to come up"
 | 
				
			||||||
	elif [ ${timeout} -lt 0 ] ; then
 | 
						elif [ ${timeout} -lt 0 ]; then
 | 
				
			||||||
		einfo "Backgrounding ..."
 | 
							einfo "Backgrounding ..."
 | 
				
			||||||
		exit 1 
 | 
							exit 1 
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	veinfo "Waiting for" "${IFACE}" "to be marked as started"
 | 
						veinfo "Waiting for ${IFACE} to be marked as started"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local i=0
 | 
						local i=0
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		if service_started "${SVCNAME}" ; then
 | 
							if service_started "${SVCNAME}"; then
 | 
				
			||||||
			_show_address
 | 
								_show_address
 | 
				
			||||||
			exit 0
 | 
								exit 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		sleep 1
 | 
							sleep 1
 | 
				
			||||||
		[ ${timeout} -eq 0 ]] && continue
 | 
							[ ${timeout} -eq 0 ] && continue
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
		[ ${i} -ge ${timeout} ] && break
 | 
							[ ${i} -ge ${timeout} ] && break
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	eend 1 "Failed to configure" "${IFACE}" "in the background"
 | 
						eend 1 "Failed to configure ${IFACE} in the background"
 | 
				
			||||||
	exit 1
 | 
						exit 1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -49,7 +49,7 @@ pppd_pre_start() {
 | 
				
			|||||||
		local config=
 | 
							local config=
 | 
				
			||||||
		eval config=\$config_${IFVAR}
 | 
							eval config=\$config_${IFVAR}
 | 
				
			||||||
		# If no config for ppp then don't default to DHCP 
 | 
							# If no config for ppp then don't default to DHCP 
 | 
				
			||||||
		if [ -z "${config}" ] ; then
 | 
							if [ -z "${config}" ]; then
 | 
				
			||||||
			eval config_${IFVAR}=null
 | 
								eval config_${IFVAR}=null
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
@@ -66,7 +66,7 @@ pppd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	case "${link}" in
 | 
						case "${link}" in
 | 
				
			||||||
		/*)
 | 
							/*)
 | 
				
			||||||
			if [ ! -e "${link}" ] ; then
 | 
								if [ ! -e "${link}" ]; then
 | 
				
			||||||
				eerror "${link} does not exist"
 | 
									eerror "${link} does not exist"
 | 
				
			||||||
				eerror "Please verify hardware or kernel module (driver)"
 | 
									eerror "Please verify hardware or kernel module (driver)"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
@@ -74,7 +74,7 @@ pppd_pre_start() {
 | 
				
			|||||||
			;;
 | 
								;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${unit}" ] ; then
 | 
						if [ -z "${unit}" ]; then
 | 
				
			||||||
		eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
 | 
							eerror "PPP requires a unit - use net.ppp[0-9] instead of net.ppp"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -91,12 +91,12 @@ pppd_pre_start() {
 | 
				
			|||||||
				eerror "The option \"${i}\" is not allowed in pppd_${IFVAR}"
 | 
									eerror "The option \"${i}\" is not allowed in pppd_${IFVAR}"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
			defaultmetric) hasdefaultmetric=true ;;
 | 
								defaultmetric) hasdefaultmetric=true;;
 | 
				
			||||||
			mtu) hasmtu=true ;;
 | 
								mtu) hasmtu=true;;
 | 
				
			||||||
			mru) hasmru=true ;;
 | 
								mru) hasmru=true;;
 | 
				
			||||||
			maxfail) hasmaxfail=true ;;
 | 
								maxfail) hasmaxfail=true;;
 | 
				
			||||||
			persist) haspersist=true ;;
 | 
								persist) haspersist=true;;
 | 
				
			||||||
			updetach) hasupdetach=true ;;
 | 
								updetach) hasupdetach=true;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -106,17 +106,17 @@ pppd_pre_start() {
 | 
				
			|||||||
	eval password=\$password_${IFVAR}
 | 
						eval password=\$password_${IFVAR}
 | 
				
			||||||
	eval passwordset=\$\{password_${IFVAR}-x\}
 | 
						eval passwordset=\$\{password_${IFVAR}-x\}
 | 
				
			||||||
	if [ -n "${username}" ] \
 | 
						if [ -n "${username}" ] \
 | 
				
			||||||
	&& [ -n "${password}" -o -z "${passwordset}" ] ; then
 | 
						&& [ -n "${password}" -o -z "${passwordset}" ]; then
 | 
				
			||||||
		opts="${opts} plugin passwordfd.so passwordfd 0"
 | 
							opts="${opts} plugin passwordfd.so passwordfd 0"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if ! ${hasdefaultmetric} ; then
 | 
						if ! ${hasdefaultmetric}; then
 | 
				
			||||||
		local m=
 | 
							local m=
 | 
				
			||||||
		eval m=\$metric_${IFVAR}
 | 
							eval m=\$metric_${IFVAR}
 | 
				
			||||||
		[ -z "${m}" ] && m=$((${metric} + $(_ifindex)))
 | 
							[ -z "${m}" ] && m=$((${metric} + $(_ifindex)))
 | 
				
			||||||
		opts="${opts} defaultmetric ${m}"
 | 
							opts="${opts} defaultmetric ${m}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if [ -n "${mtu}" ] ; then
 | 
						if [ -n "${mtu}" ]; then
 | 
				
			||||||
		${hasmtu} || opts="${opts} mtu ${mtu}"
 | 
							${hasmtu} || opts="${opts} mtu ${mtu}"
 | 
				
			||||||
		${hasmru} || opts="${opts} mru ${mtu}"
 | 
							${hasmru} || opts="${opts} mru ${mtu}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -129,7 +129,7 @@ pppd_pre_start() {
 | 
				
			|||||||
	opts="linkname ${IFACE} ${opts}"
 | 
						opts="linkname ${IFACE} ${opts}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Setup auth info
 | 
						# Setup auth info
 | 
				
			||||||
	if [ -n "${username}" ] ; then
 | 
						if [ -n "${username}" ]; then
 | 
				
			||||||
		opts="user '${username}' remotename ${IFACE} ${opts}"
 | 
							opts="user '${username}' remotename ${IFACE} ${opts}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -160,15 +160,15 @@ pppd_pre_start() {
 | 
				
			|||||||
		set -- ${i}
 | 
							set -- ${i}
 | 
				
			||||||
		case "$1" in
 | 
							case "$1" in
 | 
				
			||||||
			passwordfd) continue;;
 | 
								passwordfd) continue;;
 | 
				
			||||||
			pppoa) shift; set -- "pppoatm" "$@" ;;
 | 
								pppoa) shift; set -- "pppoatm" "$@";;
 | 
				
			||||||
			pppoe) shift; set -- "rp-pppoe" "$@" ;;
 | 
								pppoe) shift; set -- "rp-pppoe" "$@";;
 | 
				
			||||||
			capi) shift; set -- "capiplugin" "$@" ;;
 | 
								capi) shift; set -- "capiplugin" "$@";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		case "$1" in
 | 
							case "$1" in
 | 
				
			||||||
			rp-pppoe) haspppoe=true ;;
 | 
								rp-pppoe) haspppoe=true;;
 | 
				
			||||||
			pppoatm)  haspppoa=true ;;
 | 
								pppoatm)  haspppoa=true;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		if [ "$1" = "rp-pppoe" ] || [ "$1" = "pppoatm" -a "${link}" != "/dev/null" ] ; then
 | 
							if [ "$1" = "rp-pppoe" ] || [ "$1" = "pppoatm" -a "${link}" != "/dev/null" ]; then
 | 
				
			||||||
			opts="${opts} connect true"
 | 
								opts="${opts} connect true"
 | 
				
			||||||
			set -- "$@" "${link}"
 | 
								set -- "$@" "${link}"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -180,30 +180,30 @@ pppd_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	#Specialized stuff. Insert here actions particular to connection type (pppoe,pppoa,capi)
 | 
						#Specialized stuff. Insert here actions particular to connection type (pppoe,pppoa,capi)
 | 
				
			||||||
	local insert_link_in_opts=1
 | 
						local insert_link_in_opts=1
 | 
				
			||||||
	if ${haspppoe} ; then
 | 
						if ${haspppoe}; then
 | 
				
			||||||
		if [ ! -e /proc/net/pppoe ] ; then
 | 
							if [ ! -e /proc/net/pppoe ]; then
 | 
				
			||||||
			# Load the PPPoE kernel module
 | 
								# Load the PPPoE kernel module
 | 
				
			||||||
			if ! modprobe pppoe ; then
 | 
								if ! modprobe pppoe; then
 | 
				
			||||||
				eerror "kernel does not support PPPoE"
 | 
									eerror "kernel does not support PPPoE"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Ensure that the link exists and is up
 | 
							# Ensure that the link exists and is up
 | 
				
			||||||
		( IFACE="${link}" ; _exists true && _up ) || return 1
 | 
							( IFACE="${link}"; _exists true && _up ) || return 1
 | 
				
			||||||
		insert_link_in_opts=0
 | 
							insert_link_in_opts=0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ${haspppoa} ; then
 | 
						if ${haspppoa}; then
 | 
				
			||||||
		if [ ! -d /proc/net/atm ] ; then
 | 
							if [ ! -d /proc/net/atm ]; then
 | 
				
			||||||
			# Load the PPPoA kernel module
 | 
								# Load the PPPoA kernel module
 | 
				
			||||||
			if ! modprobe pppoatm ; then
 | 
								if ! modprobe pppoatm; then
 | 
				
			||||||
				eerror "kernel does not support PPPoATM"
 | 
									eerror "kernel does not support PPPoATM"
 | 
				
			||||||
				return 1
 | 
									return 1
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ "${link}" != "/dev/null" ] ; then
 | 
							if [ "${link}" != "/dev/null" ]; then
 | 
				
			||||||
			insert_link_in_opts=0
 | 
								insert_link_in_opts=0
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			ewarn "WARNING: An [itf.]vpi.vci ATM address was expected in link_${IFVAR}"
 | 
								ewarn "WARNING: An [itf.]vpi.vci ATM address was expected in link_${IFVAR}"
 | 
				
			||||||
@@ -215,7 +215,7 @@ pppd_pre_start() {
 | 
				
			|||||||
	ebegin "Starting pppd in ${IFACE}"
 | 
						ebegin "Starting pppd in ${IFACE}"
 | 
				
			||||||
	mark_service_inactive "${SVCNAME}"
 | 
						mark_service_inactive "${SVCNAME}"
 | 
				
			||||||
	if [ -n "${username}" ] \
 | 
						if [ -n "${username}" ] \
 | 
				
			||||||
	&& [ -n "${password}" -o -z "${passwordset}" ] ; then
 | 
						&& [ -n "${password}" -o -z "${passwordset}" ]; then
 | 
				
			||||||
		printf "%s" "${password}" | \
 | 
							printf "%s" "${password}" | \
 | 
				
			||||||
		eval start-stop-daemon --start --exec /usr/sbin/pppd \
 | 
							eval start-stop-daemon --start --exec /usr/sbin/pppd \
 | 
				
			||||||
			--pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null
 | 
								--pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null
 | 
				
			||||||
@@ -224,12 +224,12 @@ pppd_pre_start() {
 | 
				
			|||||||
			--pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null
 | 
								--pidfile "/var/run/ppp-${IFACE}.pid" -- "${opts}" >/dev/null
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! eend $? "Failed to start PPP" ; then
 | 
						if ! eend $? "Failed to start PPP"; then
 | 
				
			||||||
		mark_service_stopped "net.${IFACE}"
 | 
							mark_service_stopped "net.${IFACE}"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ${hasupdetach} ; then
 | 
						if ${hasupdetach}; then
 | 
				
			||||||
		_show_address
 | 
							_show_address
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		einfo "Backgrounding ..."
 | 
							einfo "Backgrounding ..."
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,11 +39,11 @@ pump_start() {
 | 
				
			|||||||
	[ -z "${opts}" ] && opts=${dhcp}
 | 
						[ -z "${opts}" ] && opts=${dhcp}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Map some generic options to dhcpcd
 | 
						# Map some generic options to dhcpcd
 | 
				
			||||||
	for opt in ${opts} ; do
 | 
						for opt in ${opts}; do
 | 
				
			||||||
		case "${opt}" in
 | 
							case "${opt}" in
 | 
				
			||||||
			nodns) args="${args} --no-dns" ;;
 | 
								nodns) args="${args} --no-dns";;
 | 
				
			||||||
			nontp) args="${args} --no-ntp" ;;
 | 
								nontp) args="${args} --no-ntp";;
 | 
				
			||||||
			nogateway) args="${args} --no-gateway" ;;
 | 
								nogateway) args="${args} --no-gateway";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -67,7 +67,7 @@ pump_stop() {
 | 
				
			|||||||
	start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0
 | 
						start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Check that pump is running on the interface
 | 
						# Check that pump is running on the interface
 | 
				
			||||||
	if ! pump --status --interface "${IFACE}" >/dev/null 2>/dev/null ; then 
 | 
						if ! pump --status --interface "${IFACE}" >/dev/null 2>&1; then 
 | 
				
			||||||
		return 0
 | 
							return 0
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,11 +42,11 @@ udhcpc_start() {
 | 
				
			|||||||
	[ -z "${opts}" ] && opts=${dhcp}
 | 
						[ -z "${opts}" ] && opts=${dhcp}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Map some generic options to dhcpcd
 | 
						# Map some generic options to dhcpcd
 | 
				
			||||||
	for opt in ${opts} ; do
 | 
						for opt in ${opts}; do
 | 
				
			||||||
		case "${opt}" in
 | 
							case "${opt}" in
 | 
				
			||||||
			nodns) args="${args} --env PEER_DNS=no" ;;
 | 
								nodns) args="${args} --env PEER_DNS=no";;
 | 
				
			||||||
			nontp) args="${args} --env PEER_NTP=no" ;;
 | 
								nontp) args="${args} --env PEER_NTP=no";;
 | 
				
			||||||
			nogateway) args="${args} --env PEER_ROUTERS=no" ;;
 | 
								nogateway) args="${args} --env PEER_ROUTERS=no";;
 | 
				
			||||||
			nosendhost) sendhost=false;
 | 
								nosendhost) sendhost=false;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -58,27 +58,27 @@ udhcpc_start() {
 | 
				
			|||||||
	# Try and load the cache if it exists
 | 
						# Try and load the cache if it exists
 | 
				
			||||||
	if [ -f "${cachefile}" ]; then
 | 
						if [ -f "${cachefile}" ]; then
 | 
				
			||||||
		case "$ {args} " in
 | 
							case "$ {args} " in
 | 
				
			||||||
			*" --request="*|*" -r "*) ;;
 | 
								*" --request="*|*" -r "*);;
 | 
				
			||||||
			*)
 | 
								*)
 | 
				
			||||||
				local x=$(cat "${cachefile}")
 | 
									local x=$(cat "${cachefile}")
 | 
				
			||||||
				# Check for a valid ip
 | 
									# Check for a valid ip
 | 
				
			||||||
				case "${x}" in
 | 
									case "${x}" in
 | 
				
			||||||
					*.*.*.*) args="${args} --request=${x}" ;;
 | 
										*.*.*.*) args="${args} --request=${x}";;
 | 
				
			||||||
				esac
 | 
									esac
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case " ${args} " in
 | 
						case " ${args} " in
 | 
				
			||||||
		*" --quit "*|*" -q "*) x="/sbin/udhcpc" ;;
 | 
							*" --quit "*|*" -q "*) x="/sbin/udhcpc";;
 | 
				
			||||||
		*) x="start-stop-daemon --start --exec /sbin/udhcpc \
 | 
							*) x="start-stop-daemon --start --exec /sbin/udhcpc \
 | 
				
			||||||
			--pidfile \"${pidfile}\" --" ;;
 | 
								--pidfile \"${pidfile}\" --";;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case " ${args} " in
 | 
						case " ${args} " in
 | 
				
			||||||
		*" --hosname="*|*" -h "*|*" -H "*) ;;
 | 
							*" --hosname="*|*" -h "*|*" -H "*);;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
			if ${sendhost} ; then
 | 
								if ${sendhost}; then
 | 
				
			||||||
				local hname="$(hostname)"
 | 
									local hname="$(hostname)"
 | 
				
			||||||
				if [ "${hname}" != "(none)" ] && [ "${hname}" != "localhost" ]; then
 | 
									if [ "${hname}" != "(none)" ] && [ "${hname}" != "localhost" ]; then
 | 
				
			||||||
					args="${args} --hostname='${hname}'"
 | 
										args="${args} --hostname='${hname}'"
 | 
				
			||||||
@@ -112,7 +112,7 @@ udhcpc_stop() {
 | 
				
			|||||||
		*" release "*)
 | 
							*" release "*)
 | 
				
			||||||
			start-stop-daemon --stop --quiet --oknodo --signal USR2 \
 | 
								start-stop-daemon --stop --quiet --oknodo --signal USR2 \
 | 
				
			||||||
				--exec /sbin/udhcpc --pidfile "${pidfile}"
 | 
									--exec /sbin/udhcpc --pidfile "${pidfile}"
 | 
				
			||||||
			if [ -f /var/cache/udhcpc-"${IFACE}".lease ] ; then
 | 
								if [ -f /var/cache/udhcpc-"${IFACE}".lease ]; then
 | 
				
			||||||
				rm -f /var/cache/udhcpc-"${IFACE}".lease
 | 
									rm -f /var/cache/udhcpc-"${IFACE}".lease
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,9 +43,9 @@ _get_vlans() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_check_vlan() {
 | 
					_check_vlan() {
 | 
				
			||||||
	if [ ! -d /proc/net/vlan ] ; then
 | 
						if [ ! -d /proc/net/vlan ]; then
 | 
				
			||||||
		modprobe 8021q
 | 
							modprobe 8021q
 | 
				
			||||||
		if [ ! -d /proc/net/vlan ] ; then
 | 
							if [ ! -d /proc/net/vlan ]; then
 | 
				
			||||||
			eerror "VLAN (802.1q) support is not present in this kernel"
 | 
								eerror "VLAN (802.1q) support is not present in this kernel"
 | 
				
			||||||
			return 1
 | 
								return 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -64,7 +64,7 @@ vlan_pre_start() {
 | 
				
			|||||||
	for v in ${vc}; do
 | 
						for v in ${vc}; do
 | 
				
			||||||
		unset IFS
 | 
							unset IFS
 | 
				
			||||||
		case "${v}" in
 | 
							case "${v}" in
 | 
				
			||||||
			set_name_type" "*) x=${v} ;;
 | 
								set_name_type" "*) x=${v};;
 | 
				
			||||||
			*)
 | 
								*)
 | 
				
			||||||
				set -- ${v}
 | 
									set -- ${v}
 | 
				
			||||||
				x="$1 ${IFACE}"
 | 
									x="$1 ${IFACE}"
 | 
				
			||||||
@@ -92,7 +92,7 @@ vlan_post_start() {
 | 
				
			|||||||
	for vlan in ${vlans}; do
 | 
						for vlan in ${vlans}; do
 | 
				
			||||||
		einfo "Adding VLAN ${vlan} to ${IFACE}"
 | 
							einfo "Adding VLAN ${vlan} to ${IFACE}"
 | 
				
			||||||
		e="$(vconfig add "${IFACE}" "${vlan}" 2>&1 1>/dev/null)"
 | 
							e="$(vconfig add "${IFACE}" "${vlan}" 2>&1 1>/dev/null)"
 | 
				
			||||||
		if [ -n "${e}" ] ; then
 | 
							if [ -n "${e}" ]; then
 | 
				
			||||||
			eend 1 "${e}"
 | 
								eend 1 "${e}"
 | 
				
			||||||
			continue
 | 
								continue
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,19 +40,19 @@ dhclient_start() {
 | 
				
			|||||||
	[ -z "${opts}" ] && opts=${dhcp}
 | 
						[ -z "${opts}" ] && opts=${dhcp}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Map some generic options to dhcpcd
 | 
						# Map some generic options to dhcpcd
 | 
				
			||||||
	for opt in ${opts} ; do
 | 
						for opt in ${opts}; do
 | 
				
			||||||
		case "${opt}" in
 | 
							case "${opt}" in
 | 
				
			||||||
			nodns) args="${args} -e PEER_DNS=no" ;;
 | 
								nodns) args="${args} -e PEER_DNS=no";;
 | 
				
			||||||
			nontp) args="${args} -e PEER_NTP=no" ;;
 | 
								nontp) args="${args} -e PEER_NTP=no";;
 | 
				
			||||||
			nogateway) args="${args} -e PEER_ROUTERS=no" ;;
 | 
								nogateway) args="${args} -e PEER_ROUTERS=no";;
 | 
				
			||||||
			nosendhost) sendhost=false ;;
 | 
								nosendhost) sendhost=false;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Add our route metric
 | 
						# Add our route metric
 | 
				
			||||||
	[ "${metric:-0}" != "0" ] && args="${args} -e IF_METRIC=${metric}"
 | 
						[ "${metric:-0}" != "0" ] && args="${args} -e IF_METRIC=${metric}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ${sendhost} ; then
 | 
						if ${sendhost}; then
 | 
				
			||||||
		local hname="$(hostname)"
 | 
							local hname="$(hostname)"
 | 
				
			||||||
		if [ "${hname}" != "(none)" -a "${hname}" != "localhost" ]; then
 | 
							if [ "${hname}" != "(none)" -a "${hname}" != "localhost" ]; then
 | 
				
			||||||
			dhconf="${dhconf} interface \"${IFACE}\" {"
 | 
								dhconf="${dhconf} interface \"${IFACE}\" {"
 | 
				
			||||||
@@ -76,14 +76,14 @@ dhclient_stop() {
 | 
				
			|||||||
	[ ! -f "${pidfile}" ] && return 0
 | 
						[ ! -f "${pidfile}" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Get our options
 | 
						# Get our options
 | 
				
			||||||
	if [ -x /sbin/dhclient ] ; then
 | 
						if [ -x /sbin/dhclient ]; then
 | 
				
			||||||
		eval opts=\$dhcp_${IFVAR}
 | 
							eval opts=\$dhcp_${IFVAR}
 | 
				
			||||||
		[ -z "${opts}" ] && opts=${dhcp}
 | 
							[ -z "${opts}" ] && opts=${dhcp}
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ebegin "Stopping dhclient on ${IFACE}"
 | 
						ebegin "Stopping dhclient on ${IFACE}"
 | 
				
			||||||
	case " ${opts} " in
 | 
						case " ${opts} " in
 | 
				
			||||||
		*" release "*) dhclient -q -r -pf "${pidfile}" "${IFACE}" ;;
 | 
							*" release "*) dhclient -q -r -pf "${pidfile}" "${IFACE}";;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
			start-stop-daemon --stop --quiet \
 | 
								start-stop-daemon --stop --quiet \
 | 
				
			||||||
				--exec /sbin/dhclient --pidfile "${pidfile}"
 | 
									--exec /sbin/dhclient --pidfile "${pidfile}"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,12 +44,12 @@ dhcpcd_start() {
 | 
				
			|||||||
	[ -z "${opts}" ] && opts=${dhcp}
 | 
						[ -z "${opts}" ] && opts=${dhcp}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Map some generic options to dhcpcd
 | 
						# Map some generic options to dhcpcd
 | 
				
			||||||
	for opt in ${opts} ; do
 | 
						for opt in ${opts}; do
 | 
				
			||||||
		case "${opt}" in
 | 
							case "${opt}" in
 | 
				
			||||||
			nodns) args="${args} -R" ;;
 | 
								nodns) args="${args} -R";;
 | 
				
			||||||
			nontp) args="${args} -N" ;;
 | 
								nontp) args="${args} -N";;
 | 
				
			||||||
			nonis) args="${args} -Y" ;;
 | 
								nonis) args="${args} -Y";;
 | 
				
			||||||
			nogateway) args="${args} -G" ;;
 | 
								nogateway) args="${args} -G";;
 | 
				
			||||||
			nosendhost) args="${args} -h ''";
 | 
								nosendhost) args="${args} -h ''";
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ macchanger_pre_start() {
 | 
				
			|||||||
		[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f])
 | 
							[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f])
 | 
				
			||||||
			# We don't need macchanger to change to a specific mac address
 | 
								# We don't need macchanger to change to a specific mac address
 | 
				
			||||||
			_set_mac_address "${mac}"
 | 
								_set_mac_address "${mac}"
 | 
				
			||||||
			if eend "$?" ; then
 | 
								if eend "$?"; then
 | 
				
			||||||
				mac=$(_get_mac_address)
 | 
									mac=$(_get_mac_address)
 | 
				
			||||||
				eindent
 | 
									eindent
 | 
				
			||||||
				einfo "changed to ${mac}"
 | 
									einfo "changed to ${mac}"
 | 
				
			||||||
@@ -62,25 +62,25 @@ macchanger_pre_start() {
 | 
				
			|||||||
			;;
 | 
								;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# increment MAC address, default macchanger behavior
 | 
							# increment MAC address, default macchanger behavior
 | 
				
			||||||
		increment) opts="${opts}" ;;
 | 
							increment) opts="${opts}";;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# randomize just the ending bytes
 | 
							# randomize just the ending bytes
 | 
				
			||||||
		random-ending) opts="${opts} -e" ;;
 | 
							random-ending) opts="${opts} -e";;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# keep the same kind of physical layer (eg fibre, copper)
 | 
							# keep the same kind of physical layer (eg fibre, copper)
 | 
				
			||||||
		random-samekind) opts="${opts} -a" ;;
 | 
							random-samekind) opts="${opts} -a";;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# randomize to any known vendor of any physical layer type
 | 
							# randomize to any known vendor of any physical layer type
 | 
				
			||||||
		random-anykind) opts="${opts} -A" ;;
 | 
							random-anykind) opts="${opts} -A";;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# fully random bytes
 | 
							# fully random bytes
 | 
				
			||||||
		random-full|random) opts="${opts} -r" ;;
 | 
							random-full|random) opts="${opts} -r";;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# default case is just to pass on all the options
 | 
							# default case is just to pass on all the options
 | 
				
			||||||
		*) opts="${opts} ${mac}" ;;
 | 
							*) opts="${opts} ${mac}";;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ! -x /sbin/macchanger ] ; then
 | 
						if [ ! -x /sbin/macchanger ]; then
 | 
				
			||||||
		eerror "For changing MAC addresses, emerge net-analyzer/macchanger"
 | 
							eerror "For changing MAC addresses, emerge net-analyzer/macchanger"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -90,12 +90,12 @@ macchanger_pre_start() {
 | 
				
			|||||||
	_up
 | 
						_up
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Sometimes the interface needs to be up ....
 | 
						# Sometimes the interface needs to be up ....
 | 
				
			||||||
	if [ -z "${mac}" ] ; then
 | 
						if [ -z "${mac}" ]; then
 | 
				
			||||||
		mac=$(/sbin/macchanger ${opts} "${IFACE}" \
 | 
							mac=$(/sbin/macchanger ${opts} "${IFACE}" \
 | 
				
			||||||
			| sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )
 | 
								| sed -n -e 's/^Faked MAC:.*\<\(..:..:..:..:..:..\)\>.*/\U\1/p' )
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${mac}" ] ; then
 | 
						if [ -z "${mac}" ]; then
 | 
				
			||||||
		eend 1 "Failed to set MAC address"
 | 
							eend 1 "Failed to set MAC address"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -57,7 +57,7 @@ _system_dns() {
 | 
				
			|||||||
	[ -n "${domain}" ] && buffer="${buffer}domain ${domain}\n"
 | 
						[ -n "${domain}" ] && buffer="${buffer}domain ${domain}\n"
 | 
				
			||||||
	[ -n "${search}" ] && buffer="${buffer}search ${search}\n"
 | 
						[ -n "${search}" ] && buffer="${buffer}search ${search}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for x in ${servers} ; do
 | 
						for x in ${servers}; do
 | 
				
			||||||
		buffer="${buffer}nameserver ${x}\n"
 | 
							buffer="${buffer}nameserver ${x}\n"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -65,7 +65,7 @@ _system_dns() {
 | 
				
			|||||||
	[ -n "${options}" ] && buffer="${buffer}options ${options}\n"
 | 
						[ -n "${options}" ] && buffer="${buffer}options ${options}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Support resolvconf if we have it.
 | 
						# Support resolvconf if we have it.
 | 
				
			||||||
	if [ -x /sbin/resolvconf ] ; then
 | 
						if [ -x /sbin/resolvconf ]; then
 | 
				
			||||||
		printf "${buffer}" | resolvconf -a "${IFACE}"
 | 
							printf "${buffer}" | resolvconf -a "${IFACE}"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		printf "${buffer}" > /etc/resolv.conf
 | 
							printf "${buffer}" > /etc/resolv.conf
 | 
				
			||||||
@@ -84,7 +84,7 @@ _system_ntp() {
 | 
				
			|||||||
	buffer="${buffer}restrict default noquery notrust nomodify\n"
 | 
						buffer="${buffer}restrict default noquery notrust nomodify\n"
 | 
				
			||||||
	buffer="${buffer}restrict 127.0.0.1\n"
 | 
						buffer="${buffer}restrict 127.0.0.1\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for x in ${servers} ; do
 | 
						for x in ${servers}; do
 | 
				
			||||||
		buffer="${buffer}restrict ${x} nomodify notrap noquery\n"
 | 
							buffer="${buffer}restrict ${x} nomodify notrap noquery\n"
 | 
				
			||||||
		buffer="${buffer}server ${x}\n"
 | 
							buffer="${buffer}server ${x}\n"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -109,17 +109,17 @@ _system_nis() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	buffer="# Generated by net-scripts for interface ${iface}\n"
 | 
						buffer="# Generated by net-scripts for interface ${iface}\n"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -n "${domain}" ] ; then
 | 
						if [ -n "${domain}" ]; then
 | 
				
			||||||
		hostname -y "${domain}"
 | 
							hostname -y "${domain}"
 | 
				
			||||||
		if [ -n "${servers}" ] ; then
 | 
							if [ -n "${servers}" ]; then
 | 
				
			||||||
			for x in ${servers} ; do
 | 
								for x in ${servers}; do
 | 
				
			||||||
				buffer="${buffer}domain ${domain} server ${x}\n"
 | 
									buffer="${buffer}domain ${domain} server ${x}\n"
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			buffer="${buffer}domain ${domain} broadcast\n"
 | 
								buffer="${buffer}domain ${domain} broadcast\n"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		for x in ${servers} ; do
 | 
							for x in ${servers}; do
 | 
				
			||||||
			buffer="${buffer}ypserver ${x}\n"
 | 
								buffer="${buffer}ypserver ${x}\n"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,13 +39,13 @@ wpa_supplicant_depend() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Only set these functions if not set already
 | 
					# Only set these functions if not set already
 | 
				
			||||||
# IE, prefer to use iwconfig
 | 
					# IE, prefer to use iwconfig
 | 
				
			||||||
if ! type _get_ssid >/dev/null 2>/dev/null ; then
 | 
					if ! type _get_ssid >/dev/null 2>&1; then
 | 
				
			||||||
_get_ssid() {
 | 
					_get_ssid() {
 | 
				
			||||||
	local timeout=5 ssid=
 | 
						local timeout=5 ssid=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while [ ${timeout} -gt 0 ] ;do
 | 
						while [ ${timeout} -gt 0 ]; do
 | 
				
			||||||
		ssid=$(wpa_cli -i"${IFACE}" status | sed -n -e 's/^ssid=//p')
 | 
							ssid=$(wpa_cli -i"${IFACE}" status | sed -n -e 's/^ssid=//p')
 | 
				
			||||||
		if [ -n "${ssid}" ] ; then
 | 
							if [ -n "${ssid}" ]; then
 | 
				
			||||||
			echo "${ssid}"
 | 
								echo "${ssid}"
 | 
				
			||||||
			return 0
 | 
								return 0
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -74,14 +74,14 @@ wpa_supplicant_pre_start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	eval opts=\$wpa_supplicant_${IFVAR}
 | 
						eval opts=\$wpa_supplicant_${IFVAR}
 | 
				
			||||||
	case " ${opts} " in
 | 
						case " ${opts} " in
 | 
				
			||||||
		*" -Dwired "*) ;;
 | 
							*" -Dwired "*);;
 | 
				
			||||||
		*) _is_wireless || return 0;;
 | 
							*) _is_wireless || return 0;;
 | 
				
			||||||
	esac
 | 
						esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# We don't configure wireless if we're being called from
 | 
						# We don't configure wireless if we're being called from
 | 
				
			||||||
	# the background unless we're not currently running
 | 
						# the background unless we're not currently running
 | 
				
			||||||
	if yesno ${IN_BACKGROUND}; then
 | 
						if yesno ${IN_BACKGROUND}; then
 | 
				
			||||||
		if service_started_daemon "${SVCNAME}" /sbin/wpa_supplicant ; then
 | 
							if service_started_daemon "${SVCNAME}" /sbin/wpa_supplicant; then
 | 
				
			||||||
			SSID=$(_get_ssid "${IFACE}")
 | 
								SSID=$(_get_ssid "${IFACE}")
 | 
				
			||||||
			SSIDVAR=$(_shell_var "${SSID}")
 | 
								SSIDVAR=$(_shell_var "${SSID}")
 | 
				
			||||||
			save_options "SSID" "${SSID}"
 | 
								save_options "SSID" "${SSID}"
 | 
				
			||||||
@@ -91,19 +91,19 @@ wpa_supplicant_pre_start() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	save_options "SSID" ""
 | 
						save_options "SSID" ""
 | 
				
			||||||
	ebegin "Starting wpa_supplicant on" "${IFVAR}"
 | 
						ebegin "Starting wpa_supplicant on ${IFVAR}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -x /sbin/iwconfig ] ; then
 | 
						if [ -x /sbin/iwconfig ]; then
 | 
				
			||||||
		local x=
 | 
							local x=
 | 
				
			||||||
		for x in txpower rate rts frag ; do
 | 
							for x in txpower rate rts frag; do
 | 
				
			||||||
			iwconfig "${IFACE}" "${x}" auto 2>/dev/null
 | 
								iwconfig "${IFACE}" "${x}" auto 2>/dev/null
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	cfgfile=${opts##* -c}
 | 
						cfgfile=${opts##* -c}
 | 
				
			||||||
	if [ -n "${cfgfile}" -a "${cfgfile}" != "${opts}" ] ; then
 | 
						if [ -n "${cfgfile}" -a "${cfgfile}" != "${opts}" ]; then
 | 
				
			||||||
		case "${cfgfile}" in
 | 
							case "${cfgfile}" in
 | 
				
			||||||
			" "*) cfgfile=${cfgfile# *} ;;
 | 
								" "*) cfgfile=${cfgfile# *};;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		cfgfile=${cfgfile%% *}
 | 
							cfgfile=${cfgfile%% *}
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
@@ -116,18 +116,18 @@ wpa_supplicant_pre_start() {
 | 
				
			|||||||
		opts="${opts} -c ${cfgfile}"
 | 
							opts="${opts} -c ${cfgfile}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ! -f ${cfgfile} ] ; then
 | 
						if [ ! -f ${cfgfile} ]; then
 | 
				
			||||||
		eend 1 "/etc/wpa_supplicant/wpa_supplicant.conf not found"
 | 
							eend 1 "/etc/wpa_supplicant/wpa_supplicant.conf not found"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Work out where the ctrl_interface dir is if it's not specified
 | 
						# Work out where the ctrl_interface dir is if it's not specified
 | 
				
			||||||
	local ctrl_dir=$(sed -n -e 's/[[:space:]]*#.*//g;s/[[:space:]]*$//g;s/^ctrl_interface=//p' "${cfgfile}")
 | 
						local ctrl_dir=$(sed -n -e 's/[[:space:]]*#.*//g;s/[[:space:]]*$//g;s/^ctrl_interface=//p' "${cfgfile}")
 | 
				
			||||||
	if [ -z "${ctrl_dir}" ] ; then
 | 
						if [ -z "${ctrl_dir}" ]; then
 | 
				
			||||||
		ctrl_dir=${opts##* -C}
 | 
							ctrl_dir=${opts##* -C}
 | 
				
			||||||
		if [ -n "${ctrl_dir}" -a "${ctrl_dir}" != "${opts}" ] ; then
 | 
							if [ -n "${ctrl_dir}" -a "${ctrl_dir}" != "${opts}" ]; then
 | 
				
			||||||
			case "${ctrl_dir}" in
 | 
								case "${ctrl_dir}" in
 | 
				
			||||||
				" "*) ctrl_dir=${ctrl_dir# *} ;;
 | 
									" "*) ctrl_dir=${ctrl_dir# *};;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
			ctrl_dir=${ctrl_dir%% *}
 | 
								ctrl_dir=${ctrl_dir%% *}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
@@ -166,7 +166,7 @@ wpa_supplicant_pre_start() {
 | 
				
			|||||||
		--pidfile "/var/run/wpa_cli-${IFACE}.pid" \
 | 
							--pidfile "/var/run/wpa_cli-${IFACE}.pid" \
 | 
				
			||||||
		-- -a /etc/wpa_supplicant/wpa_cli.sh -p "${ctrl_dir}" -i "${IFACE}" \
 | 
							-- -a /etc/wpa_supplicant/wpa_cli.sh -p "${ctrl_dir}" -i "${IFACE}" \
 | 
				
			||||||
		-P "/var/run/wpa_cli-${IFACE}.pid" -B
 | 
							-P "/var/run/wpa_cli-${IFACE}.pid" -B
 | 
				
			||||||
	if eend $? ; then
 | 
						if eend $?; then
 | 
				
			||||||
		ebegin "Backgrounding ..."
 | 
							ebegin "Backgrounding ..."
 | 
				
			||||||
		exit 1 
 | 
							exit 1 
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -193,14 +193,14 @@ wpa_supplicant_post_stop() {
 | 
				
			|||||||
	[ $? != 0 ] && return 0
 | 
						[ $? != 0 ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local pidfile="/var/run/wpa_cli-${IFACE}.pid"
 | 
						local pidfile="/var/run/wpa_cli-${IFACE}.pid"
 | 
				
			||||||
	if [ -f ${pidfile} ] ; then
 | 
						if [ -f ${pidfile} ]; then
 | 
				
			||||||
		ebegin "Stopping wpa_cli on ${IFACE}"
 | 
							ebegin "Stopping wpa_cli on ${IFACE}"
 | 
				
			||||||
		start-stop-daemon --stop --exec "${wpac}" --pidfile "${pidfile}"
 | 
							start-stop-daemon --stop --exec "${wpac}" --pidfile "${pidfile}"
 | 
				
			||||||
		eend $?
 | 
							eend $?
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pidfile="/var/run/wpa_supplicant-${IFACE}.pid"
 | 
						pidfile="/var/run/wpa_supplicant-${IFACE}.pid"
 | 
				
			||||||
	if [ -f ${pidfile} ] ; then
 | 
						if [ -f ${pidfile} ]; then
 | 
				
			||||||
		ebegin "Stopping wpa_supplicant on ${IFACE}"
 | 
							ebegin "Stopping wpa_supplicant on ${IFACE}"
 | 
				
			||||||
		start-stop-daemon --stop --exec "${wpas}" --pidfile "${pidfile}"
 | 
							start-stop-daemon --stop --exec "${wpas}" --pidfile "${pidfile}"
 | 
				
			||||||
		eend $?
 | 
							eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,13 +5,13 @@ BOOTDIR = $(LEVELDIR)/boot
 | 
				
			|||||||
DEFAULTDIR = $(LEVELDIR)/default
 | 
					DEFAULTDIR = $(LEVELDIR)/default
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install:
 | 
					install:
 | 
				
			||||||
	if ! test -d "$(BOOTDIR)" ; then \
 | 
						if ! test -d "$(BOOTDIR)"; then \
 | 
				
			||||||
		$(INSTALL) -d $(BOOTDIR) || exit $$?; \
 | 
							$(INSTALL) -d $(BOOTDIR) || exit $$?; \
 | 
				
			||||||
		for x in $(BOOT); do ln -snf ../../init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$? ; done \
 | 
							for x in $(BOOT); do ln -snf ../../init.d/"$$x" $(BOOTDIR)/"$$x" || exit $$?; done \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if ! test -d "$(DEFAULTDIR)" ; then \
 | 
						if ! test -d "$(DEFAULTDIR)"; then \
 | 
				
			||||||
		$(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
 | 
							$(INSTALL) -d $(DEFAULTDIR) || exit $$?; \
 | 
				
			||||||
		for x in $(DEFAULT); do ln -snf ../../init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$? ; done \
 | 
							for x in $(DEFAULT); do ln -snf ../../init.d/"$$x" $(DEFAULTDIR)/"$$x" || exit $$?; done \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
all:
 | 
					all:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,7 @@ single_user() {
 | 
				
			|||||||
# FreeBSD-7 supports tmpfs now :)
 | 
					# FreeBSD-7 supports tmpfs now :)
 | 
				
			||||||
mount_svcdir() {
 | 
					mount_svcdir() {
 | 
				
			||||||
	local dotmp=false release=false
 | 
						local dotmp=false release=false
 | 
				
			||||||
	if [ -e "${RC_SVCDIR}"/deptree ] ; then
 | 
						if [ -e "${RC_SVCDIR}"/deptree ]; then
 | 
				
			||||||
		dotmp=true
 | 
							dotmp=true
 | 
				
			||||||
		if ! mount -t tmpfs none "${RC_LIBDIR}"/tmp 2>/dev/null; then
 | 
							if ! mount -t tmpfs none "${RC_LIBDIR}"/tmp 2>/dev/null; then
 | 
				
			||||||
			try mdconfig -a -t malloc -s 1m -u 1
 | 
								try mdconfig -a -t malloc -s 1m -u 1
 | 
				
			||||||
@@ -56,7 +56,7 @@ mount_svcdir() {
 | 
				
			|||||||
		try newfs -b 4096 -i 1024 -n /dev/md0
 | 
							try newfs -b 4096 -i 1024 -n /dev/md0
 | 
				
			||||||
		try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
 | 
							try mount -o rw,noexec,nosuid /dev/md0 "${RC_SVCDIR}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	if ${dotmp} ; then
 | 
						if ${dotmp}; then
 | 
				
			||||||
		cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
 | 
							cp -p "${RC_LIBDIR}"/tmp/deptree "${RC_LIBDIR}"/tmp/depconfig \
 | 
				
			||||||
			"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
 | 
								"${RC_LIBDIR}"/tmp/nettree "${RC_SVCDIR}" 2>/dev/null
 | 
				
			||||||
		try umount "${RC_LIBDIR}"/tmp
 | 
							try umount "${RC_LIBDIR}"/tmp
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,12 +26,12 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Try and set a font and as early as we can
 | 
					# Try and set a font and as early as we can
 | 
				
			||||||
if [ -e /etc/runlevels/"${RC_DEFAULTLEVEL}"/consolefont \
 | 
					if [ -e /etc/runlevels/"${RC_DEFAULTLEVEL}"/consolefont \
 | 
				
			||||||
	 -o -e /etc/runlevels/"${RC_BOOTLEVEL}"/consolefont ] ; then
 | 
						 -o -e /etc/runlevels/"${RC_BOOTLEVEL}"/consolefont ]; then
 | 
				
			||||||
	termencoding="(K"
 | 
						termencoding="(K"
 | 
				
			||||||
	[ -e "${RC_LIBDIR}"/console/unicode ] && termencoding="%G"
 | 
						[ -e "${RC_LIBDIR}"/console/unicode ] && termencoding="%G"
 | 
				
			||||||
	CONSOLE="${CONSOLE:-/dev/console}"
 | 
						CONSOLE="${CONSOLE:-/dev/console}"
 | 
				
			||||||
	printf "\033%s" "${termencoding}" >"${CONSOLE}" 2>/dev/null
 | 
						printf "\033%s" "${termencoding}" >"${CONSOLE}" 2>/dev/null
 | 
				
			||||||
	if [ -r "${RC_LIBDIR}"/console/font -a -x /bin/setfont ] ; then
 | 
						if [ -r "${RC_LIBDIR}"/console/font -a -x /bin/setfont ]; then
 | 
				
			||||||
		font="$(cat "${RC_LIBDIR}"/console/font)"
 | 
							font="$(cat "${RC_LIBDIR}"/console/font)"
 | 
				
			||||||
		[ -c "${CONSOLE}" ] && cons="-C ${CONSOLE}"
 | 
							[ -c "${CONSOLE}" ] && cons="-C ${CONSOLE}"
 | 
				
			||||||
		setfont ${cons} "${RC_LIBDIR}"/console/"${font}" 2>/dev/null
 | 
							setfont ${cons} "${RC_LIBDIR}"/console/"${font}" 2>/dev/null
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -146,7 +146,7 @@ if [ -e /proc/uptime ]; then
 | 
				
			|||||||
	unset up
 | 
						unset up
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if ${mountproc} ; then
 | 
					if ${mountproc}; then
 | 
				
			||||||
	procfs="proc"
 | 
						procfs="proc"
 | 
				
			||||||
	[ "${RC_UNAME}" = "GNU/kFreeBSD" ] && proc="linprocfs"
 | 
						[ "${RC_UNAME}" = "GNU/kFreeBSD" ] && proc="linprocfs"
 | 
				
			||||||
	ebegin "Mounting ${procfs} at /proc"
 | 
						ebegin "Mounting ${procfs} at /proc"
 | 
				
			||||||
@@ -242,7 +242,7 @@ for x in "devpts /dev/pts 0755 ,gid=5,mode=0620" "tmpfs /dev/shm 1777 ,nodev"; d
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if [ ! -d "$2" ] && \
 | 
						if [ ! -d "$2" ] && \
 | 
				
			||||||
	   [ "${m}" = "devfs" -o "${m}" = "udev" ]; then
 | 
						   [ "${m}" = "devfs" -o "${m}" = "udev" ]; then
 | 
				
			||||||
		mkdir -m "$3" -p "$2" >/dev/null 2>/dev/null || \
 | 
							mkdir -m "$3" -p "$2" >/dev/null 2>&1 || \
 | 
				
			||||||
			ewarn "Could not create $2!"
 | 
								ewarn "Could not create $2!"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								sh/Makefile
									
									
									
									
									
								
							@@ -8,9 +8,9 @@ include $(TOPDIR)/default.mk
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
install::
 | 
					install::
 | 
				
			||||||
	# Handle lib correctly
 | 
						# Handle lib correctly
 | 
				
			||||||
	if test $(LIB) != "lib" ; then \
 | 
						if test $(LIB) != "lib"; then \
 | 
				
			||||||
		sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$? ; \
 | 
							sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/functions.sh || exit $$?; \
 | 
				
			||||||
		rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak ; \
 | 
							rm -f $(DESTDIR)/$(RC_LIB)/sh/functions.sh.bak; \
 | 
				
			||||||
		sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$? ; \
 | 
							sed -i'.bak' -e 's,/lib/,/$(LIB)/,g' $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh || exit $$?; \
 | 
				
			||||||
		rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak ; \
 | 
							rm -f $(DESTDIR)/$(RC_LIB)/sh/rc-functions.sh.bak; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,15 +51,15 @@ dolisting() {
 | 
				
			|||||||
	local x= y= mylist= mypath="$*"
 | 
						local x= y= mylist= mypath="$*"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Here we use file globbing instead of ls to save on forking
 | 
						# Here we use file globbing instead of ls to save on forking
 | 
				
			||||||
	for x in ${mypath} ; do
 | 
						for x in ${mypath}; do
 | 
				
			||||||
		[ ! -e "${x}" ] && continue
 | 
							[ ! -e "${x}" ] && continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ -L "${x}" -o -f "${x}" ] ; then
 | 
							if [ -L "${x}" -o -f "${x}" ]; then
 | 
				
			||||||
			mylist="${mylist} "${x}
 | 
								mylist="${mylist} "${x}
 | 
				
			||||||
		elif [ -d "${x}" ] ; then
 | 
							elif [ -d "${x}" ]; then
 | 
				
			||||||
			[ "${x%/}" != "${x}" ] && x=${x%/}
 | 
								[ "${x%/}" != "${x}" ] && x=${x%/}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			for y in "${x}"/* ; do
 | 
								for y in "${x}"/*; do
 | 
				
			||||||
				[ -e "${y}" ] && mylist="${mylist} ${y}"
 | 
									[ -e "${y}" ] && mylist="${mylist} ${y}"
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -73,12 +73,12 @@ dolisting() {
 | 
				
			|||||||
#   return 0 if any of the files/dirs are newer than
 | 
					#   return 0 if any of the files/dirs are newer than
 | 
				
			||||||
#   the reference file
 | 
					#   the reference file
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
#   EXAMPLE: if is_older_than a.out *.o ; then ...
 | 
					#   EXAMPLE: if is_older_than a.out *.o; then ...
 | 
				
			||||||
is_older_than() {
 | 
					is_older_than() {
 | 
				
			||||||
	local x= ref="$1"
 | 
						local x= ref="$1"
 | 
				
			||||||
	shift
 | 
						shift
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for x in "$@" ; do
 | 
						for x in "$@"; do
 | 
				
			||||||
		[ -e "${x}" ] || continue
 | 
							[ -e "${x}" ] || continue
 | 
				
			||||||
		# We need to check the mtime if it's a directory too as the
 | 
							# We need to check the mtime if it's a directory too as the
 | 
				
			||||||
		# contents may have changed.
 | 
							# contents may have changed.
 | 
				
			||||||
@@ -91,10 +91,10 @@ is_older_than() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uniqify() {
 | 
					uniqify() {
 | 
				
			||||||
    local result=
 | 
					    local result=
 | 
				
			||||||
    while [ -n "$1" ] ; do
 | 
					    while [ -n "$1" ]; do
 | 
				
			||||||
		case " ${result} " in
 | 
							case " ${result} " in
 | 
				
			||||||
			*" $1 "*) ;;
 | 
								*" $1 "*);;
 | 
				
			||||||
			*) result="${result} $1" ;;
 | 
								*) result="${result} $1";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		shift
 | 
							shift
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -138,17 +138,19 @@ KV_to_int() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_sanitize_path() {
 | 
					_sanitize_path() {
 | 
				
			||||||
	local IFS=":" p=
 | 
						local IFS=":" p= path=
 | 
				
			||||||
	for p in ${PATH}; do
 | 
						for p in ${PATH}; do
 | 
				
			||||||
		case "${p}" in
 | 
							case "${p}" in
 | 
				
			||||||
			/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|/usr/local/bin|/usr/local/sbin) ;;
 | 
								/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|/usr/local/bin|/usr/local/sbin);;
 | 
				
			||||||
			*) printf "%s" ":${p}";;
 | 
								*) path="${path}:${p}";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						echo "${path}"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Allow our scripts to support zsh
 | 
					# Allow our scripts to support zsh
 | 
				
			||||||
if [ -n "${ZSH_VERSION}" ] ; then
 | 
					if [ -n "${ZSH_VERSION}" ]; then
 | 
				
			||||||
  emulate sh
 | 
					  emulate sh
 | 
				
			||||||
  NULLCMD=:
 | 
					  NULLCMD=:
 | 
				
			||||||
  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 | 
					  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
 | 
				
			||||||
@@ -161,7 +163,7 @@ fi
 | 
				
			|||||||
export PATH="/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin$(_sanitize_path "${PATH}")"
 | 
					export PATH="/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin$(_sanitize_path "${PATH}")"
 | 
				
			||||||
unset _sanitize_path
 | 
					unset _sanitize_path
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for arg in "$@" ; do
 | 
					for arg in "$@"; do
 | 
				
			||||||
	case "${arg}" in
 | 
						case "${arg}" in
 | 
				
			||||||
		--nocolor|--nocolour|-C)
 | 
							--nocolor|--nocolour|-C)
 | 
				
			||||||
			export RC_NOCOLOR="yes"
 | 
								export RC_NOCOLOR="yes"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -51,7 +51,7 @@ depend() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cd /etc/init.d
 | 
					cd /etc/init.d
 | 
				
			||||||
for SVCNAME in * ; do
 | 
					for SVCNAME in *; do
 | 
				
			||||||
	[ -x "${SVCNAME}" ] || continue
 | 
						[ -x "${SVCNAME}" ] || continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Only generate dependencies for runscripts
 | 
						# Only generate dependencies for runscripts
 | 
				
			||||||
@@ -65,14 +65,14 @@ for SVCNAME in * ; do
 | 
				
			|||||||
	exec 3>&1 1>&2
 | 
						exec 3>&1 1>&2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rc_c=${SVCNAME%%.*}
 | 
						rc_c=${SVCNAME%%.*}
 | 
				
			||||||
	if [ -n "${rc_c}" -a "${rc_c}" != "${SVCNAME}" ] ; then
 | 
						if [ -n "${rc_c}" -a "${rc_c}" != "${SVCNAME}" ]; then
 | 
				
			||||||
		[ -e /etc/conf.d/"${rc_c}" ] && . /etc/conf.d/"${rc_c}"
 | 
							[ -e /etc/conf.d/"${rc_c}" ] && . /etc/conf.d/"${rc_c}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	unset rc_c
 | 
						unset rc_c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	[ -e /etc/conf.d/"${SVCNAME}" ] && . /etc/conf.d/"${SVCNAME}"
 | 
						[ -e /etc/conf.d/"${SVCNAME}" ] && . /etc/conf.d/"${SVCNAME}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if . /etc/init.d/"${SVCNAME}" ; then
 | 
						if . /etc/init.d/"${SVCNAME}"; then
 | 
				
			||||||
		echo "${SVCNAME}" >&3
 | 
							echo "${SVCNAME}" >&3
 | 
				
			||||||
		depend
 | 
							depend
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,7 +31,7 @@ if [ "${RC_SVCDIR}" != "/" ] &&  mkdir "${RC_SVCDIR}/.test.$$" 2>/dev/null; then
 | 
				
			|||||||
	for x in ${RC_SVCDIR:-/lib/rcscripts/init.d}/*; do
 | 
						for x in ${RC_SVCDIR:-/lib/rcscripts/init.d}/*; do
 | 
				
			||||||
		[ -e "${x}" ] || continue
 | 
							[ -e "${x}" ] || continue
 | 
				
			||||||
		case ${x##*/} in
 | 
							case ${x##*/} in
 | 
				
			||||||
			deptree|ksoftlevel|rc.log) ;;
 | 
								deptree|ksoftlevel|rc.log);;
 | 
				
			||||||
			*) rm -rf "${x}";;
 | 
								*) rm -rf "${x}";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,13 +31,13 @@ try() {
 | 
				
			|||||||
	local errstr
 | 
						local errstr
 | 
				
			||||||
	local retval=0
 | 
						local retval=0
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	if [ -c /dev/null ] ; then
 | 
						if [ -c /dev/null ]; then
 | 
				
			||||||
		errstr=$(eval $* 2>&1 >/dev/null)
 | 
							errstr=$(eval $* 2>&1 >/dev/null)
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		errstr=$(eval $* 2>&1)
 | 
							errstr=$(eval $* 2>&1)
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	retval=$?
 | 
						retval=$?
 | 
				
			||||||
	if [ ${retval} -ne 0 ] ; then
 | 
						if [ ${retval} -ne 0 ]; then
 | 
				
			||||||
		#splash "critical" &
 | 
							#splash "critical" &
 | 
				
			||||||
		eend 1
 | 
							eend 1
 | 
				
			||||||
		eerror "The \"$*\" command failed with error:"
 | 
							eerror "The \"$*\" command failed with error:"
 | 
				
			||||||
@@ -58,8 +58,8 @@ try() {
 | 
				
			|||||||
check_statedir() {
 | 
					check_statedir() {
 | 
				
			||||||
	[ -z "$1" ] && return 0
 | 
						[ -z "$1" ] && return 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ ! -d "$1" ] ; then
 | 
						if [ ! -d "$1" ]; then
 | 
				
			||||||
		if ! mkdir -p "$1" &>/dev/null ; then
 | 
							if ! mkdir -p "$1" &>/dev/null; then
 | 
				
			||||||
			#splash "critical" &
 | 
								#splash "critical" &
 | 
				
			||||||
			echo
 | 
								echo
 | 
				
			||||||
			eerror "To function properly, \"$1\" needs to exist."
 | 
								eerror "To function properly, \"$1\" needs to exist."
 | 
				
			||||||
@@ -72,7 +72,7 @@ check_statedir() {
 | 
				
			|||||||
				fi
 | 
									fi
 | 
				
			||||||
				mkdir -p "$1"
 | 
									mkdir -p "$1"
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			if [ ! -d "$1" ] ; then
 | 
								if [ ! -d "$1" ]; then
 | 
				
			||||||
				eerror "Please mount your root partition read/write, and execute:"
 | 
									eerror "Please mount your root partition read/write, and execute:"
 | 
				
			||||||
				echo
 | 
									echo
 | 
				
			||||||
				eerror "  # mkdir -p $1"
 | 
									eerror "  # mkdir -p $1"
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										184
									
								
								sh/net.sh
									
									
									
									
									
								
							
							
						
						
									
										184
									
								
								sh/net.sh
									
									
									
									
									
								
							@@ -36,16 +36,18 @@ description="Configures network interfaces."
 | 
				
			|||||||
__IFS="
 | 
					__IFS="
 | 
				
			||||||
"
 | 
					"
 | 
				
			||||||
_shell_var() {
 | 
					_shell_var() {
 | 
				
			||||||
	local rem=$1 c= r=
 | 
						local rem=$1 c= r= var=
 | 
				
			||||||
	while [ -n "${rem}" ]; do
 | 
						while [ -n "${rem}" ]; do
 | 
				
			||||||
		r=${rem#?}
 | 
							r=${rem#?}
 | 
				
			||||||
		c=${rem%${r}}
 | 
							c=${rem%${r}}
 | 
				
			||||||
		case "${c}" in
 | 
							case "${c}" in
 | 
				
			||||||
			[a-zA-Z0-9]) printf "%c" "${c}";;
 | 
								[a-zA-Z0-9]);;
 | 
				
			||||||
			*) printf "_";;
 | 
								*) c=_;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
 | 
							var=${var}${c}
 | 
				
			||||||
		rem=${r}
 | 
							rem=${r}
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
						echo ${var}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
depend() {
 | 
					depend() {
 | 
				
			||||||
@@ -56,7 +58,7 @@ depend() {
 | 
				
			|||||||
	after bootmisc
 | 
						after bootmisc
 | 
				
			||||||
	provide net
 | 
						provide net
 | 
				
			||||||
	case "${IFACE}" in
 | 
						case "${IFACE}" in
 | 
				
			||||||
		lo|lo0) ;;
 | 
							lo|lo0);;
 | 
				
			||||||
		*)
 | 
							*)
 | 
				
			||||||
			after net.lo net.lo0
 | 
								after net.lo net.lo0
 | 
				
			||||||
			local prov=
 | 
								local prov=
 | 
				
			||||||
@@ -77,7 +79,7 @@ depend() {
 | 
				
			|||||||
# Support bash arrays - sigh
 | 
					# Support bash arrays - sigh
 | 
				
			||||||
_get_array() {
 | 
					_get_array() {
 | 
				
			||||||
	local _a=
 | 
						local _a=
 | 
				
			||||||
	if [ -n "${BASH}" ] ; then
 | 
						if [ -n "${BASH}" ]; then
 | 
				
			||||||
		case "$(declare -p "$1" 2>/dev/null)" in
 | 
							case "$(declare -p "$1" 2>/dev/null)" in
 | 
				
			||||||
			"declare -a "*)
 | 
								"declare -a "*)
 | 
				
			||||||
				eval "set -- \"\${$1[@]}\""
 | 
									eval "set -- \"\${$1[@]}\""
 | 
				
			||||||
@@ -97,7 +99,7 @@ _get_array() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Flatten bash arrays to simple strings
 | 
					# Flatten bash arrays to simple strings
 | 
				
			||||||
_flatten_array() {
 | 
					_flatten_array() {
 | 
				
			||||||
	if [ -n "${BASH}" ] ; then
 | 
						if [ -n "${BASH}" ]; then
 | 
				
			||||||
		case "$(declare -p "$1" 2>/dev/null)" in
 | 
							case "$(declare -p "$1" 2>/dev/null)" in
 | 
				
			||||||
			"declare -a "*)
 | 
								"declare -a "*)
 | 
				
			||||||
				eval "set -- \"\${$1[@]}\""
 | 
									eval "set -- \"\${$1[@]}\""
 | 
				
			||||||
@@ -128,9 +130,9 @@ _wait_for_carrier() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	yesno ${RC_PARALLEL} && efunc=einfo
 | 
						yesno ${RC_PARALLEL} && efunc=einfo
 | 
				
			||||||
	${efunc} "Waiting for carrier (${timeout} seconds) "
 | 
						${efunc} "Waiting for carrier (${timeout} seconds) "
 | 
				
			||||||
	while [ ${timeout} -gt 0 ] ; do
 | 
						while [ ${timeout} -gt 0 ]; do
 | 
				
			||||||
		sleep 1
 | 
							sleep 1
 | 
				
			||||||
		if _has_carrier ; then
 | 
							if _has_carrier; then
 | 
				
			||||||
			[ "${efunc}" = "einfon" ] && echo
 | 
								[ "${efunc}" = "einfon" ] && echo
 | 
				
			||||||
			eend 0
 | 
								eend 0
 | 
				
			||||||
			return 0
 | 
								return 0
 | 
				
			||||||
@@ -149,7 +151,7 @@ _netmask2cidr() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local IFS=.
 | 
						local IFS=.
 | 
				
			||||||
	for i in $1; do
 | 
						for i in $1; do
 | 
				
			||||||
		while [ ${i} != "0" ] ; do
 | 
							while [ ${i} != "0" ]; do
 | 
				
			||||||
			len=$((${len} + ${i} % 2))
 | 
								len=$((${len} + ${i} % 2))
 | 
				
			||||||
			i=$((${i} >> 1))
 | 
								i=$((${i} >> 1))
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
@@ -161,11 +163,11 @@ _netmask2cidr() {
 | 
				
			|||||||
_configure_variables() {
 | 
					_configure_variables() {
 | 
				
			||||||
	local var= v= t=
 | 
						local var= v= t=
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for var in ${_config_vars} ; do
 | 
						for var in ${_config_vars}; do
 | 
				
			||||||
		local v=
 | 
							local v=
 | 
				
			||||||
		for t in "$@" ; do
 | 
							for t in "$@"; do
 | 
				
			||||||
			eval v=\$${var}_${t}
 | 
								eval v=\$${var}_${t}
 | 
				
			||||||
			if [ -n "${v}" ] ; then
 | 
								if [ -n "${v}" ]; then
 | 
				
			||||||
				eval ${var}_${IFVAR}=\$${var}_${t}
 | 
									eval ${var}_${IFVAR}=\$${var}_${t}
 | 
				
			||||||
				continue 2
 | 
									continue 2
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -180,11 +182,11 @@ _show_address() {
 | 
				
			|||||||
# Basically sorts our modules into order and saves the list
 | 
					# Basically sorts our modules into order and saves the list
 | 
				
			||||||
_gen_module_list() {
 | 
					_gen_module_list() {
 | 
				
			||||||
	local x= f= force=$1
 | 
						local x= f= force=$1
 | 
				
			||||||
	if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ] ; then
 | 
						if ! ${force} && [ -s "${MODULESLIST}" -a "${MODULESLIST}" -nt "${MODULESDIR}" ]; then
 | 
				
			||||||
		local update=false
 | 
							local update=false
 | 
				
			||||||
		for x in "${MODULESDIR}"/* ; do
 | 
							for x in "${MODULESDIR}"/*; do
 | 
				
			||||||
			[ -e "${x}" ] || continue
 | 
								[ -e "${x}" ] || continue
 | 
				
			||||||
			if [ "${x}" -nt "${MODULESLIST}" ] ; then
 | 
								if [ "${x}" -nt "${MODULESLIST}" ]; then
 | 
				
			||||||
				update=true
 | 
									update=true
 | 
				
			||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
@@ -202,13 +204,13 @@ _gen_module_list() {
 | 
				
			|||||||
	before() {
 | 
						before() {
 | 
				
			||||||
		local mod=${MODULE}
 | 
							local mod=${MODULE}
 | 
				
			||||||
		local MODULE=
 | 
							local MODULE=
 | 
				
			||||||
		for MODULE in "$@" ; do
 | 
							for MODULE in "$@"; do
 | 
				
			||||||
			after "${mod}"
 | 
								after "${mod}"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	program() {
 | 
						program() {
 | 
				
			||||||
		if [ "$1" = "start" -o "$1" = "stop" ] ; then
 | 
							if [ "$1" = "start" -o "$1" = "stop" ]; then
 | 
				
			||||||
			local s="$1"
 | 
								local s="$1"
 | 
				
			||||||
			shift
 | 
								shift
 | 
				
			||||||
			eval ${MODULE}_program_${s}="\"\${${MODULE}_program_${s}}\${${MODULE}_program_${s}:+ }$*\""
 | 
								eval ${MODULE}_program_${s}="\"\${${MODULE}_program_${s}}\${${MODULE}_program_${s}:+ }$*\""
 | 
				
			||||||
@@ -220,12 +222,12 @@ _gen_module_list() {
 | 
				
			|||||||
	provide() {
 | 
						provide() {
 | 
				
			||||||
		eval ${MODULE}_provide="\"\${${MODULE}_provide}\${${MODULE}_provide:+ }$*\""
 | 
							eval ${MODULE}_provide="\"\${${MODULE}_provide}\${${MODULE}_provide:+ }$*\""
 | 
				
			||||||
		local x
 | 
							local x
 | 
				
			||||||
		for x in $* ; do
 | 
							for x in $*; do
 | 
				
			||||||
			eval ${x}_providedby="\"\${${MODULE}_providedby}\${${MODULE}_providedby:+ }${MODULE}\""
 | 
								eval ${x}_providedby="\"\${${MODULE}_providedby}\${${MODULE}_providedby:+ }${MODULE}\""
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for MODULE in "${MODULESDIR}"/* ; do
 | 
						for MODULE in "${MODULESDIR}"/*; do
 | 
				
			||||||
		sh -n "${MODULE}" || continue
 | 
							sh -n "${MODULE}" || continue
 | 
				
			||||||
		. "${MODULE}" || continue 
 | 
							. "${MODULE}" || continue 
 | 
				
			||||||
		MODULE=${MODULE#${MODULESDIR}/}
 | 
							MODULE=${MODULE#${MODULESDIR}/}
 | 
				
			||||||
@@ -238,15 +240,15 @@ _gen_module_list() {
 | 
				
			|||||||
	SORTED=
 | 
						SORTED=
 | 
				
			||||||
	visit() {
 | 
						visit() {
 | 
				
			||||||
		case " ${VISITED} " in
 | 
							case " ${VISITED} " in
 | 
				
			||||||
			*" $1 "*) return ;;
 | 
								*" $1 "*) return;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		VISITED="${VISITED} $1"
 | 
							VISITED="${VISITED} $1"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		eval AFTER=\$${1}_after
 | 
							eval AFTER=\$${1}_after
 | 
				
			||||||
		for MODULE in ${AFTER} ; do
 | 
							for MODULE in ${AFTER}; do
 | 
				
			||||||
			eval PROVIDEDBY=\$${MODULE}_providedby
 | 
								eval PROVIDEDBY=\$${MODULE}_providedby
 | 
				
			||||||
			if [ -n "${PROVIDEDBY}" ] ; then
 | 
								if [ -n "${PROVIDEDBY}" ]; then
 | 
				
			||||||
				for MODULE in ${PROVIDEDBY} ; do
 | 
									for MODULE in ${PROVIDEDBY}; do
 | 
				
			||||||
					visit "${MODULE}"
 | 
										visit "${MODULE}"
 | 
				
			||||||
				done
 | 
									done
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
@@ -255,7 +257,7 @@ _gen_module_list() {
 | 
				
			|||||||
		done
 | 
							done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		eval PROVIDE=\$${1}_provide
 | 
							eval PROVIDE=\$${1}_provide
 | 
				
			||||||
		for MODULE in ${PROVIDE} ; do
 | 
							for MODULE in ${PROVIDE}; do
 | 
				
			||||||
			visit "${MODULE}"
 | 
								visit "${MODULE}"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -263,13 +265,13 @@ _gen_module_list() {
 | 
				
			|||||||
		[ -z "${PROVIDEDBY}" ] && SORTED="${SORTED} $1"
 | 
							[ -z "${PROVIDEDBY}" ] && SORTED="${SORTED} $1"
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for MODULE in ${MODULES} ; do
 | 
						for MODULE in ${MODULES}; do
 | 
				
			||||||
		visit "${MODULE}"
 | 
							visit "${MODULE}"
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	printf "" > "${MODULESLIST}"
 | 
						printf "" > "${MODULESLIST}"
 | 
				
			||||||
	i=0
 | 
						i=0
 | 
				
			||||||
	for MODULE in ${SORTED} ; do
 | 
						for MODULE in ${SORTED}; do
 | 
				
			||||||
		eval PROGRAM=\$${MODULE}_program
 | 
							eval PROGRAM=\$${MODULE}_program
 | 
				
			||||||
		eval PROGRAM_START=\$${MODULE}_program_start
 | 
							eval PROGRAM_START=\$${MODULE}_program_start
 | 
				
			||||||
		eval PROGRAM_STOP=\$${MODULE}_program_stop
 | 
							eval PROGRAM_STOP=\$${MODULE}_program_stop
 | 
				
			||||||
@@ -292,56 +294,56 @@ _load_modules() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	# Ensure our list is up to date
 | 
						# Ensure our list is up to date
 | 
				
			||||||
	_gen_module_list false
 | 
						_gen_module_list false
 | 
				
			||||||
	if ! . "${MODULESLIST}" ; then
 | 
						if ! . "${MODULESLIST}"; then
 | 
				
			||||||
		_gen_module_list true
 | 
							_gen_module_list true
 | 
				
			||||||
		. "${MODULESLIST}"
 | 
							. "${MODULESLIST}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	MODULES=
 | 
						MODULES=
 | 
				
			||||||
	if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
 | 
						if [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
 | 
				
			||||||
		eval mymods=\$modules_${IFVAR}
 | 
							eval mymods=\$modules_${IFVAR}
 | 
				
			||||||
		[ -z "${mymods}" ] && mymods=${modules}
 | 
							[ -z "${mymods}" ] && mymods=${modules}
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	local i=-1 x= mod= f= provides=
 | 
						local i=-1 x= mod= f= provides=
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		i=$((${i} + 1))
 | 
							i=$((${i} + 1))
 | 
				
			||||||
		eval mod=\$module_${i}
 | 
							eval mod=\$module_${i}
 | 
				
			||||||
		[ -z "${mod}" ] && break
 | 
							[ -z "${mod}" ] && break
 | 
				
			||||||
		[ -e "${MODULESDIR}/${mod}.sh" ] || continue
 | 
							[ -e "${MODULESDIR}/${mod}.sh" ] || continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		eval set -- \$module_${i}_program
 | 
							eval set -- \$module_${i}_program
 | 
				
			||||||
		if [ -n "$1" ] ; then
 | 
							if [ -n "$1" ]; then
 | 
				
			||||||
			x=
 | 
								x=
 | 
				
			||||||
			for x in "$@" ; do
 | 
								for x in "$@"; do
 | 
				
			||||||
				[ -x "${x}" ] && break
 | 
									[ -x "${x}" ] && break
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
			[ -x "${x}" ] || continue
 | 
								[ -x "${x}" ] || continue
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if ${starting} ; then
 | 
							if ${starting}; then
 | 
				
			||||||
			eval set -- \$module_${i}_program_start
 | 
								eval set -- \$module_${i}_program_start
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			eval set -- \$module_${i}_program_stop
 | 
								eval set -- \$module_${i}_program_stop
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		if [ -n "$1" ] ; then
 | 
							if [ -n "$1" ]; then
 | 
				
			||||||
			x=
 | 
								x=
 | 
				
			||||||
			for x in "$@" ; do
 | 
								for x in "$@"; do
 | 
				
			||||||
				[ -x "${x}" ] && break
 | 
									[ -x "${x}" ] && break
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
			[ -x "${x}" ] || continue
 | 
								[ -x "${x}" ] || continue
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		eval provides=\$module_${i}_provide
 | 
							eval provides=\$module_${i}_provide
 | 
				
			||||||
		if ${starting} ; then
 | 
							if ${starting}; then
 | 
				
			||||||
			case " ${mymods} " in
 | 
								case " ${mymods} " in
 | 
				
			||||||
				*" !${mod} "*) continue ;;
 | 
									*" !${mod} "*) continue;;
 | 
				
			||||||
				*" !${provides} "*) [ -n "${provides}" ] && continue ;;
 | 
									*" !${provides} "*) [ -n "${provides}" ] && continue;;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		MODULES="${MODULES}${MODULES:+ }${mod}"
 | 
							MODULES="${MODULES}${MODULES:+ }${mod}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		# Now load and wrap our functions
 | 
							# Now load and wrap our functions
 | 
				
			||||||
		if ! . "${MODULESDIR}/${mod}.sh" ; then
 | 
							if ! . "${MODULESDIR}/${mod}.sh"; then
 | 
				
			||||||
			eend 1 "${SVCNAME}: error loading module \`${mod}'"
 | 
								eend 1 "${SVCNAME}: error loading module \`${mod}'"
 | 
				
			||||||
			exit 1
 | 
								exit 1
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -350,8 +352,8 @@ _load_modules() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		# Wrap our provides
 | 
							# Wrap our provides
 | 
				
			||||||
		local f=
 | 
							local f=
 | 
				
			||||||
		for f in pre_start start post_start ; do 
 | 
							for f in pre_start start post_start; do 
 | 
				
			||||||
			eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
 | 
								eval "${provides}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		eval module_${mod}_provides="${provides}"
 | 
							eval module_${mod}_provides="${provides}"
 | 
				
			||||||
@@ -359,13 +361,13 @@ _load_modules() {
 | 
				
			|||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Wrap our preferred modules
 | 
						# Wrap our preferred modules
 | 
				
			||||||
	for mod in ${mymods} ; do
 | 
						for mod in ${mymods}; do
 | 
				
			||||||
		case " ${MODULES} " in
 | 
							case " ${MODULES} " in
 | 
				
			||||||
			*" ${mod} "*)
 | 
								*" ${mod} "*)
 | 
				
			||||||
			eval x=\$module_${mod}_provides
 | 
								eval x=\$module_${mod}_provides
 | 
				
			||||||
			[ -z "${x}" ] && continue
 | 
								[ -z "${x}" ] && continue
 | 
				
			||||||
			for f in pre_start start post_start ; do 
 | 
								for f in pre_start start post_start; do 
 | 
				
			||||||
				eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>/dev/null || return 0; ${mod}_${f} \"\$@\"; }"
 | 
									eval "${x}_${f}() { type ${mod}_${f} >/dev/null 2>&1 || return 0; ${mod}_${f} \"\$@\"; }"
 | 
				
			||||||
			done
 | 
								done
 | 
				
			||||||
			eval module_${x}_providedby="${mod}"
 | 
								eval module_${x}_providedby="${mod}"
 | 
				
			||||||
			;;
 | 
								;;
 | 
				
			||||||
@@ -376,17 +378,17 @@ _load_modules() {
 | 
				
			|||||||
	# Otherwise reverse the list
 | 
						# Otherwise reverse the list
 | 
				
			||||||
	local LIST="${MODULES}" p=
 | 
						local LIST="${MODULES}" p=
 | 
				
			||||||
	MODULES=
 | 
						MODULES=
 | 
				
			||||||
	if ${starting} ; then
 | 
						if ${starting}; then
 | 
				
			||||||
		for mod in ${LIST} ; do
 | 
							for mod in ${LIST}; do
 | 
				
			||||||
			eval x=\$module_${mod}_provides
 | 
								eval x=\$module_${mod}_provides
 | 
				
			||||||
			if [ -n "${x}" ] ; then
 | 
								if [ -n "${x}" ]; then
 | 
				
			||||||
				eval p=\$module_${x}_providedby
 | 
									eval p=\$module_${x}_providedby
 | 
				
			||||||
				[ "${mod}" != "${p}" ] && continue
 | 
									[ "${mod}" != "${p}" ] && continue
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
			MODULES="${MODULES}${MODULES:+ }${mod}"
 | 
								MODULES="${MODULES}${MODULES:+ }${mod}"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		for mod in ${LIST} ; do 
 | 
							for mod in ${LIST}; do 
 | 
				
			||||||
			MODULES="${mod}${MODULES:+ }${MODULES}"
 | 
								MODULES="${mod}${MODULES:+ }${MODULES}"
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -398,11 +400,11 @@ _load_config() {
 | 
				
			|||||||
	local config="$(_get_array "config_${IFVAR}")"
 | 
						local config="$(_get_array "config_${IFVAR}")"
 | 
				
			||||||
	local fallback="$(_get_array fallback_${IFVAR})"
 | 
						local fallback="$(_get_array fallback_${IFVAR})"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
 | 
						if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
 | 
				
			||||||
		[ "${config}" != "null" ] && config="127.0.0.1/8
 | 
							[ "${config}" != "null" ] && config="127.0.0.1/8
 | 
				
			||||||
${config}"
 | 
					${config}"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		if [ -z "${config}" ] ; then
 | 
							if [ -z "${config}" ]; then
 | 
				
			||||||
			ewarn "No configuration specified; defaulting to DHCP"
 | 
								ewarn "No configuration specified; defaulting to DHCP"
 | 
				
			||||||
			config="dhcp"
 | 
								config="dhcp"
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
@@ -438,7 +440,7 @@ start() {
 | 
				
			|||||||
	einfo "Bringing up interface ${IFACE}"
 | 
						einfo "Bringing up interface ${IFACE}"
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${MODULES}" ] ; then
 | 
						if [ -z "${MODULES}" ]; then
 | 
				
			||||||
		local MODULES=
 | 
							local MODULES=
 | 
				
			||||||
		_load_modules true
 | 
							_load_modules true
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -446,7 +448,7 @@ start() {
 | 
				
			|||||||
	# We up the iface twice if we have a preup to ensure it's up if
 | 
						# We up the iface twice if we have a preup to ensure it's up if
 | 
				
			||||||
	# available in preup and afterwards incase the user inadvertently
 | 
						# available in preup and afterwards incase the user inadvertently
 | 
				
			||||||
	# brings it down
 | 
						# brings it down
 | 
				
			||||||
	if type preup >/dev/null 2>/dev/null ; then
 | 
						if type preup >/dev/null 2>&1; then
 | 
				
			||||||
		_up 2>/dev/null
 | 
							_up 2>/dev/null
 | 
				
			||||||
		ebegin "Running preup"
 | 
							ebegin "Running preup"
 | 
				
			||||||
		eindent
 | 
							eindent
 | 
				
			||||||
@@ -456,23 +458,23 @@ start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	_up 2>/dev/null
 | 
						_up 2>/dev/null
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES}; do
 | 
				
			||||||
		if type "${module}_pre_start" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_pre_start" >/dev/null 2>&1; then
 | 
				
			||||||
			if ! ${module}_pre_start ; then
 | 
								if ! ${module}_pre_start; then
 | 
				
			||||||
				eend 1
 | 
									eend 1
 | 
				
			||||||
				exit 1
 | 
									exit 1
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! _exists ; then
 | 
						if ! _exists; then
 | 
				
			||||||
		eerror "ERROR: interface ${IFACE} does not exist"
 | 
							eerror "ERROR: interface ${IFACE} does not exist"
 | 
				
			||||||
		eerror "Ensure that you have loaded the correct kernel module for your hardware"
 | 
							eerror "Ensure that you have loaded the correct kernel module for your hardware"
 | 
				
			||||||
		return 1
 | 
							return 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! _wait_for_carrier ; then
 | 
						if ! _wait_for_carrier; then
 | 
				
			||||||
		if service_started devd ; then
 | 
							if service_started devd; then
 | 
				
			||||||
			ewarn "no carrier, but devd will start us when we have one"
 | 
								ewarn "no carrier, but devd will start us when we have one"
 | 
				
			||||||
			mark_service_inactive "${SVCNAME}"
 | 
								mark_service_inactive "${SVCNAME}"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
@@ -485,13 +487,13 @@ start() {
 | 
				
			|||||||
	_load_config
 | 
						_load_config
 | 
				
			||||||
	config_index=0
 | 
						config_index=0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -n "${our_metric}" ] ; then
 | 
						if [ -n "${our_metric}" ]; then
 | 
				
			||||||
		metric=${our_metric}
 | 
							metric=${our_metric}
 | 
				
			||||||
	elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ] ; then
 | 
						elif [ "${IFACE}" != "lo" -a "${IFACE}" != "lo0" ]; then
 | 
				
			||||||
		metric=$((${metric} + $(_ifindex)))
 | 
							metric=$((${metric} + $(_ifindex)))
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	while true ; do
 | 
						while true; do
 | 
				
			||||||
		eval config=\$config_${config_index}
 | 
							eval config=\$config_${config_index}
 | 
				
			||||||
		[ -z "${config}" ] && break 
 | 
							[ -z "${config}" ] && break 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -500,26 +502,26 @@ start() {
 | 
				
			|||||||
		eindent
 | 
							eindent
 | 
				
			||||||
		case "$1" in
 | 
							case "$1" in
 | 
				
			||||||
			noop)
 | 
								noop)
 | 
				
			||||||
				if [ -n "$(_get_inet_address)" ] ; then
 | 
									if [ -n "$(_get_inet_address)" ]; then
 | 
				
			||||||
					oneworked=true
 | 
										oneworked=true
 | 
				
			||||||
					break
 | 
										break
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
			null) : ;;
 | 
								null) :;;
 | 
				
			||||||
			[0-9]*|*:*) _add_address ${config} ;;
 | 
								[0-9]*|*:*) _add_address ${config};;
 | 
				
			||||||
			*)
 | 
								*)
 | 
				
			||||||
				if type "${config}_start" >/dev/null 2>/dev/null ; then
 | 
									if type "${config}_start" >/dev/null 2>&1; then
 | 
				
			||||||
					"${config}"_start
 | 
										"${config}"_start
 | 
				
			||||||
				else
 | 
									else
 | 
				
			||||||
					eerror "nothing provides \`${config}'"
 | 
										eerror "nothing provides \`${config}'"
 | 
				
			||||||
				fi
 | 
									fi
 | 
				
			||||||
				;;
 | 
									;;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		if eend $? ; then
 | 
							if eend $?; then
 | 
				
			||||||
			oneworked=true
 | 
								oneworked=true
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			eval config=\$fallback_${config_index}
 | 
								eval config=\$fallback_${config_index}
 | 
				
			||||||
			if [ -n "${config}" ] ; then
 | 
								if [ -n "${config}" ]; then
 | 
				
			||||||
				eoutdent
 | 
									eoutdent
 | 
				
			||||||
				ewarn "Trying fallback configuration ${config}"
 | 
									ewarn "Trying fallback configuration ${config}"
 | 
				
			||||||
				eindent
 | 
									eindent
 | 
				
			||||||
@@ -532,8 +534,8 @@ start() {
 | 
				
			|||||||
		config_index=$((${config_index} + 1))
 | 
							config_index=$((${config_index} + 1))
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ! ${oneworked} ; then
 | 
						if ! ${oneworked}; then
 | 
				
			||||||
		if type failup >/dev/null 2>/dev/null ; then
 | 
							if type failup >/dev/null 2>&1; then
 | 
				
			||||||
			ebegin "Running failup"
 | 
								ebegin "Running failup"
 | 
				
			||||||
			eindent
 | 
								eindent
 | 
				
			||||||
			failup
 | 
								failup
 | 
				
			||||||
@@ -544,7 +546,7 @@ start() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local hidefirstroute=false first=true
 | 
						local hidefirstroute=false first=true
 | 
				
			||||||
	local routes="$(_get_array "routes_${IFVAR}")"
 | 
						local routes="$(_get_array "routes_${IFVAR}")"
 | 
				
			||||||
	if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ] ; then
 | 
						if [ "${IFACE}" = "lo" -o "${IFACE}" = "lo0" ]; then
 | 
				
			||||||
		if [ "${config_0}" != "null" ]; then
 | 
							if [ "${config_0}" != "null" ]; then
 | 
				
			||||||
			routes="127.0.0.0/8 via 127.0.0.1
 | 
								routes="127.0.0.0/8 via 127.0.0.1
 | 
				
			||||||
${routes}"
 | 
					${routes}"
 | 
				
			||||||
@@ -562,14 +564,14 @@ ${routes}"
 | 
				
			|||||||
		ebegin ${cmd}
 | 
							ebegin ${cmd}
 | 
				
			||||||
		# Work out if we're a host or a net if not told
 | 
							# Work out if we're a host or a net if not told
 | 
				
			||||||
		case ${cmd} in
 | 
							case ${cmd} in
 | 
				
			||||||
			*" -net "*|*" -host "*) ;;
 | 
								*" -net "*|*" -host "*);;
 | 
				
			||||||
			*" netmask "*)             cmd="-net ${cmd}" ;;
 | 
								*" netmask "*)             cmd="-net ${cmd}";;
 | 
				
			||||||
			*.*.*.*/32)                cmd="-host ${cmd}" ;;
 | 
								*.*.*.*/32)                cmd="-host ${cmd}";;
 | 
				
			||||||
			*.*.*.*/*|0.0.0.0|default) cmd="-net ${cmd}" ;;
 | 
								*.*.*.*/*|0.0.0.0|default) cmd="-net ${cmd}";;
 | 
				
			||||||
			*)                         cmd="-host ${cmd}" ;;
 | 
								*)                         cmd="-host ${cmd}";;
 | 
				
			||||||
		esac
 | 
							esac
 | 
				
			||||||
		if ${hidefirstroute} ; then
 | 
							if ${hidefirstroute}; then
 | 
				
			||||||
			_add_route ${cmd} >/dev/null 2>/dev/null
 | 
								_add_route ${cmd} >/dev/null 2>&1
 | 
				
			||||||
			hidefirstroute=false
 | 
								hidefirstroute=false
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			_add_route ${cmd} >/dev/null
 | 
								_add_route ${cmd} >/dev/null
 | 
				
			||||||
@@ -579,16 +581,16 @@ ${routes}"
 | 
				
			|||||||
	done
 | 
						done
 | 
				
			||||||
	unset IFS
 | 
						unset IFS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES}; do
 | 
				
			||||||
		if type "${module}_post_start" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_post_start" >/dev/null 2>&1; then
 | 
				
			||||||
			if ! ${module}_post_start ; then
 | 
								if ! ${module}_post_start; then
 | 
				
			||||||
				eend 1
 | 
									eend 1
 | 
				
			||||||
				exit 1
 | 
									exit 1
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if type postup >/dev/null 2>/dev/null ; then
 | 
						if type postup >/dev/null 2>&1; then
 | 
				
			||||||
		ebegin "Running postup"
 | 
							ebegin "Running postup"
 | 
				
			||||||
		eindent
 | 
							eindent
 | 
				
			||||||
		postup 
 | 
							postup 
 | 
				
			||||||
@@ -605,12 +607,12 @@ stop() {
 | 
				
			|||||||
	einfo "Bringing down interface ${IFACE}"
 | 
						einfo "Bringing down interface ${IFACE}"
 | 
				
			||||||
	eindent
 | 
						eindent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if [ -z "${MODULES}" ] ; then
 | 
						if [ -z "${MODULES}" ]; then
 | 
				
			||||||
		local MODULES=
 | 
							local MODULES=
 | 
				
			||||||
		_load_modules false
 | 
							_load_modules false
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if type predown >/dev/null 2>/dev/null ; then
 | 
						if type predown >/dev/null 2>&1; then
 | 
				
			||||||
		ebegin "Running predown"
 | 
							ebegin "Running predown"
 | 
				
			||||||
		eindent
 | 
							eindent
 | 
				
			||||||
		predown || return 1
 | 
							predown || return 1
 | 
				
			||||||
@@ -622,28 +624,28 @@ stop() {
 | 
				
			|||||||
		fi
 | 
							fi
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES}; do
 | 
				
			||||||
		if type "${module}_pre_stop" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_pre_stop" >/dev/null 2>&1; then
 | 
				
			||||||
			if ! ${module}_pre_stop ; then
 | 
								if ! ${module}_pre_stop; then
 | 
				
			||||||
				eend 1
 | 
									eend 1
 | 
				
			||||||
				exit 1
 | 
									exit 1
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES}; do
 | 
				
			||||||
		if type "${module}_stop" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_stop" >/dev/null 2>&1; then
 | 
				
			||||||
			${module}_stop
 | 
								${module}_stop
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	# Only delete addresses for non PPP interfaces
 | 
						# Only delete addresses for non PPP interfaces
 | 
				
			||||||
	if ! type is_ppp >/dev/null 2>/dev/null || ! is_ppp ; then
 | 
						if ! type is_ppp >/dev/null 2>&1 || ! is_ppp; then
 | 
				
			||||||
		_delete_addresses "${IFACE}"
 | 
							_delete_addresses "${IFACE}"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for module in ${MODULES} ; do
 | 
						for module in ${MODULES}; do
 | 
				
			||||||
		if type "${module}_post_stop" >/dev/null 2>/dev/null ; then
 | 
							if type "${module}_post_stop" >/dev/null 2>&1; then
 | 
				
			||||||
			${module}_post_stop
 | 
								${module}_post_stop
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
	done
 | 
						done
 | 
				
			||||||
@@ -654,7 +656,7 @@ stop() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}"
 | 
						type resolvconf >/dev/null 2>&1 && resolvconf -d "${IFACE}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if type postdown >/dev/null 2>/dev/null ; then
 | 
						if type postdown >/dev/null 2>&1; then
 | 
				
			||||||
		ebegin "Running postdown"
 | 
							ebegin "Running postdown"
 | 
				
			||||||
		eindent
 | 
							eindent
 | 
				
			||||||
		postdown
 | 
							postdown
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ is_net_fs() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
is_union_fs() {
 | 
					is_union_fs() {
 | 
				
			||||||
	[ ! -x /sbin/unionctl ] && return 1
 | 
						[ ! -x /sbin/unionctl ] && return 1
 | 
				
			||||||
	unionctl "$1" --list >/dev/null 2>/dev/null
 | 
						unionctl "$1" --list >/dev/null 2>&1
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
get_bootparam() {
 | 
					get_bootparam() {
 | 
				
			||||||
@@ -89,8 +89,8 @@ get_bootparam() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Add our sbin to $PATH
 | 
					# Add our sbin to $PATH
 | 
				
			||||||
case "${PATH}" in
 | 
					case "${PATH}" in
 | 
				
			||||||
	/lib/rc/sbin|/lib/rc/sbin:*) ;;
 | 
						/lib/rc/sbin|/lib/rc/sbin:*);;
 | 
				
			||||||
	*) export PATH="/lib/rc/sbin:${PATH}" ;;
 | 
						*) export PATH="/lib/rc/sbin:${PATH}";;
 | 
				
			||||||
esac
 | 
					esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# vim: set ts=4 :
 | 
					# vim: set ts=4 :
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -34,19 +34,19 @@ else
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
myscript=$1
 | 
					myscript=$1
 | 
				
			||||||
if [ -z "${myscript}" ] ; then
 | 
					if [ -z "${myscript}" ]; then
 | 
				
			||||||
	echo "Please execute an init.d script"
 | 
						echo "Please execute an init.d script"
 | 
				
			||||||
	exit 1
 | 
						exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -L "${myscript}" ] ; then
 | 
					if [ -L "${myscript}" ]; then
 | 
				
			||||||
	SERVICE=$(readlink "${myscript}")
 | 
						SERVICE=$(readlink "${myscript}")
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
	SERVICE=${myscript}
 | 
						SERVICE=${myscript}
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
SERVICE=${SERVICE##*/}
 | 
					SERVICE=${SERVICE##*/}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$2" = "help" ] ; then
 | 
					if [ "$2" = "help" ]; then
 | 
				
			||||||
	BE_VERBOSE="yes"
 | 
						BE_VERBOSE="yes"
 | 
				
			||||||
	NL="\n"
 | 
						NL="\n"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
@@ -55,7 +55,7 @@ else
 | 
				
			|||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
default_commands="describe help start status stop restart zap"
 | 
					default_commands="describe help start status stop restart zap"
 | 
				
			||||||
extra_commands="$(. "${myscript}" 2>/dev/null ; echo "${extra_commands:-${opts}}")"
 | 
					extra_commands="$(. "${myscript}" 2>/dev/null; echo "${extra_commands:-${opts}}")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
printf "Usage: ${CYAN}${SERVICE}${OFF} [ ${GREEN}flags${OFF} ] < ${GREEN}options${OFF} >
 | 
					printf "Usage: ${CYAN}${SERVICE}${OFF} [ ${GREEN}flags${OFF} ] < ${GREEN}options${OFF} >
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -121,7 +121,7 @@ printf "    ${GREEN}${default_commands}${OFF}
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ -n "${extra_commands}" ] ; then
 | 
					if [ -n "${extra_commands}" ]; then
 | 
				
			||||||
printf "
 | 
					printf "
 | 
				
			||||||
${CYAN}Additional Options:${OFF}${NL}
 | 
					${CYAN}Additional Options:${OFF}${NL}
 | 
				
			||||||
    ${GREEN}${extra_commands}${OFF}
 | 
					    ${GREEN}${extra_commands}${OFF}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -32,7 +32,7 @@ do_unmount() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	local cmd="$1" retval=0 retry=
 | 
						local cmd="$1" retval=0 retry=
 | 
				
			||||||
	local f_opts="-m -c" f_kill="-s " mnt=
 | 
						local f_opts="-m -c" f_kill="-s " mnt=
 | 
				
			||||||
	if [ "${RC_UNAME}" = "Linux" ] ; then
 | 
						if [ "${RC_UNAME}" = "Linux" ]; then
 | 
				
			||||||
		f_opts="-m"
 | 
							f_opts="-m"
 | 
				
			||||||
		f_kill="-"
 | 
							f_kill="-"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
@@ -57,24 +57,24 @@ do_unmount() {
 | 
				
			|||||||
		esac
 | 
							esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		retry=3
 | 
							retry=3
 | 
				
			||||||
		while ! LC_ALL=C ${cmd} "${mnt}" 2>/dev/null ; do
 | 
							while ! LC_ALL=C ${cmd} "${mnt}" 2>/dev/null; do
 | 
				
			||||||
			# Don't kill if it's us (/ and possibly /usr)
 | 
								# Don't kill if it's us (/ and possibly /usr)
 | 
				
			||||||
			local pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)"
 | 
								local pids="$(fuser ${f_opts} "${mnt}" 2>/dev/null)"
 | 
				
			||||||
			case " ${pids} " in
 | 
								case " ${pids} " in
 | 
				
			||||||
				*" $$ "*) retry=0 ;;
 | 
									*" $$ "*) retry=0;;
 | 
				
			||||||
				"  ") eend 1 "in use but fuser finds nothing"; retry=0 ;;
 | 
									"  ") eend 1 "in use but fuser finds nothing"; retry=0;;
 | 
				
			||||||
				*)
 | 
									*)
 | 
				
			||||||
					local sig="KILL"
 | 
										local sig="KILL"
 | 
				
			||||||
					[ ${retry} -gt 0 ] && sig="TERM"
 | 
										[ ${retry} -gt 0 ] && sig="TERM"
 | 
				
			||||||
					fuser ${f_kill}${sig} -k ${f_opts} "${mnt}" \
 | 
										fuser ${f_kill}${sig} -k ${f_opts} "${mnt}" \
 | 
				
			||||||
						>/dev/null 2>/dev/null
 | 
											>/dev/null 2>&1
 | 
				
			||||||
					sleep 1
 | 
										sleep 1
 | 
				
			||||||
					retry=$((${retry} - 1))
 | 
										retry=$((${retry} - 1))
 | 
				
			||||||
					;;
 | 
										;;
 | 
				
			||||||
			esac
 | 
								esac
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			# OK, try forcing things
 | 
								# OK, try forcing things
 | 
				
			||||||
			if [ ${retry} -le 0 ] ; then
 | 
								if [ ${retry} -le 0 ]; then
 | 
				
			||||||
				case "${cmd}" in
 | 
									case "${cmd}" in
 | 
				
			||||||
					umount*)
 | 
										umount*)
 | 
				
			||||||
						LC_ALL=C ${cmd} -f "${mnt}" || retry=-999
 | 
											LC_ALL=C ${cmd} -f "${mnt}" || retry=-999
 | 
				
			||||||
@@ -86,7 +86,7 @@ do_unmount() {
 | 
				
			|||||||
				break
 | 
									break
 | 
				
			||||||
			fi
 | 
								fi
 | 
				
			||||||
		done
 | 
							done
 | 
				
			||||||
		if [ ${retry} -eq -999 ] ; then
 | 
							if [ ${retry} -eq -999 ]; then
 | 
				
			||||||
			eend 1
 | 
								eend 1
 | 
				
			||||||
			retval=1
 | 
								retval=1
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,9 +150,9 @@ install:: $(TARGET)
 | 
				
			|||||||
	for x in $(SBINLINKS); do ln -sf rc $(DESTDIR)/sbin/$$x; done
 | 
						for x in $(SBINLINKS); do ln -sf rc $(DESTDIR)/sbin/$$x; done
 | 
				
			||||||
	for x in $(RC_BINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/bin/$$x; done
 | 
						for x in $(RC_BINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/bin/$$x; done
 | 
				
			||||||
	for x in $(RC_SBINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/sbin/$$x; done
 | 
						for x in $(RC_SBINLINKS); do ln -sf ../../../sbin/rc $(DESTDIR)/$(RC_LIB)/sbin/$$x; done
 | 
				
			||||||
	if test "$(PAM)" = "pam" ; then \
 | 
						if test "$(PAM)" = "pam"; then \
 | 
				
			||||||
		install -d $(DESTDIR)/etc/pam.d ; \
 | 
							install -d $(DESTDIR)/etc/pam.d; \
 | 
				
			||||||
		install -m 0644 start-stop-daemon.pam $(DESTDIR)/etc/pam.d/start-stop-daemon ; \
 | 
							install -m 0644 start-stop-daemon.pam $(DESTDIR)/etc/pam.d/start-stop-daemon; \
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
clean-links:
 | 
					clean-links:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,7 +67,7 @@
 | 
				
			|||||||
#include <security/pam_appl.h>
 | 
					#include <security/pam_appl.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* We are not supporting authentication conversations */
 | 
					/* We are not supporting authentication conversations */
 | 
				
			||||||
static struct pam_conv conv = { NULL, NULL} ;
 | 
					static struct pam_conv conv = { NULL, NULL};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "builtins.h"
 | 
					#include "builtins.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@ export LD_LIBRARY_PATH=${builddir}:${LD_LIBRARY_PATH}
 | 
				
			|||||||
export PATH=${builddir}:${PATH}
 | 
					export PATH=${builddir}:${PATH}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
checkit() {
 | 
					checkit() {
 | 
				
			||||||
	local base=$1 ; shift
 | 
						local base=$1; shift
 | 
				
			||||||
	echo "$@" | tr ' ' '\n' > ${base}.out
 | 
						echo "$@" | tr ' ' '\n' > ${base}.out
 | 
				
			||||||
	diff -u ${base}.list ${base}.out
 | 
						diff -u ${base}.list ${base}.out
 | 
				
			||||||
	eend $?
 | 
						eend $?
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -62,7 +62,7 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if [ -n "${NS}" ]; then
 | 
					if [ -n "${NS}" ]; then
 | 
				
			||||||
	DNS="# Generated by openvpn for interface ${dev}\n"
 | 
						DNS="# Generated by openvpn for interface ${dev}\n"
 | 
				
			||||||
	if [ -n "${SEARCH}" ] ; then
 | 
						if [ -n "${SEARCH}" ]; then
 | 
				
			||||||
		DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
 | 
							DNS="${DNS}search ${DOMAIN} ${SEARCH}\n"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		DNS="${DNS}domain ${DOMAIN}\n"
 | 
							DNS="${DNS}domain ${DOMAIN}\n"
 | 
				
			||||||
@@ -72,7 +72,7 @@ if [ -n "${NS}" ]; then
 | 
				
			|||||||
		printf "${DNS}" | resolvconf -a "${dev}"
 | 
							printf "${DNS}" | resolvconf -a "${dev}"
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		# Preserve the existing resolv.conf
 | 
							# Preserve the existing resolv.conf
 | 
				
			||||||
		if [ -e /etc/resolv.conf ] ; then
 | 
							if [ -e /etc/resolv.conf ]; then
 | 
				
			||||||
			cp -p /etc/resolv.conf /etc/resolv.conf-"${dev}".sv
 | 
								cp -p /etc/resolv.conf /etc/resolv.conf-"${dev}".sv
 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
		(umask 022; printf "${DNS}" > /etc/resolv.conf)
 | 
							(umask 022; printf "${DNS}" > /etc/resolv.conf)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user