Adopt a more C style for scripts and remove vim settings.
This commit is contained in:
		| @@ -1,33 +1,14 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | ifconfig_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| ifconfig_depend() { |  | ||||||
| 	program /sbin/ifconfig | 	program /sbin/ifconfig | ||||||
| 	provide interface | 	provide interface | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -37,7 +18,8 @@ _exists() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_mac_address() { | _get_mac_address() | ||||||
|  | { | ||||||
| 	local proto= address= foo= | 	local proto= address= foo= | ||||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read proto address foo; do | 	LC_ALL=C ifconfig "${IFACE}" | while read proto address foo; do | ||||||
| 		case "${proto}" in | 		case "${proto}" in | ||||||
| @@ -54,15 +36,18 @@ _get_mac_address() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| _up () { | _up() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" up | 	ifconfig "${IFACE}" up | ||||||
| } | } | ||||||
|  |  | ||||||
| _down () { | _down() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" down | 	ifconfig "${IFACE}" down | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifindex() { | _ifindex() | ||||||
|  | { | ||||||
| 	local x= i=1 | 	local x= i=1 | ||||||
| 	case "${RC_UNAME}" in | 	case "${RC_UNAME}" in | ||||||
| 		FreeBSD|DragonFly) | 		FreeBSD|DragonFly) | ||||||
| @@ -90,7 +75,8 @@ _ifindex() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifconfig_ent() { | _ifconfig_ent() | ||||||
|  | { | ||||||
| 	LC_ALL=C ifconfig "${IFACE}" 2>/dev/null | while read ent rest; do | 	LC_ALL=C ifconfig "${IFACE}" 2>/dev/null | while read ent rest; do | ||||||
|    		case "${ent}" in |    		case "${ent}" in | ||||||
| 			"$1") echo "${rest}";; | 			"$1") echo "${rest}";; | ||||||
| @@ -98,14 +84,16 @@ _ifconfig_ent() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| _is_wireless() { | _is_wireless() | ||||||
|  | { | ||||||
| 	case "$(_ifconfig_ent "media:")" in | 	case "$(_ifconfig_ent "media:")" in | ||||||
| 		"IEEE 802.11 Wireless"*) return 0;; | 		"IEEE 802.11 Wireless"*) return 0;; | ||||||
| 		*) return 1;; | 		*) return 1;; | ||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_inet_address() { | _get_inet_address() | ||||||
|  | { | ||||||
| 	local inet= address= n= netmask= rest= | 	local inet= address= n= netmask= rest= | ||||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read inet address n netmask rest; do | 	LC_ALL=C ifconfig "${IFACE}" | while read inet address n netmask rest; do | ||||||
| 		if [ "${inet}" = "inet" ]; then | 		if [ "${inet}" = "inet" ]; then | ||||||
| @@ -115,7 +103,8 @@ _get_inet_address() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| _add_address() { | _add_address() | ||||||
|  | { | ||||||
| 	local inet6= | 	local inet6= | ||||||
|  |  | ||||||
| 	case "$@" in | 	case "$@" in | ||||||
| @@ -141,7 +130,8 @@ _add_address() { | |||||||
| 	ifconfig "${IFACE}" ${inet6} "$@" alias | 	ifconfig "${IFACE}" ${inet6} "$@" alias | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -156,7 +146,8 @@ _add_route() { | |||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| _delete_addresses() { | _delete_addresses() | ||||||
|  | { | ||||||
| 	einfo "Removing addresses" | 	einfo "Removing addresses" | ||||||
| 	eindent | 	eindent | ||||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do | 	LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do | ||||||
| @@ -176,18 +167,21 @@ _delete_addresses() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _show_address() { | _show_address() | ||||||
|  | { | ||||||
| 	einfo "received address $(_get_inet_address "${IFACE}")" | 	einfo "received address $(_get_inet_address "${IFACE}")" | ||||||
| } | } | ||||||
|  |  | ||||||
| _has_carrier() { | _has_carrier() | ||||||
|  | { | ||||||
| 	case "$(_ifconfig_ent "status:")" in | 	case "$(_ifconfig_ent "status:")" in | ||||||
| 		""|active|associated) return 0;; | 		""|active|associated) return 0;; | ||||||
| 		*) return 1;; | 		*) return 1;; | ||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| ifconfig_pre_start() { | ifconfig_pre_start() | ||||||
|  | { | ||||||
| 	local config="$(_get_array "ifconfig_${IFVAR}")" conf= arg= args= | 	local config="$(_get_array "ifconfig_${IFVAR}")" conf= arg= args= | ||||||
| 	local IFS="$__IFS" | 	local IFS="$__IFS" | ||||||
|  |  | ||||||
| @@ -219,7 +213,8 @@ ifconfig_pre_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifconfig_ipv6_tentative() { | _ifconfig_ipv6_tentative() | ||||||
|  | { | ||||||
| 	local inet= address= rest= | 	local inet= address= rest= | ||||||
| 	LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do | 	LC_ALL=C ifconfig "${IFACE}" | while read inet address rest; do | ||||||
| 	 	case "${inet}" in | 	 	case "${inet}" in | ||||||
| @@ -233,7 +228,8 @@ _ifconfig_ipv6_tentative() { | |||||||
| 	[ $? = 2 ] | 	[ $? = 2 ] | ||||||
| } | } | ||||||
|  |  | ||||||
| ifconfig_post_start() { | ifconfig_post_start() | ||||||
|  | { | ||||||
| 	if _ifconfig_ipv6_tentative; then | 	if _ifconfig_ipv6_tentative; then | ||||||
| 		ebegin "Waiting for IPv6 addresses" | 		ebegin "Waiting for IPv6 addresses" | ||||||
| 		while true; do | 		while true; do | ||||||
| @@ -242,5 +238,3 @@ ifconfig_post_start() { | |||||||
| 		eend 0 | 		eend 0 | ||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,37 +1,19 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | _config_vars="$_config_vars ssid mode associate_timeout preferred_aps" | ||||||
| # modification, are permitted provided that the following conditions | _config_vars="$_config_vars blacklist_aps" | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars ssid mode associate_timeout preferred_aps blacklist_aps" | iwconfig_depend() | ||||||
|  | { | ||||||
| iwconfig_depend() { |  | ||||||
| 	program /sbin/ifconfig | 	program /sbin/ifconfig | ||||||
| 	after plug | 	after plug | ||||||
| 	before interface | 	before interface | ||||||
| 	provide wireless | 	provide wireless | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_wep_status() { | iwconfig_get_wep_status() | ||||||
|  | { | ||||||
| 	local status="disabled" | 	local status="disabled" | ||||||
| 	local mode=$(LC_ALL=C ifconfig "${IFACE}" \ | 	local mode=$(LC_ALL=C ifconfig "${IFACE}" \ | ||||||
| 	| sed -n -e 's/^[[:space:]]*authmode \([^ ]*\) privacy ON .*/\1/p') | 	| sed -n -e 's/^[[:space:]]*authmode \([^ ]*\) privacy ON .*/\1/p') | ||||||
| @@ -42,29 +24,34 @@ iwconfig_get_wep_status() { | |||||||
| 	echo "(WEP ${status})" | 	echo "(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() | ||||||
|  | { | ||||||
| 	local ssid="$(_iwconfig_get 1)" | 	local ssid="$(_iwconfig_get 1)" | ||||||
| 	# If the ssid has a space then it's wrapped in quotes. | 	# If the ssid has a space then it's wrapped in quotes. This is a | ||||||
| 	# This is a problem if the real ssid has a quote at the start or the end :/ | 	# problem if the real ssid has a quote at the start or the end :/ | ||||||
| 	ssid=${ssid#\"} | 	ssid=${ssid#\"} | ||||||
| 	ssid=${ssid%\"} | 	ssid=${ssid%\"} | ||||||
| 	echo "${ssid}" | 	echo "${ssid}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_ap_mac_address() { | _get_ap_mac_address() | ||||||
|  | { | ||||||
| 	_iwconfig_get 3 | 	_iwconfig_get 3 | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_channel() { | _get_channel() | ||||||
|  | { | ||||||
| 	_iwconfig_get 2 | 	_iwconfig_get 2 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_report() { | iwconfig_report() | ||||||
|  | { | ||||||
| 	local m="connected to" | 	local m="connected to" | ||||||
| 	local ssid="$(_get_ssid)" | 	local ssid="$(_get_ssid)" | ||||||
| 	local mac="$(_get_ap_mac_address "${iface}")" | 	local mac="$(_get_ap_mac_address "${iface}")" | ||||||
| @@ -79,7 +66,8 @@ iwconfig_report() { | |||||||
| 	eoutdent | 	eoutdent | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_wep_key() { | iwconfig_get_wep_key() | ||||||
|  | { | ||||||
| 	local mac="$1" key= | 	local mac="$1" 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} | ||||||
| @@ -87,7 +75,8 @@ iwconfig_get_wep_key() { | |||||||
| 	echo "${key:--}" | 	echo "${key:--}" | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_user_config() { | iwconfig_user_config() | ||||||
|  | { | ||||||
| 	local conf= | 	local conf= | ||||||
| 	eval set -- \$ifconfig_${SSIDVAR} | 	eval set -- \$ifconfig_${SSIDVAR} | ||||||
| 	for conf in "$@" ; do | 	for conf in "$@" ; do | ||||||
| @@ -95,7 +84,8 @@ iwconfig_user_config() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_set_mode() { | iwconfig_set_mode() | ||||||
|  | { | ||||||
| 	local x= opt= unopt="hostap adhoc" | 	local x= opt= unopt="hostap adhoc" | ||||||
| 	case "$1" in | 	case "$1" in | ||||||
| 		master|hostap) unopt="adhoc" opt="hostap" ;; | 		master|hostap) unopt="adhoc" opt="hostap" ;; | ||||||
| @@ -109,7 +99,8 @@ iwconfig_set_mode() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_setup_specific() { | iwconfig_setup_specific() | ||||||
|  | { | ||||||
| 	local mode="${1:-master}" channel= | 	local mode="${1:-master}" channel= | ||||||
| 	if [ -z "${SSID}" ]; then | 	if [ -z "${SSID}" ]; then | ||||||
| 		eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode" | 		eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode" | ||||||
| @@ -136,7 +127,8 @@ iwconfig_setup_specific() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_associate() { | iwconfig_associate() | ||||||
|  | { | ||||||
| 	local mac="$1" channel="$2" caps="$3" | 	local mac="$1" channel="$2" caps="$3" | ||||||
| 	local mode= w="(WEP Disabled)" key= | 	local mode= w="(WEP Disabled)" key= | ||||||
|  |  | ||||||
| @@ -251,7 +243,8 @@ iwconfig_associate() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_scan() { | iwconfig_scan() | ||||||
|  | { | ||||||
| 	local x= i=0 scan= quality= | 	local x= i=0 scan= quality= | ||||||
| 	einfo "Scanning for access points" | 	einfo "Scanning for access points" | ||||||
| 	eindent | 	eindent | ||||||
| @@ -387,7 +380,8 @@ iwconfig_scan() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_force_preferred() { | iwconfig_force_preferred() | ||||||
|  | { | ||||||
| 	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") | ||||||
| 	[ $# = 0 ] && return 1 | 	[ $# = 0 ] && return 1 | ||||||
| @@ -414,7 +408,8 @@ iwconfig_force_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_connect_preferred() { | iwconfig_connect_preferred() | ||||||
|  | { | ||||||
| 	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") | ||||||
| 	[ $# = 0 ] && return 1 | 	[ $# = 0 ] && return 1 | ||||||
| @@ -439,7 +434,8 @@ iwconfig_connect_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_connect_not_preferred() { | iwconfig_connect_not_preferred() | ||||||
|  | { | ||||||
| 	local ssid= i=0 mode= mac= caps= freq= chan= pref= | 	local ssid= i=0 mode= mac= caps= freq= chan= pref= | ||||||
|  |  | ||||||
| 	while [ ${i} -le ${APS} ] ; do | 	while [ ${i} -le ${APS} ] ; do | ||||||
| @@ -474,7 +470,8 @@ iwconfig_connect_not_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_defaults() { | iwconfig_defaults() | ||||||
|  | { | ||||||
| 	# Set some defaults | 	# Set some defaults | ||||||
| 	#ifconfig "${iface}" txpower 100 2>/dev/null | 	#ifconfig "${iface}" txpower 100 2>/dev/null | ||||||
| 	ifconfig "${IFACE}" bssid - | 	ifconfig "${IFACE}" bssid - | ||||||
| @@ -485,7 +482,8 @@ iwconfig_defaults() { | |||||||
| 	ifconfig "${IFACE}" -mediaopt hostap | 	ifconfig "${IFACE}" -mediaopt hostap | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_configure() { | iwconfig_configure() | ||||||
|  | { | ||||||
| 	local x APS | 	local x APS | ||||||
| 	eval SSID=\$ssid_${IFVAR} | 	eval SSID=\$ssid_${IFVAR} | ||||||
|  |  | ||||||
| @@ -550,7 +548,8 @@ iwconfig_configure() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_pre_start() { | iwconfig_pre_start() | ||||||
|  | { | ||||||
| 	# We don't configure wireless if we're being called from | 	# We don't configure wireless if we're being called from | ||||||
| 	# the background | 	# the background | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
| @@ -584,11 +583,10 @@ iwconfig_pre_start() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_post_stop() { | iwconfig_post_stop() | ||||||
|  | { | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
| 	_is_wireless || return 0 | 	_is_wireless || return 0 | ||||||
| 	iwconfig_defaults | 	iwconfig_defaults | ||||||
| 	#iwconfig "${IFACE}" txpower 0 2>/dev/null | 	#iwconfig "${IFACE}" txpower 0 2>/dev/null | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -2,33 +2,14 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | adsl_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| adsl_depend() { |  | ||||||
| 	program /usr/sbin/adsl-start /usr/sbin/pppoe-start | 	program /usr/sbin/adsl-start /usr/sbin/pppoe-start | ||||||
| 	before dhcp | 	before dhcp | ||||||
| } | } | ||||||
|  |  | ||||||
| adsl_setup_vars() { | adsl_setup_vars() | ||||||
|  | { | ||||||
| 	local startstop="$1" cfgexe= | 	local startstop="$1" cfgexe= | ||||||
|  |  | ||||||
| 	if [ -x /usr/sbin/pppoe-start ]; then | 	if [ -x /usr/sbin/pppoe-start ]; then | ||||||
| @@ -53,7 +34,8 @@ adsl_setup_vars() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| adsl_start() { | adsl_start() | ||||||
|  | { | ||||||
| 	local exe= cfgfile= user= | 	local exe= cfgfile= user= | ||||||
|  |  | ||||||
| 	adsl_setup_vars start || return 1 | 	adsl_setup_vars start || return 1 | ||||||
| @@ -72,7 +54,8 @@ adsl_start() { | |||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| adsl_stop() { | adsl_stop() | ||||||
|  | { | ||||||
| 	local exe= cfgfile= | 	local exe= cfgfile= | ||||||
|  |  | ||||||
| 	[ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0 | 	[ ! -f /var/run/rp-pppoe-"${IFACE}".pid ] && return 0 | ||||||
| @@ -89,5 +72,3 @@ adsl_stop() { | |||||||
|  |  | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,32 +1,13 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | apipa_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| apipa_depend() { |  | ||||||
| 	program /sbin/arping | 	program /sbin/arping | ||||||
| } | } | ||||||
|  |  | ||||||
| _random() { | _random() | ||||||
|  | { | ||||||
| 	local r=${RANDOM} | 	local r=${RANDOM} | ||||||
| 	if [ -n "${r}" ]; then | 	if [ -n "${r}" ]; then | ||||||
| 		echo "${r}" | 		echo "${r}" | ||||||
| @@ -35,7 +16,8 @@ _random() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| apipa_start() { | apipa_start() | ||||||
|  | { | ||||||
| 	local iface="$1" i1= i2= addr= i=0 | 	local iface="$1" i1= i2= addr= i=0 | ||||||
|  |  | ||||||
| 	_exists true || return 1 | 	_exists true || return 1 | ||||||
| @@ -64,5 +46,3 @@ apipa_start() { | |||||||
| 	eoutdent | 	eoutdent | ||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,33 +1,14 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | arping_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| arping_depend() { |  | ||||||
| 	program /sbin/arping /usr/sbin/arping2 | 	program /sbin/arping /usr/sbin/arping2 | ||||||
| 	before interface | 	before interface | ||||||
| } | } | ||||||
|  |  | ||||||
| arping_address() { | arping_address() | ||||||
|  | { | ||||||
| 	local ip=${1%%/*} mac="$2" spoof="$3" foundmac= i= w= opts= | 	local ip=${1%%/*} mac="$2" spoof="$3" foundmac= i= w= opts= | ||||||
|  |  | ||||||
| 	# We only handle IPv4 addresses | 	# We only handle IPv4 addresses | ||||||
| @@ -73,14 +54,16 @@ arping_address() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _arping_in_config() { | _arping_in_config() | ||||||
|  | { | ||||||
| 	_get_array "config_${IFVAR}" | while read i; do | 	_get_array "config_${IFVAR}" | while read i; do | ||||||
| 		[ "${i}" = "arping" ] && return 1 | 		[ "${i}" = "arping" ] && return 1 | ||||||
| 	done | 	done | ||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| arping_start() { | arping_start() | ||||||
|  | { | ||||||
| 	local gateways= x= conf= i= | 	local gateways= x= conf= i= | ||||||
| 	einfo "Pinging gateways on ${IFACE} for configuration" | 	einfo "Pinging gateways on ${IFACE} for configuration" | ||||||
|  |  | ||||||
| @@ -146,5 +129,3 @@ arping_start() { | |||||||
| 	eoutdent | 	eoutdent | ||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,39 +1,21 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | bonding_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| bonding_depend() { |  | ||||||
| 	before interface macchanger | 	before interface macchanger | ||||||
| 	program /sbin/ifenslave | 	program /sbin/ifenslave | ||||||
| } | } | ||||||
|  |  | ||||||
| _config_vars="$_config_vars slaves" | _config_vars="$_config_vars slaves" | ||||||
|  |  | ||||||
| _is_bond() { | _is_bond() | ||||||
|  | { | ||||||
| 	[ -f "/proc/net/bonding/${IFACE}" ] | 	[ -f "/proc/net/bonding/${IFACE}" ] | ||||||
| } | } | ||||||
|  |  | ||||||
| bonding_pre_start() { | bonding_pre_start() | ||||||
|  | { | ||||||
| 	local s= slaves="$(_get_array "slaves_${IFVAR}")"  | 	local s= slaves="$(_get_array "slaves_${IFVAR}")"  | ||||||
|  |  | ||||||
| 	[ -z "${slaves}" ] && return 0 | 	[ -z "${slaves}" ] && return 0 | ||||||
| @@ -86,7 +68,8 @@ bonding_pre_start() { | |||||||
| 	return 0 #important | 	return 0 #important | ||||||
| } | } | ||||||
|  |  | ||||||
| bonding_stop() { | bonding_stop() | ||||||
|  | { | ||||||
| 	_is_bond || return 0	 | 	_is_bond || return 0	 | ||||||
|  |  | ||||||
| 	local slaves= s= | 	local slaves= s= | ||||||
| @@ -116,5 +99,3 @@ bonding_stop() { | |||||||
| 	eend 0 | 	eend 0 | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | _br2684ctl() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _br2684ctl() { |  | ||||||
| 	if [ -x /usr/sbin/br2684ctl ]; then | 	if [ -x /usr/sbin/br2684ctl ]; then | ||||||
| 		echo /usr/sbin/br2684ctl | 		echo /usr/sbin/br2684ctl | ||||||
| 	else | 	else | ||||||
| @@ -30,14 +10,16 @@ _br2684ctl() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| br2684ctl_depend() { | br2684ctl_depend() | ||||||
|  | { | ||||||
| 	before ppp | 	before ppp | ||||||
| 	program start $(_br2684ctl) | 	program start $(_br2684ctl) | ||||||
| } | } | ||||||
|  |  | ||||||
| _config_vars="$_config_vars bridge bridge_add brctl" | _config_vars="$_config_vars bridge bridge_add brctl" | ||||||
| 	 | 	 | ||||||
| br2684ctl_pre_start() { | br2684ctl_pre_start() | ||||||
|  | { | ||||||
| 	local opts= | 	local opts= | ||||||
| 	eval opts=\$br2684ctl_${IFVAR} | 	eval opts=\$br2684ctl_${IFVAR} | ||||||
| 	[ -z "${opts}" ] && return 0 | 	[ -z "${opts}" ] && return 0 | ||||||
| @@ -66,7 +48,8 @@ br2684ctl_pre_start() { | |||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| br2684ctl_post_stop() { | br2684ctl_post_stop() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/br2684ctl-${IFACE}.pid" | 	local pidfile="/var/run/br2684ctl-${IFACE}.pid" | ||||||
| 	[ -e "${pidfile}" ] || return 0 | 	[ -e "${pidfile}" ] || return 0 | ||||||
| 	 | 	 | ||||||
| @@ -74,5 +57,3 @@ br2684ctl_post_stop() { | |||||||
| 	start-stop-daemon --stop --quiet --pidfile "${pidfile}" | 	start-stop-daemon --stop --quiet --pidfile "${pidfile}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,39 +1,21 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | bridge_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| bridge_depend() { |  | ||||||
| 	before interface macnet | 	before interface macnet | ||||||
| 	program /sbin/brctl | 	program /sbin/brctl | ||||||
| } | } | ||||||
|  |  | ||||||
| _config_vars="$_config_vars bridge bridge_add brctl" | _config_vars="$_config_vars bridge bridge_add brctl" | ||||||
|  |  | ||||||
| _is_bridge() { | _is_bridge() | ||||||
|  | { | ||||||
| 	brctl show 2>/dev/null | grep -q "^${IFACE}[[:space:]]" | 	brctl show 2>/dev/null | grep -q "^${IFACE}[[:space:]]" | ||||||
| } | } | ||||||
|  |  | ||||||
| bridge_pre_start() { | bridge_pre_start() | ||||||
|  | { | ||||||
| 	local ports= brif= iface="${IFACE}" e= x= | 	local ports= brif= iface="${IFACE}" e= x= | ||||||
| 	local ports="$(_get_array "bridge_${IFVAR}")" | 	local ports="$(_get_array "bridge_${IFVAR}")" | ||||||
| 	local opts="$(_get_array "brctl_${IFVAR}")" | 	local opts="$(_get_array "brctl_${IFVAR}")" | ||||||
| @@ -96,7 +78,8 @@ bridge_pre_start() { | |||||||
| 	_up | 	_up | ||||||
| } | } | ||||||
|  |  | ||||||
| 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 | ||||||
| @@ -138,5 +121,3 @@ bridge_post_stop() { | |||||||
| 	 | 	 | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,34 +1,15 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without |  | ||||||
| # modification, are permitted provided that the following conditions |  | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars ccwgroup" | _config_vars="$_config_vars ccwgroup" | ||||||
|  |  | ||||||
| ccwgroup_depend() { | ccwgroup_depend() | ||||||
|  | { | ||||||
| 	before interface  | 	before interface  | ||||||
| } | } | ||||||
|  |  | ||||||
| ccwgroup_pre_start() { | ccwgroup_pre_start() | ||||||
|  | { | ||||||
| 	local ccwgroup="$(_get_array "ccwgroup_${IFVAR}")" | 	local ccwgroup="$(_get_array "ccwgroup_${IFVAR}")" | ||||||
| 	[ -z "${ccwgroup}" ] && return 0 | 	[ -z "${ccwgroup}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -47,17 +28,18 @@ ccwgroup_pre_start() { | |||||||
| 		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 | ||||||
| 	fi | 	fi | ||||||
| 	eval layer2=\$qeth_layer2_${IFVAR} | 	eval layer2=\$qeth_layer2_${IFVAR} | ||||||
| 	echo "${layer2:-0}" > /sys/devices/qeth/"${first}"/layer2 | 	echo "${layer2:-0}" > /sys/devices/qeth/"${first}"/layer2 | ||||||
| 	echo "1" > /sys/devices/qeth/"${first}"/online | 	echo "1" >/sys/devices/qeth/"${first}"/online | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| ccwgroup_pre_stop() { | ccwgroup_pre_stop() | ||||||
|  | { | ||||||
| 	# Erase any existing ccwgroup to be safe | 	# Erase any existing ccwgroup to be safe | ||||||
| 	service_set_value ccwgroup_device "" | 	service_set_value ccwgroup_device "" | ||||||
| 	 | 	 | ||||||
| @@ -73,14 +55,13 @@ ccwgroup_pre_stop() { | |||||||
| 	service_set_value ccwgroup_device "${device}" | 	service_set_value ccwgroup_device "${device}" | ||||||
| } | } | ||||||
|  |  | ||||||
| ccwgroup_post_stop() { | ccwgroup_post_stop() | ||||||
|  | { | ||||||
| 	local device="$(service_get_value ccwgroup_device)" | 	local device="$(service_get_value ccwgroup_device)" | ||||||
| 	[ -z "${device}" ] && return 0 | 	[ -z "${device}" ] && return 0 | ||||||
| 	 | 	 | ||||||
| 	einfo "Disabling ccwgroup on ${iface}" | 	einfo "Disabling ccwgroup on ${iface}" | ||||||
| 	echo "0"  > /sys/devices/qeth/"${device}"/online | 	echo "0" >/sys/devices/qeth/"${device}"/online | ||||||
| 	echo "1"  > /sys/devices/qeth/"${device}"/ungroup | 	echo "1" >/sys/devices/qeth/"${device}"/ungroup | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,7 +1,8 @@ | |||||||
| # Copyright 2005-2007 Gentoo Foundation | # Copyright 2005-2007 Gentoo Foundation | ||||||
| # Distributed under the terms of the GNU General Public License v2 | # Distributed under the terms of the GNU General Public License v2 | ||||||
|  |  | ||||||
| clip_depend() { | clip_depend() | ||||||
|  | { | ||||||
| 	program /usr/sbin/atmsigd | 	program /usr/sbin/atmsigd | ||||||
|     before interface |     before interface | ||||||
| } | } | ||||||
| @@ -15,7 +16,8 @@ _config_vars="$_config_vars clip" | |||||||
| # themself from the controlling terminal when backgrounding... The only way I | # themself from the controlling terminal when backgrounding... The only way I | ||||||
| # see to overcame this is to use the --background option in start-stop-daemon, | # see to overcame this is to use the --background option in start-stop-daemon, | ||||||
| # which is reported as a "last resort" method, but it acts correctly about this. | # which is reported as a "last resort" method, but it acts correctly about this. | ||||||
| atmclip_svc_start() { | atmclip_svc_start() | ||||||
|  | { | ||||||
|     ebegin "Starting $2 Daemon ($1)" |     ebegin "Starting $2 Daemon ($1)" | ||||||
|     start-stop-daemon --start \ |     start-stop-daemon --start \ | ||||||
| 		--background \ | 		--background \ | ||||||
| @@ -24,7 +26,8 @@ atmclip_svc_start() { | |||||||
|     eend $? |     eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| atmclip_svcs_start() { | atmclip_svcs_start() | ||||||
|  | { | ||||||
|     einfo "First CLIP instance: starting ATM CLIP daemons" |     einfo "First CLIP instance: starting ATM CLIP daemons" | ||||||
|     eindent |     eindent | ||||||
|  |  | ||||||
| @@ -42,7 +45,8 @@ atmclip_svcs_start() { | |||||||
|     return ${r} |     return ${r} | ||||||
| } | } | ||||||
|  |  | ||||||
| atmclip_svc_stop() { | atmclip_svc_stop() | ||||||
|  | { | ||||||
|     ebegin "Stopping $2 Daemon ($1)" |     ebegin "Stopping $2 Daemon ($1)" | ||||||
|     start-stop-daemon --stop --quiet \ |     start-stop-daemon --stop --quiet \ | ||||||
| 		--pidfile "/var/run/$1.pid" \ | 		--pidfile "/var/run/$1.pid" \ | ||||||
| @@ -50,7 +54,8 @@ atmclip_svc_stop() { | |||||||
|     eend $? |     eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| atmclip_svcs_stop() { | atmclip_svcs_stop() | ||||||
|  | { | ||||||
|     einfo "Last CLIP instance: stopping ATM CLIP daemons" |     einfo "Last CLIP instance: stopping ATM CLIP daemons" | ||||||
|     eindent |     eindent | ||||||
|  |  | ||||||
| @@ -66,7 +71,8 @@ atmclip_svcs_stop() { | |||||||
|     eoutdent |     eoutdent | ||||||
| } | } | ||||||
|  |  | ||||||
| are_atmclip_svcs_running() { | are_atmclip_svcs_running() | ||||||
|  | { | ||||||
|  |  | ||||||
| 	start-stop-daemon --quiet --test --stop --pidfile /var/run/atmarpd.pid || return 1 | 	start-stop-daemon --quiet --test --stop --pidfile /var/run/atmarpd.pid || return 1 | ||||||
|  |  | ||||||
| @@ -78,7 +84,8 @@ are_atmclip_svcs_running() { | |||||||
|     return 0 |     return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| clip_pre_start() { | clip_pre_start() | ||||||
|  | { | ||||||
| 	local clip= | 	local clip= | ||||||
| 	eval clip=\$clip_${IFVAR} | 	eval clip=\$clip_${IFVAR} | ||||||
| 	[ -z "${clip}" ] && return 0 | 	[ -z "${clip}" ] && return 0 | ||||||
| @@ -109,7 +116,8 @@ clip_pre_start() { | |||||||
|     return 0 |     return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| clip_post_start() { | clip_post_start() | ||||||
|  | { | ||||||
| 	local clip="$(_get_array "clip_${IFVAR}")" | 	local clip="$(_get_array "clip_${IFVAR}")" | ||||||
| 	[ -z "${clip}" ] && return 0 | 	[ -z "${clip}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -161,7 +169,8 @@ clip_post_start() { | |||||||
|     fi |     fi | ||||||
| } | } | ||||||
|  |  | ||||||
| clip_pre_stop() { | clip_pre_stop() | ||||||
|  | { | ||||||
|     are_atmclip_svcs_running || return 0 |     are_atmclip_svcs_running || return 0 | ||||||
|  |  | ||||||
| 	# We remove all the PVCs which may have been created by | 	# We remove all the PVCs which may have been created by | ||||||
| @@ -191,7 +200,8 @@ clip_pre_stop() { | |||||||
| # We can just leave the interface down. "ifconfig -a" will still list it... | # We can just leave the interface down. "ifconfig -a" will still list it... | ||||||
| # Also, here we can stop the ATM CLIP daemons if there is no other CLIP PVC | # Also, here we can stop the ATM CLIP daemons if there is no other CLIP PVC | ||||||
| # outstanding. We check this condition by inspecting the /proc/net/atm/arp file. | # outstanding. We check this condition by inspecting the /proc/net/atm/arp file. | ||||||
| clip_post_stop() { | clip_post_stop() | ||||||
|  | { | ||||||
|     are_atmclip_svcs_running || return 0 |     are_atmclip_svcs_running || return 0 | ||||||
|  |  | ||||||
|     local itf= left= hasothers= |     local itf= left= hasothers= | ||||||
| @@ -209,5 +219,3 @@ clip_post_stop() { | |||||||
| 		atmclip_svcs_stop || return 1 | 		atmclip_svcs_stop || return 1 | ||||||
|     fi |     fi | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,45 +1,29 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | ifconfig_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| ifconfig_depend() { |  | ||||||
| 	program /sbin/ifconfig | 	program /sbin/ifconfig | ||||||
| 	provide interface | 	provide interface | ||||||
| } | } | ||||||
|  |  | ||||||
| _up() { | _up() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" up | 	ifconfig "${IFACE}" up | ||||||
| } | } | ||||||
|  |  | ||||||
| _down() { | _down() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" down | 	ifconfig "${IFACE}" down | ||||||
| } | } | ||||||
|  |  | ||||||
| _exists() { | _exists() | ||||||
|  | { | ||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifindex() { | _ifindex() | ||||||
|  | { | ||||||
| 	local line= i=-2 | 	local line= i=-2 | ||||||
| 	while read line; do | 	while read line; do | ||||||
| 		i=$((${i} + 1)) | 		i=$((${i} + 1)) | ||||||
| @@ -55,7 +39,8 @@ _ifindex() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _is_wireless() { | _is_wireless() | ||||||
|  | { | ||||||
| 	# Support new sysfs layout | 	# Support new sysfs layout | ||||||
| 	[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0 | 	[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0 | ||||||
|  |  | ||||||
| @@ -63,15 +48,16 @@ _is_wireless() { | |||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless | 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless | ||||||
| } | } | ||||||
|  |  | ||||||
| _set_flag() { | _set_flag() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" "$1" | 	ifconfig "${IFACE}" "$1" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_mac_address() { | _get_mac_address() | ||||||
|  | { | ||||||
| 	local mac=$(LC_ALL=C ifconfig "${IFACE}" | \ | 	local mac=$(LC_ALL=C ifconfig "${IFACE}" | \ | ||||||
| 	sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\1/p') | 	sed -n -e 's/.* HWaddr \(..:..:..:..:..:..\).*/\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);; | ||||||
| @@ -83,11 +69,13 @@ _get_mac_address() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _set_mac_address() { | _set_mac_address() | ||||||
|  | { | ||||||
| 	ifconfig "${IFACE}" hw ether "$1" | 	ifconfig "${IFACE}" hw ether "$1" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_inet_address() { | _get_inet_address() | ||||||
|  | { | ||||||
| 	set -- $(LC_ALL=C ifconfig "${IFACE}" | | 	set -- $(LC_ALL=C ifconfig "${IFACE}" | | ||||||
| 	sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p') | 	sed -n -e 's/.*inet addr:\([^ ]*\).*Mask:\([^ ]*\).*/\1 \2/p') | ||||||
| 	[ -z "$1" ] && return 1 | 	[ -z "$1" ] && return 1 | ||||||
| @@ -97,7 +85,8 @@ _get_inet_address() { | |||||||
| 	echo "/$(_netmask2cidr "$1")" | 	echo "/$(_netmask2cidr "$1")" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_inet_addresses() { | _get_inet_addresses() | ||||||
|  | { | ||||||
| 	local iface=${IFACE} i=0 | 	local iface=${IFACE} i=0 | ||||||
| 	local addrs="$(_get_inet_address)" | 	local addrs="$(_get_inet_address)" | ||||||
|  |  | ||||||
| @@ -111,7 +100,8 @@ _get_inet_addresses() { | |||||||
| 	echo "${addrs}" | 	echo "${addrs}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _cidr2netmask() { | _cidr2netmask() | ||||||
|  | { | ||||||
| 	local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128 | 	local cidr="$1" netmask="" done=0 i=0 sum=0 cur=128 | ||||||
| 	local octets= frac= | 	local octets= frac= | ||||||
|  |  | ||||||
| @@ -141,7 +131,8 @@ _cidr2netmask() { | |||||||
| 	echo "${netmask#.*}" | 	echo "${netmask#.*}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -189,7 +180,8 @@ _add_address() { | |||||||
| 	ifconfig "${iface}" ${cmd} | 	ifconfig "${iface}" ${cmd} | ||||||
| } | } | ||||||
|  |  | ||||||
| _add_route() { | _add_route() | ||||||
|  | { | ||||||
| 	local inet6= | 	local inet6= | ||||||
|  |  | ||||||
| 	if [ -n "${metric}" ]; then | 	if [ -n "${metric}" ]; then | ||||||
| @@ -214,7 +206,8 @@ _add_route() { | |||||||
| 	route ${inet6} add "$@" dev "${IFACE}" | 	route ${inet6} add "$@" dev "${IFACE}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _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;; | ||||||
| @@ -250,15 +243,18 @@ _delete_addresses() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _has_carrier() { | _has_carrier() | ||||||
|  | { | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _tunnel() { | _tunnel() | ||||||
|  | { | ||||||
| 	iptunnel "$@" | 	iptunnel "$@" | ||||||
| } | } | ||||||
|  |  | ||||||
| ifconfig_pre_start() { | ifconfig_pre_start() | ||||||
|  | { | ||||||
| 	# MTU support | 	# MTU support | ||||||
| 	local mtu= | 	local mtu= | ||||||
| 	eval mtu=\$mtu_${IFVAR} | 	eval mtu=\$mtu_${IFVAR} | ||||||
| @@ -282,7 +278,8 @@ ifconfig_pre_start() { | |||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| ifconfig_post_stop() { | ifconfig_post_stop() | ||||||
|  | { | ||||||
| 	# Don't delete sit0 as it's a special tunnel | 	# Don't delete sit0 as it's a special tunnel | ||||||
| 	[ "${IFACE}" = "sit0" ] && return 0 | 	[ "${IFACE}" = "sit0" ] && return 0 | ||||||
|  |  | ||||||
| @@ -292,5 +289,3 @@ ifconfig_post_stop() { | |||||||
| 	iptunnel del "${IFACE}" | 	iptunnel del "${IFACE}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,37 +1,18 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without |  | ||||||
| # modification, are permitted provided that the following conditions |  | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars plug_timeout" | _config_vars="$_config_vars plug_timeout" | ||||||
|  |  | ||||||
| ifplugd_depend() { | ifplugd_depend() | ||||||
|  | { | ||||||
| 	program start /usr/sbin/ifplugd | 	program start /usr/sbin/ifplugd | ||||||
| 	after macnet rename | 	after macnet rename | ||||||
| 	before interface | 	before interface | ||||||
| 	provide plug | 	provide plug | ||||||
| } | } | ||||||
|  |  | ||||||
| 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 ifplugd if we're being called from the background | 	# We don't start ifplugd if we're being called from the background | ||||||
| @@ -97,7 +78,8 @@ ifplugd_pre_start() { | |||||||
| 	exit 1 | 	exit 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| ifplugd_stop() { | ifplugd_stop() | ||||||
|  | { | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
|  |  | ||||||
| 	local pidfile="/var/run/ifplugd.${IFACE}.pid" | 	local pidfile="/var/run/ifplugd.${IFACE}.pid" | ||||||
| @@ -108,5 +90,3 @@ ifplugd_stop() { | |||||||
| 		--pidfile "${pidfile}" --signal QUIT | 		--pidfile "${pidfile}" --signal QUIT | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,34 +1,15 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without |  | ||||||
| # modification, are permitted provided that the following conditions |  | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars link suffix relay" | _config_vars="$_config_vars link suffix relay" | ||||||
|  |  | ||||||
| ip6to4_depend() { | ip6to4_depend() | ||||||
|  | { | ||||||
| 	after interface | 	after interface | ||||||
| } | } | ||||||
|  |  | ||||||
| ip6to4_start() { | ip6to4_start() | ||||||
|  | { | ||||||
| 	case " ${MODULES} " in | 	case " ${MODULES} " in | ||||||
| 		*" ifconfig "*) | 		*" ifconfig "*) | ||||||
| 			if [ "${IFACE}" != "sit0" ]; then | 			if [ "${IFACE}" != "sit0" ]; then | ||||||
| @@ -116,5 +97,3 @@ ip6to4_start() { | |||||||
| 2003::/3 via ::${relay} metric 2147483647" | 2003::/3 via ::${relay} metric 2147483647" | ||||||
| 	eval routes_${IFVAR}=\$routes | 	eval routes_${IFVAR}=\$routes | ||||||
| } | } | ||||||
| 	 |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | ipppd_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| ipppd_depend() { |  | ||||||
| 	program start /usr/sbin/ipppd | 	program start /usr/sbin/ipppd | ||||||
| 	after macnet | 	after macnet | ||||||
| 	before interface | 	before interface | ||||||
| @@ -31,7 +11,8 @@ ipppd_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars ipppd" | _config_vars="$_config_vars ipppd" | ||||||
|  |  | ||||||
| ipppd_pre_start() { | ipppd_pre_start() | ||||||
|  | { | ||||||
| 	local opts= pidfile="/var/run/ipppd-${IFACE}.pid" | 	local opts= pidfile="/var/run/ipppd-${IFACE}.pid" | ||||||
|  |  | ||||||
| 	# Check that we are a valid ippp interface | 	# Check that we are a valid ippp interface | ||||||
| @@ -54,7 +35,8 @@ ipppd_pre_start() { | |||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| ipppd_post_stop() { | ipppd_post_stop() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/ipppd-${IFACE}.pid" | 	local pidfile="/var/run/ipppd-${IFACE}.pid" | ||||||
|  |  | ||||||
| 	[ ! -f "${pidfile}" ] && return 0 | 	[ ! -f "${pidfile}" ] && return 0 | ||||||
| @@ -64,5 +46,3 @@ ipppd_post_stop() { | |||||||
| 		--pidfile "${pidfile}" | 		--pidfile "${pidfile}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,46 +1,30 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | iproute2_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| iproute2_depend() { |  | ||||||
| 	program /sbin/ip | 	program /sbin/ip | ||||||
| 	provide interface | 	provide interface | ||||||
| 	after ifconfig | 	after ifconfig | ||||||
| } | } | ||||||
|  |  | ||||||
| _up() { | _up() | ||||||
|  | { | ||||||
| 	ip link set up dev "${IFACE}" | 	ip link set up dev "${IFACE}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _down() { | _down() | ||||||
|  | { | ||||||
| 	ip link set down dev "${IFACE}" | 	ip link set down dev "${IFACE}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _exists() { | _exists() | ||||||
|  | { | ||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/dev | ||||||
| } | } | ||||||
|  |  | ||||||
| _ifindex() { | _ifindex() | ||||||
|  | { | ||||||
| 	local line= i=-2 | 	local line= i=-2 | ||||||
| 	while read line; do | 	while read line; do | ||||||
| 		i=$((${i} + 1)) | 		i=$((${i} + 1)) | ||||||
| @@ -56,7 +40,8 @@ _ifindex() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _is_wireless() { | _is_wireless() | ||||||
|  | { | ||||||
| 	# Support new sysfs layout | 	# Support new sysfs layout | ||||||
| 	[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0 | 	[ -d /sys/class/net/"${IFACE}"/wireless ] && return 0 | ||||||
|  |  | ||||||
| @@ -64,7 +49,8 @@ _is_wireless() { | |||||||
| 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless | 	grep -Eq "^[[:space:]]*${IFACE}:" /proc/net/wireless | ||||||
| } | } | ||||||
|  |  | ||||||
| _set_flag() { | _set_flag() | ||||||
|  | { | ||||||
| 	local flag=$1 opt="on" | 	local flag=$1 opt="on" | ||||||
| 	if [ "${flag#-}" != "${flag}" ]; then | 	if [ "${flag#-}" != "${flag}" ]; then | ||||||
| 		flag=${flag#-} | 		flag=${flag#-} | ||||||
| @@ -73,7 +59,8 @@ _set_flag() { | |||||||
| 	ip link set "${IFACE}" "${flag}" "${opt}" | 	ip link set "${IFACE}" "${flag}" "${opt}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_mac_address() { | _get_mac_address() | ||||||
|  | { | ||||||
| 	local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \ | 	local mac=$(LC_ALL=C ip link show "${IFACE}" | sed -n \ | ||||||
| 		-e 'y/abcdef/ABCDEF/' \ | 		-e 'y/abcdef/ABCDEF/' \ | ||||||
| 		-e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p') | 		-e '/link\// s/^.*\<\(..:..:..:..:..:..\)\>.*/\1/p') | ||||||
| @@ -89,22 +76,26 @@ _get_mac_address() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _set_mac_address() { | _set_mac_address() | ||||||
|  | { | ||||||
| 	ip link set address "$1" dev "${IFACE}" | 	ip link set address "$1" dev "${IFACE}" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_inet_addresses() { | _get_inet_addresses() | ||||||
|  | { | ||||||
| 	LC_ALL=C ip -family inet addr show "${IFACE}" | \ | 	LC_ALL=C ip -family inet addr show "${IFACE}" | \ | ||||||
| 	sed -n -e 's/.*inet \([^ ]*\).*/\1/p' | 	sed -n -e 's/.*inet \([^ ]*\).*/\1/p' | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_inet_address() { | _get_inet_address() | ||||||
|  | { | ||||||
| 	set -- $(_get_inet_addresses) | 	set -- $(_get_inet_addresses) | ||||||
| 	[ $# = "0" ] && return 1 | 	[ $# = "0" ] && return 1 | ||||||
| 	echo "$1" | 	echo "$1" | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -138,7 +129,8 @@ _add_address() { | |||||||
| 	ip addr add dev "${IFACE}" "$@" | 	ip addr add dev "${IFACE}" "$@" | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -167,7 +159,8 @@ _add_route() { | |||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -176,15 +169,18 @@ _delete_addresses() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _has_carrier() { | _has_carrier() | ||||||
|  | { | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _tunnel() { | _tunnel() | ||||||
|  | { | ||||||
| 	ip tunnel "$@" | 	ip tunnel "$@" | ||||||
| } | } | ||||||
|  |  | ||||||
| iproute2_pre_start() { | iproute2_pre_start() | ||||||
|  | { | ||||||
| 	# MTU support | 	# MTU support | ||||||
| 	local mtu= | 	local mtu= | ||||||
| 	eval mtu=\$mtu_${IFVAR} | 	eval mtu=\$mtu_${IFVAR} | ||||||
| @@ -210,12 +206,14 @@ iproute2_pre_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| _iproute2_ipv6_tentative() { | _iproute2_ipv6_tentative() | ||||||
| 		LC_ALL=C ip addr show dev "${IFACE}" | \ | { | ||||||
|  | 	LC_ALL=C ip addr show dev "${IFACE}" | \ | ||||||
| 		grep -q "^[[:space:]]*inet6 .* tentative" | 		grep -q "^[[:space:]]*inet6 .* tentative" | ||||||
| } | } | ||||||
|  |  | ||||||
| iproute2_post_start() { | iproute2_post_start() | ||||||
|  | { | ||||||
| 	# Kernel may not have IP built in | 	# Kernel may not have IP built in | ||||||
| 	if [ -e /proc/net/route ]; then | 	if [ -e /proc/net/route ]; then | ||||||
| 		ip route flush table cache dev "${IFACE}" | 		ip route flush table cache dev "${IFACE}" | ||||||
| @@ -230,7 +228,8 @@ iproute2_post_start() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| 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 | ||||||
| @@ -240,5 +239,3 @@ iproute2_post_stop() { | |||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,50 +1,35 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | _config_vars="$_config_vars ssid mode associate_timeout sleep_scan" | ||||||
| # modification, are permitted provided that the following conditions | _config_vars="$_config_vars preferred_aps blacklist_aps" | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars ssid mode associate_timeout sleep_scan preferred_aps blacklist_aps" | iwconfig_depend() | ||||||
|  | { | ||||||
| iwconfig_depend() { |  | ||||||
| 	program /sbin/iwconfig | 	program /sbin/iwconfig | ||||||
| 	after plug | 	after plug | ||||||
| 	before interface | 	before interface | ||||||
| 	provide wireless | 	provide wireless | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_wep_status() { | 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}" | ||||||
| 	fi | 	fi | ||||||
|  |  | ||||||
| 	echo "(WEP ${status}${mode})" | 	echo "(WEP ${status}${mode})" | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_ssid() { | _get_ssid() | ||||||
|  | { | ||||||
| 	local i=5 ssid= | 	local i=5 ssid= | ||||||
|  |  | ||||||
| 	while [ ${i} -gt 0 ]; do | 	while [ ${i} -gt 0 ]; do | ||||||
| @@ -60,7 +45,8 @@ _get_ssid() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _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;; | ||||||
| @@ -71,13 +57,15 @@ _get_ap_mac_address() { | |||||||
| 	esac | 	esac | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_mode() { | iwconfig_get_mode() | ||||||
|  | { | ||||||
| 	LC_ALL=C iwgetid --mode "${IFACE}" | \ | 	LC_ALL=C iwgetid --mode "${IFACE}" | \ | ||||||
| 	sed -n -e 's/^.*Mode:\(.*\)/\1/p' | \ | 	sed -n -e 's/^.*Mode:\(.*\)/\1/p' | \ | ||||||
| 	tr '[:upper:]' '[:lower:]' | 	tr '[:upper:]' '[:lower:]' | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_set_mode() { | iwconfig_set_mode() | ||||||
|  | { | ||||||
| 	local mode="$1" | 	local mode="$1" | ||||||
| 	[ "${mode}" = "$(iwconfig_get_mode)" ] && return 0 | 	[ "${mode}" = "$(iwconfig_get_mode)" ] && return 0 | ||||||
|  |  | ||||||
| @@ -87,11 +75,14 @@ iwconfig_set_mode() { | |||||||
| 	_up | 	_up | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_type() { | iwconfig_get_type() | ||||||
| 	LC_ALL=C iwconfig "${IFACE}" | sed -n -e 's/^'"$1"' *\([^ ]* [^ ]*\).*/\1/p' | { | ||||||
|  | 	LC_ALL=C iwconfig "${IFACE}" | \ | ||||||
|  | 	sed -n -e 's/^'"$1"' *\([^ ]* [^ ]*\).*/\1/p' | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_report() { | iwconfig_report() | ||||||
|  | { | ||||||
| 	local mac= m="connected to" | 	local mac= m="connected to" | ||||||
| 	local ssid="$(_get_ssid)" | 	local ssid="$(_get_ssid)" | ||||||
| 	local wep_status="$(iwconfig_get_wep_status)" | 	local wep_status="$(iwconfig_get_wep_status)" | ||||||
| @@ -111,7 +102,8 @@ iwconfig_report() { | |||||||
| 	eoutdent | 	eoutdent | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_get_wep_key() { | iwconfig_get_wep_key() | ||||||
|  | { | ||||||
| 	local mac="$1" key= | 	local mac="$1" 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} | ||||||
| @@ -132,7 +124,8 @@ iwconfig_get_wep_key() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_user_config() { | iwconfig_user_config() | ||||||
|  | { | ||||||
| 	local conf= var=${SSIDVAR} config= | 	local conf= var=${SSIDVAR} config= | ||||||
| 	[ -z "${var}" ] && var=${IFVAR} | 	[ -z "${var}" ] && var=${IFVAR} | ||||||
|  |  | ||||||
| @@ -158,7 +151,8 @@ iwconfig_user_config() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_setup_specific() { | iwconfig_setup_specific() | ||||||
|  | { | ||||||
| 	local mode="$1" channel= | 	local mode="$1" channel= | ||||||
| 	if [ -z "${SSID}" ]; then | 	if [ -z "${SSID}" ]; then | ||||||
| 		eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode" | 		eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode" | ||||||
| @@ -199,7 +193,8 @@ iwconfig_setup_specific() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_wait_for_association() { | iwconfig_wait_for_association() | ||||||
|  | { | ||||||
| 	local timeout= i=0 | 	local timeout= i=0 | ||||||
| 	eval timeout=\$associate_timeout_${IFVAR} | 	eval timeout=\$associate_timeout_${IFVAR} | ||||||
| 	timeout=${timeout:-10} | 	timeout=${timeout:-10} | ||||||
| @@ -236,8 +231,10 @@ iwconfig_wait_for_association() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_associate() { | iwconfig_associate() | ||||||
| 	local mode="${1:-managed}" mac="$2" wep_required="$3" freq="$4" chan="$5" | { | ||||||
|  | 	local mode="${1:-managed}" mac="$2" wep_required="$3" | ||||||
|  | 	local freq="$4" chan="$5" | ||||||
| 	local w="(WEP Disabled)" key= | 	local w="(WEP Disabled)" key= | ||||||
|  |  | ||||||
| 	iwconfig_set_mode "${mode}" | 	iwconfig_set_mode "${mode}" | ||||||
| @@ -322,7 +319,8 @@ iwconfig_associate() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_scan() { | iwconfig_scan() | ||||||
|  | { | ||||||
| 	local x= i=0 scan= | 	local x= i=0 scan= | ||||||
| 	einfo "Scanning for access points" | 	einfo "Scanning for access points" | ||||||
| 	eindent | 	eindent | ||||||
| @@ -333,9 +331,9 @@ iwconfig_scan() { | |||||||
|  |  | ||||||
| 	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 | ||||||
| 		# then we need to wait for at least 2 seconds whilst the interface | 		# results then we need to wait for at least 2 seconds whilst | ||||||
| 		# does an initial scan. | 		# the interface 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"*) | ||||||
| @@ -509,7 +507,8 @@ iwconfig_scan() { | |||||||
| 	eoutdent | 	eoutdent | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_force_preferred() { | iwconfig_force_preferred() | ||||||
|  | { | ||||||
| 	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") | ||||||
| 	[ $# = 0 ] && return 1 | 	[ $# = 0 ] && return 1 | ||||||
| @@ -535,7 +534,8 @@ iwconfig_force_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_connect_preferred() { | iwconfig_connect_preferred() | ||||||
|  | { | ||||||
| 	local ssid= i= mode= mac= enc= freq= chan= | 	local ssid= i= mode= mac= enc= freq= chan= | ||||||
| 	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") | ||||||
| @@ -562,7 +562,8 @@ iwconfig_connect_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| 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 | ||||||
| @@ -594,7 +595,8 @@ iwconfig_connect_not_preferred() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| 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 | ||||||
| @@ -606,7 +608,8 @@ iwconfig_defaults() { | |||||||
| 	iwconfig "${IFACE}" essid off 2>/dev/null | 	iwconfig "${IFACE}" essid off 2>/dev/null | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_configure() { | iwconfig_configure() | ||||||
|  | { | ||||||
| 	local x= APS= | 	local x= APS= | ||||||
| 	eval SSID=\$ssid_${IFVAR} | 	eval SSID=\$ssid_${IFVAR} | ||||||
|  |  | ||||||
| @@ -681,7 +684,8 @@ iwconfig_configure() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_pre_start() { | iwconfig_pre_start() | ||||||
|  | { | ||||||
| 	# We don't configure wireless if we're being called from | 	# We don't configure wireless if we're being called from | ||||||
| 	# the background | 	# the background | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
| @@ -748,11 +752,10 @@ iwconfig_pre_start() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| iwconfig_post_stop() { | iwconfig_post_stop() | ||||||
|  | { | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
| 	_exists || return 0 | 	_exists || return 0 | ||||||
| 	iwconfig_defaults | 	iwconfig_defaults | ||||||
| 	iwconfig "${IFACE}" txpower off 2>/dev/null | 	iwconfig "${IFACE}" txpower off 2>/dev/null | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4  |  | ||||||
|   | |||||||
| @@ -1,30 +1,10 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without |  | ||||||
| # modification, are permitted provided that the following conditions |  | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars plug_timeout" | _config_vars="$_config_vars plug_timeout" | ||||||
|  |  | ||||||
| netplugd_depend() { | netplugd_depend() | ||||||
|  | { | ||||||
| 	program start /sbin/netplugd | 	program start /sbin/netplugd | ||||||
| 	after macnet rename | 	after macnet rename | ||||||
| 	before interface | 	before interface | ||||||
| @@ -34,7 +14,8 @@ netplugd_depend() { | |||||||
| 	before ifplugd | 	before ifplugd | ||||||
| } | } | ||||||
|  |  | ||||||
| netplugd_pre_start() { | netplugd_pre_start() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/netplugd-${IFACE}.pid" timeout= | 	local pidfile="/var/run/netplugd-${IFACE}.pid" timeout= | ||||||
|  |  | ||||||
| 	# We don't start netplug if we're being called from the background | 	# We don't start netplug if we're being called from the background | ||||||
| @@ -99,7 +80,8 @@ netplugd_pre_start() { | |||||||
| 	exit 1 | 	exit 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| netplugd_stop() { | netplugd_stop() | ||||||
|  | { | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
|  |  | ||||||
| 	local pidfile="/var/run/netplugd-${IFACE}.pid" | 	local pidfile="/var/run/netplugd-${IFACE}.pid" | ||||||
| @@ -110,5 +92,3 @@ netplugd_stop() { | |||||||
| 		--pidfile "${pidfile}" | 		--pidfile "${pidfile}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,44 +1,27 @@ | |||||||
| # Copyright 2005-2007 Gentoo Foundation | # Copyright 2005-2007 Gentoo Foundation | ||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | pppd_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| pppd_depend() { |  | ||||||
| 	program /usr/sbin/pppd | 	program /usr/sbin/pppd | ||||||
| 	after interface | 	after interface | ||||||
| 	before dhcp | 	before dhcp | ||||||
| 	provide ppp | 	provide ppp | ||||||
| } | } | ||||||
|  |  | ||||||
| is_ppp() { | is_ppp() | ||||||
|  | { | ||||||
| 	[ -e /var/run/ppp-"${IFACE}".pid ] | 	[ -e /var/run/ppp-"${IFACE}".pid ] | ||||||
| } | } | ||||||
|  |  | ||||||
| requote() { | requote() | ||||||
|  | { | ||||||
| 	printf "'%s' " "$@" | 	printf "'%s' " "$@" | ||||||
| } | } | ||||||
|  |  | ||||||
| pppd_pre_start() { | pppd_pre_start() | ||||||
|  | { | ||||||
| 	# Interface has to be called ppp | 	# Interface has to be called ppp | ||||||
| 	[ "${IFACE%%[0-9]*}" = "ppp" ] || return 0 | 	[ "${IFACE%%[0-9]*}" = "ppp" ] || return 0 | ||||||
|  |  | ||||||
| @@ -240,11 +223,13 @@ pppd_pre_start() { | |||||||
| } | } | ||||||
|  |  | ||||||
| # Dummy function for users that still have config_ppp0="ppp" | # Dummy function for users that still have config_ppp0="ppp" | ||||||
| pppd_start() { | pppd_start() | ||||||
|  | { | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| pppd_stop() { | pppd_stop() | ||||||
|  | { | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
| 	local pidfile="/var/run/ppp-${IFACE}.pid" | 	local pidfile="/var/run/ppp-${IFACE}.pid" | ||||||
|  |  | ||||||
| @@ -256,5 +241,3 @@ pppd_stop() { | |||||||
| 		--pidfile "${pidfile}" --retry 30 | 		--pidfile "${pidfile}" --retry 30 | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | pump_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| pump_depend() { |  | ||||||
| 	program /sbin/pump | 	program /sbin/pump | ||||||
| 	after interface | 	after interface | ||||||
| 	provide dhcp | 	provide dhcp | ||||||
| @@ -30,7 +10,8 @@ pump_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars dhcp pump" | _config_vars="$_config_vars dhcp pump" | ||||||
|  |  | ||||||
| pump_start() { | pump_start() | ||||||
|  | { | ||||||
| 	local args= opt= opts= | 	local args= opt= opts= | ||||||
|  |  | ||||||
| 	# Get our options | 	# Get our options | ||||||
| @@ -60,7 +41,8 @@ pump_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| pump_stop() { | pump_stop() | ||||||
|  | { | ||||||
| 	# We check for a pump process first as querying for status | 	# We check for a pump process first as querying for status | ||||||
| 	# causes pump to spawn a process | 	# causes pump to spawn a process | ||||||
| 	start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0 | 	start-stop-daemon --quiet --test --stop --exec /sbin/pump || return 0 | ||||||
| @@ -75,5 +57,3 @@ pump_stop() { | |||||||
| 	pump --release --interface "${IFACE}" | 	pump --release --interface "${IFACE}" | ||||||
| 	eend $? "Failed to stop pump" | 	eend $? "Failed to stop pump" | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,38 +1,20 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | tuntap_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| tuntap_depend() { |  | ||||||
| 	before bridge interface macchanger | 	before bridge interface macchanger | ||||||
| } | } | ||||||
|  |  | ||||||
| _config_vars="$_config_vars tunctl" | _config_vars="$_config_vars tunctl" | ||||||
|  |  | ||||||
| _is_tuntap() { | _is_tuntap() | ||||||
|  | { | ||||||
| 	[ -n "$(export SVCNAME="net.${IFACE}"; service_get_value tuntap)" ] | 	[ -n "$(export SVCNAME="net.${IFACE}"; service_get_value tuntap)" ] | ||||||
| } | } | ||||||
|  |  | ||||||
| tuntap_pre_start() { | tuntap_pre_start() | ||||||
|  | { | ||||||
| 	local tuntap= | 	local tuntap= | ||||||
| 	eval tuntap=\$tuntap_${IFVAR} | 	eval tuntap=\$tuntap_${IFVAR} | ||||||
|  |  | ||||||
| @@ -61,7 +43,8 @@ tuntap_pre_start() { | |||||||
| 	eend $? && _up && service_set_value tuntap "${tuntap}" | 	eend $? && _up && service_set_value tuntap "${tuntap}" | ||||||
| } | } | ||||||
|  |  | ||||||
| tuntap_post_stop() { | tuntap_post_stop() | ||||||
|  | { | ||||||
| 	_is_tuntap || return 0 | 	_is_tuntap || return 0 | ||||||
|  |  | ||||||
| 	ebegin "Destroying Tun/Tap interface ${IFACE}" | 	ebegin "Destroying Tun/Tap interface ${IFACE}" | ||||||
| @@ -74,5 +57,3 @@ tuntap_post_stop() { | |||||||
| 	fi | 	fi | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | udhcpc_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| udhcpc_depend() { |  | ||||||
| 	program start /sbin/udhcpc | 	program start /sbin/udhcpc | ||||||
| 	after interface | 	after interface | ||||||
| 	provide dhcp | 	provide dhcp | ||||||
| @@ -30,7 +10,9 @@ udhcpc_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars dhcp udhcpc" | _config_vars="$_config_vars dhcp udhcpc" | ||||||
|  |  | ||||||
| udhcpc_start() { | # WARNING:- The relies heavily on Gentoo patches and scripts for udhcpc | ||||||
|  | udhcpc_start() | ||||||
|  | { | ||||||
| 	local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid" | 	local args= opt= opts= pidfile="/var/run/udhcpc-${IFACE}.pid" | ||||||
| 	local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease" | 	local sendhost=true cachefile="/var/cache/udhcpc-${IFACE}.lease" | ||||||
|  |  | ||||||
| @@ -98,7 +80,8 @@ udhcpc_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| udhcpc_stop() { | udhcpc_stop() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/udhcpc-${IFACE}.pid" opts= | 	local pidfile="/var/run/udhcpc-${IFACE}.pid" opts= | ||||||
| 	[ ! -f "${pidfile}" ] && return 0 | 	[ ! -f "${pidfile}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -120,5 +103,3 @@ udhcpc_stop() { | |||||||
| 	start-stop-daemon --stop --exec /sbin/udhcpc --pidfile "${pidfile}" | 	start-stop-daemon --stop --exec /sbin/udhcpc --pidfile "${pidfile}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | vlan_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| vlan_depend() { |  | ||||||
| 	program /sbin/vconfig | 	program /sbin/vconfig | ||||||
| 	after interface | 	after interface | ||||||
| 	before dhcp | 	before dhcp | ||||||
| @@ -30,18 +10,21 @@ vlan_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars vlans" | _config_vars="$_config_vars vlans" | ||||||
|  |  | ||||||
| _is_vlan() { | _is_vlan() | ||||||
|  | { | ||||||
| 	[ ! -d /proc/net/vlan ] && return 1 | 	[ ! -d /proc/net/vlan ] && return 1 | ||||||
| 	[ -e /proc/net/vlan/"${IFACE}" ] && return 0 | 	[ -e /proc/net/vlan/"${IFACE}" ] && return 0 | ||||||
| 	grep -Eq "^${IFACE}[[:space:]]+" /proc/net/vlan/config | 	grep -Eq "^${IFACE}[[:space:]]+" /proc/net/vlan/config | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_vlans() { | _get_vlans() | ||||||
|  | { | ||||||
| 	[ -e /proc/net/vlan/config ] || return 1 | 	[ -e /proc/net/vlan/config ] || return 1 | ||||||
| 	sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config | 	sed -n -e 's/^\(.*[0-9]\) \(.* \) .*'"${IFACE}"'$/\1/p' /proc/net/vlan/config | ||||||
| } | } | ||||||
|  |  | ||||||
| _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 | ||||||
| @@ -51,7 +34,8 @@ _check_vlan() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| vlan_pre_start() { | vlan_pre_start() | ||||||
|  | { | ||||||
| 	local vc="$(_get_array "vconfig_${IFVAR}")" | 	local vc="$(_get_array "vconfig_${IFVAR}")" | ||||||
| 	[ -z "${vc}" ] && return 0 | 	[ -z "${vc}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -79,7 +63,8 @@ vlan_pre_start() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
| vlan_post_start() { | vlan_post_start() | ||||||
|  | { | ||||||
| 	local vlans= | 	local vlans= | ||||||
| 	eval vlans=\$vlans_${IFACE} | 	eval vlans=\$vlans_${IFACE} | ||||||
| 	[ -z "${vlans}" ] && return 0 | 	[ -z "${vlans}" ] && return 0 | ||||||
| @@ -114,7 +99,8 @@ vlan_post_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| vlan_post_stop() { | vlan_post_stop() | ||||||
|  | { | ||||||
| 	local vlan= | 	local vlan= | ||||||
|  |  | ||||||
| 	for vlan in $(_get_vlans); do | 	for vlan in $(_get_vlans); do | ||||||
| @@ -130,5 +116,3 @@ vlan_post_stop() { | |||||||
|  |  | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | dhclient_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| dhclient_depend() { |  | ||||||
| 	after interface | 	after interface | ||||||
| 	program start /sbin/dhclient | 	program start /sbin/dhclient | ||||||
| 	provide dhcp | 	provide dhcp | ||||||
| @@ -30,7 +10,8 @@ dhclient_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars dhcp dhcpcd" | _config_vars="$_config_vars dhcp dhcpcd" | ||||||
|  |  | ||||||
| dhclient_start() { | dhclient_start() | ||||||
|  | { | ||||||
| 	local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid" | 	local args= opt= opts= pidfile="/var/run/dhclient-${IFACE}.pid" | ||||||
| 	local sendhost=true dconf= | 	local sendhost=true dconf= | ||||||
|  |  | ||||||
| @@ -63,14 +44,16 @@ dhclient_start() { | |||||||
| 	# Bring up DHCP for this interface | 	# Bring up DHCP for this interface | ||||||
| 	ebegin "Running dhclient" | 	ebegin "Running dhclient" | ||||||
| 	echo "${dhconf}" | start-stop-daemon --start --exec /sbin/dhclient \ | 	echo "${dhconf}" | start-stop-daemon --start --exec /sbin/dhclient \ | ||||||
| 		--pidfile "${pidfile}" -- ${args} -q -1 -pf "${pidfile}" "${IFACE}" | 		--pidfile "${pidfile}" \ | ||||||
|  | 		-- ${args} -q -1 -pf "${pidfile}" "${IFACE}" | ||||||
| 	eend $? || return 1 | 	eend $? || return 1 | ||||||
|  |  | ||||||
| 	_show_address | 	_show_address | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| dhclient_stop() { | dhclient_stop() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/dhclient-${IFACE}.pid" opts= | 	local pidfile="/var/run/dhclient-${IFACE}.pid" opts= | ||||||
| 	[ ! -f "${pidfile}" ] && return 0 | 	[ ! -f "${pidfile}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -90,5 +73,3 @@ dhclient_stop() { | |||||||
| 	esac | 	esac | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | dhcpcd_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| dhcpcd_depend() { |  | ||||||
| 	after interface | 	after interface | ||||||
| 	program start dhcpcd | 	program start dhcpcd | ||||||
| 	provide dhcp | 	provide dhcp | ||||||
| @@ -33,7 +13,8 @@ dhcpcd_depend() { | |||||||
|  |  | ||||||
| _config_vars="$_config_vars dhcp dhcpcd" | _config_vars="$_config_vars dhcp dhcpcd" | ||||||
|  |  | ||||||
| dhcpcd_start() { | dhcpcd_start() | ||||||
|  | { | ||||||
| 	local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" | 	local args= opt= opts= pidfile="/var/run/dhcpcd-${IFACE}.pid" | ||||||
|  |  | ||||||
| 	eval args=\$dhcpcd_${IFVAR} | 	eval args=\$dhcpcd_${IFVAR} | ||||||
| @@ -66,7 +47,8 @@ dhcpcd_start() { | |||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| dhcpcd_stop() { | dhcpcd_stop() | ||||||
|  | { | ||||||
| 	local pidfile="/var/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM | 	local pidfile="/var/run/dhcpcd-${IFACE}.pid" opts= sig=SIGTERM | ||||||
| 	[ ! -f "${pidfile}" ] && return 0 | 	[ ! -f "${pidfile}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -76,8 +58,6 @@ dhcpcd_stop() { | |||||||
| 	case " ${opts} " in | 	case " ${opts} " in | ||||||
| 		*" release "*) sig=SIGHUP;; | 		*" release "*) sig=SIGHUP;; | ||||||
| 	esac | 	esac | ||||||
| 	start-stop-daemon --stop --quiet --signal "${sig}" --pidfile "${pidfile}" | 	start-stop-daemon --stop --quiet --signal ${sig} --pidfile "${pidfile}" | ||||||
| 	eend $? | 	eend $? | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,34 +1,15 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | macchanger_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| macchanger_depend() { |  | ||||||
| 	before macnet | 	before macnet | ||||||
| } | } | ||||||
|  |  | ||||||
| _config_vars="$_config_vars mac" | _config_vars="$_config_vars mac" | ||||||
|  |  | ||||||
| macchanger_pre_start() { | macchanger_pre_start() | ||||||
|  | { | ||||||
| 	# We don't change MAC addresses from background | 	# We don't change MAC addresses from background | ||||||
| 	yesno ${IN_BACKGROUND} && return 0 | 	yesno ${IN_BACKGROUND} && return 0 | ||||||
|  |  | ||||||
| @@ -49,7 +30,8 @@ macchanger_pre_start() { | |||||||
| 	case "${mac}" in | 	case "${mac}" in | ||||||
| 		# specific mac-addr | 		# specific mac-addr | ||||||
| 		${hex}:${hex}:${hex}:${hex}:${hex}:${hex}) | 		${hex}:${hex}:${hex}:${hex}:${hex}:${hex}) | ||||||
| 			# 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) | ||||||
| @@ -92,7 +74,7 @@ macchanger_pre_start() { | |||||||
| 	# 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 | ||||||
| @@ -107,5 +89,3 @@ macchanger_pre_start() { | |||||||
|  |  | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,33 +1,14 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | macnet_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| macnet_depend() { |  | ||||||
| 	before rename interface wireless | 	before rename interface wireless | ||||||
| 	after macchanger | 	after macchanger | ||||||
| } | } | ||||||
|  |  | ||||||
| macnet_pre_start() { | macnet_pre_start() | ||||||
|  | { | ||||||
| 	local mac=$(_get_mac_address 2>/dev/null) | 	local mac=$(_get_mac_address 2>/dev/null) | ||||||
| 	[ -z "${mac}" ] && return 0 | 	[ -z "${mac}" ] && return 0 | ||||||
|  |  | ||||||
| @@ -36,5 +17,3 @@ macnet_pre_start() { | |||||||
| 	_configure_variables "${mac}" | 	_configure_variables "${mac}" | ||||||
| 	veend 0 | 	veend 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,33 +1,14 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | ssidnet_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| ssidnet_depend() { |  | ||||||
| 	before interface system | 	before interface system | ||||||
| 	after wireless | 	after wireless | ||||||
| } | } | ||||||
|  |  | ||||||
| ssidnet_pre_start() { | ssidnet_pre_start() | ||||||
|  | { | ||||||
| 	[ -z "${SSID}" -a -z "${SSIDVAR}" ] && return 0 | 	[ -z "${SSID}" -a -z "${SSIDVAR}" ] && return 0 | ||||||
|  |  | ||||||
| 	local mac=$(_get_ap_mac_address | sed -e 's/://g') x= | 	local mac=$(_get_ap_mac_address | sed -e 's/://g') x= | ||||||
| @@ -41,5 +22,3 @@ ssidnet_pre_start() { | |||||||
|  |  | ||||||
| 	veend 0 | 	veend 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,37 +1,18 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without |  | ||||||
| # modification, are permitted provided that the following conditions |  | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| _config_vars="$_config_vars dns_servers dns_domain dns_search" | _config_vars="$_config_vars dns_servers dns_domain dns_search" | ||||||
| _config_vars="$_config_vars dns_sortlist dns_options" | _config_vars="$_config_vars dns_sortlist dns_options" | ||||||
| _config_vars="$_config_vars ntp_servers nis_servers nis_domain" | _config_vars="$_config_vars ntp_servers nis_servers nis_domain" | ||||||
|  |  | ||||||
| system_depend() { | system_depend() | ||||||
|  | { | ||||||
| 	after interface | 	after interface | ||||||
| 	before dhcp | 	before dhcp | ||||||
| } | } | ||||||
|  |  | ||||||
| _system_dns() { | _system_dns() | ||||||
|  | { | ||||||
| 	local servers= domain= search= sortlist= options= x= | 	local servers= domain= search= sortlist= options= x= | ||||||
|  |  | ||||||
| 	eval servers=\$dns_servers_${IFVAR} | 	eval servers=\$dns_servers_${IFVAR} | ||||||
| @@ -72,7 +53,8 @@ _system_dns() { | |||||||
| 	fi | 	fi | ||||||
| } | } | ||||||
|  |  | ||||||
| _system_ntp() { | _system_ntp() | ||||||
|  | { | ||||||
| 	local servers= buffer= x= | 	local servers= buffer= x= | ||||||
|  |  | ||||||
| 	eval servers=\$ntp_servers_${IFVAR} | 	eval servers=\$ntp_servers_${IFVAR} | ||||||
| @@ -92,7 +74,8 @@ _system_ntp() { | |||||||
| 	chmod 644 /etc/ntp.conf | 	chmod 644 /etc/ntp.conf | ||||||
| } | } | ||||||
|  |  | ||||||
| _system_nis() { | _system_nis() | ||||||
|  | { | ||||||
| 	local servers= domain= x= buffer= | 	local servers= domain= x= buffer= | ||||||
|  |  | ||||||
| 	eval servers=\$nis_servers_${IFVAR} | 	eval servers=\$nis_servers_${IFVAR} | ||||||
| @@ -124,12 +107,11 @@ _system_nis() { | |||||||
| 	chmod 644 /etc/yp.conf | 	chmod 644 /etc/yp.conf | ||||||
| } | } | ||||||
|  |  | ||||||
| system_pre_start() { | system_pre_start() | ||||||
|  | { | ||||||
| 	_system_dns | 	_system_dns | ||||||
| 	_system_ntp  | 	_system_ntp  | ||||||
| 	_system_nis  | 	_system_nis  | ||||||
|  |  | ||||||
| 	return 0 | 	return 0 | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
| @@ -1,28 +1,8 @@ | |||||||
| # Copyright 2007 Roy Marples | # Copyright 2007-2008 Roy Marples | ||||||
| # All rights reserved | # All rights reserved | ||||||
|  |  | ||||||
| # Redistribution and use in source and binary forms, with or without | wpa_supplicant_depend() | ||||||
| # modification, are permitted provided that the following conditions | { | ||||||
| # are met: |  | ||||||
| # 1. Redistributions of source code must retain the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer. |  | ||||||
| # 2. Redistributions in binary form must reproduce the above copyright |  | ||||||
| #    notice, this list of conditions and the following disclaimer in the |  | ||||||
| #    documentation and/or other materials provided with the distribution. |  | ||||||
| # |  | ||||||
| # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |  | ||||||
| # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |  | ||||||
| # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |  | ||||||
| # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |  | ||||||
| # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |  | ||||||
| # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |  | ||||||
| # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |  | ||||||
| # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |  | ||||||
| # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |  | ||||||
| # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |  | ||||||
| # SUCH DAMAGE. |  | ||||||
|  |  | ||||||
| wpa_supplicant_depend() { |  | ||||||
| 	if [ -x /usr/sbin/wpa_supplicant ]; then | 	if [ -x /usr/sbin/wpa_supplicant ]; then | ||||||
| 		program start /usr/sbin/wpa_supplicant | 		program start /usr/sbin/wpa_supplicant | ||||||
| 	else | 	else | ||||||
| @@ -39,7 +19,8 @@ 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>&1; 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 | ||||||
| @@ -55,13 +36,15 @@ _get_ssid() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| _get_ap_mac_address() { | _get_ap_mac_address() | ||||||
|  | { | ||||||
| 	wpa_cli -i"${IFACE}" status | sed -n -e 's/^bssid=\(.*\)$/\1/p' \ | 	wpa_cli -i"${IFACE}" status | sed -n -e 's/^bssid=\(.*\)$/\1/p' \ | ||||||
| 		| tr '[:lower:]' '[:upper:]' | 		| tr '[:lower:]' '[:upper:]' | ||||||
| } | } | ||||||
| fi | fi | ||||||
|  |  | ||||||
| wpa_supplicant_pre_start() { | wpa_supplicant_pre_start() | ||||||
|  | { | ||||||
| 	local opts= cfgfile= ctrl_dir= wireless=true | 	local opts= cfgfile= ctrl_dir= wireless=true | ||||||
| 	local wpas=/usr/sbin/wpa_supplicant wpac=/usr/bin/wpa_cli | 	local wpas=/usr/sbin/wpa_supplicant wpac=/usr/bin/wpa_cli | ||||||
|  |  | ||||||
| @@ -80,7 +63,8 @@ wpa_supplicant_pre_start() { | |||||||
| 	# 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 ${wireless} && service_started_daemon "${SVCNAME}" "${wpas}"; then | 		if ${wireless} && \ | ||||||
|  | 		service_started_daemon "${SVCNAME}" "${wpas}"; then | ||||||
| 			SSID=$(_get_ssid "${IFACE}") | 			SSID=$(_get_ssid "${IFACE}") | ||||||
| 			SSIDVAR=$(_shell_var "${SSID}") | 			SSIDVAR=$(_shell_var "${SSID}") | ||||||
| 			service_set_value "SSID" "${SSID}" | 			service_set_value "SSID" "${SSID}" | ||||||
| @@ -163,7 +147,8 @@ wpa_supplicant_pre_start() { | |||||||
| 	ebegin "Starting wpa_cli on" "${IFACE}" | 	ebegin "Starting wpa_cli on" "${IFACE}" | ||||||
| 	start-stop-daemon --start --exec "${wpac}" \ | 	start-stop-daemon --start --exec "${wpac}" \ | ||||||
| 		--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 ..." | ||||||
| @@ -177,7 +162,8 @@ wpa_supplicant_pre_start() { | |||||||
| 	return 1 | 	return 1 | ||||||
| } | } | ||||||
|  |  | ||||||
| wpa_supplicant_post_stop() { | wpa_supplicant_post_stop() | ||||||
|  | { | ||||||
| 	local wpas=/usr/sbin/wpa_supplicant wpac=/usr/bin/wpa_cli | 	local wpas=/usr/sbin/wpa_supplicant wpac=/usr/bin/wpa_cli | ||||||
|  |  | ||||||
| 	if [ ! -x "${wpas}" ]; then | 	if [ ! -x "${wpas}" ]; then | ||||||
| @@ -209,5 +195,3 @@ wpa_supplicant_post_stop() { | |||||||
| 	[ -S "/var/run/wpa_supplicant/${IFACE}" ] \ | 	[ -S "/var/run/wpa_supplicant/${IFACE}" ] \ | ||||||
| 		&& rm -f "/var/run/wpa_supplicant/${IFACE}" | 		&& rm -f "/var/run/wpa_supplicant/${IFACE}" | ||||||
| } | } | ||||||
|  |  | ||||||
| # vim: set ts=4 : |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user