2009-05-01 19:41:40 +05:30
|
|
|
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
2011-06-30 05:16:31 +05:30
|
|
|
# Released under the 2-clause BSD license.
|
2007-11-14 20:52:04 +05:30
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
_config_vars="$_config_vars ssid mode associate_timeout sleep_scan"
|
|
|
|
_config_vars="$_config_vars preferred_aps blacklist_aps"
|
|
|
|
|
|
|
|
iwconfig_depend()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
program /sbin/iwconfig
|
|
|
|
after plug
|
|
|
|
before interface
|
|
|
|
provide wireless
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_get_wep_status()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local mode= status="disabled"
|
|
|
|
|
|
|
|
# No easy way of doing this grep in bash regex :/
|
2008-01-11 20:38:57 +05:30
|
|
|
if LC_ALL=C iwconfig "${IFACE}" | \
|
|
|
|
grep -qE "^ +Encryption key:[*0-9,A-F]"; then
|
2007-04-05 16:48:42 +05:30
|
|
|
status="enabled"
|
2008-01-11 20:38:57 +05:30
|
|
|
mode=$(LC_ALL=C iwconfig "${IFACE}" | \
|
|
|
|
sed -n -e 's/^.*Security mode:\(.*[^ ]\).*/\1/p')
|
2007-04-05 16:48:42 +05:30
|
|
|
[ -n "${mode}" ] && mode=" - ${mode}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "(WEP ${status}${mode})"
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
_get_ssid()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local i=5 ssid=
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -gt 0 ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
ssid=$(iwgetid --raw "${IFACE}")
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${ssid}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
echo "${ssid}"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
sleep 1
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i -= 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
_get_ap_mac_address()
|
|
|
|
{
|
2011-01-17 15:19:07 +05:30
|
|
|
local mac="$(iwgetid --raw --ap "${IFACE}")"
|
2007-04-05 16:48:42 +05:30
|
|
|
case "${mac}" in
|
2007-11-28 21:15:03 +05:30
|
|
|
"00:00:00:00:00:00") return 1;;
|
|
|
|
"44:44:44:44:44:44") return 1;;
|
|
|
|
"FF:00:00:00:00:00") return 1;;
|
|
|
|
"FF:FF:FF:FF:FF:FF") return 1;;
|
|
|
|
*) echo "${mac}";;
|
2007-04-05 16:48:42 +05:30
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_get_mode()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
LC_ALL=C iwgetid --mode "${IFACE}" | \
|
|
|
|
sed -n -e 's/^.*Mode:\(.*\)/\1/p' | \
|
|
|
|
tr '[:upper:]' '[:lower:]'
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_set_mode()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local mode="$1"
|
|
|
|
[ "${mode}" = "$(iwconfig_get_mode)" ] && return 0
|
|
|
|
|
|
|
|
# Devicescape stack requires the interface to be down
|
|
|
|
_down
|
|
|
|
iwconfig "${IFACE}" mode "${mode}" || return 1
|
|
|
|
_up
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_get_type()
|
|
|
|
{
|
|
|
|
LC_ALL=C iwconfig "${IFACE}" | \
|
|
|
|
sed -n -e 's/^'"$1"' *\([^ ]* [^ ]*\).*/\1/p'
|
2007-04-05 16:48:42 +05:30
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_report()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local mac= m="connected to"
|
|
|
|
local ssid="$(_get_ssid)"
|
|
|
|
local wep_status="$(iwconfig_get_wep_status)"
|
|
|
|
local channel="$(iwgetid --raw --channel "${iface}")"
|
|
|
|
[ -n "${channel}" ] && channel="on channel ${channel} "
|
|
|
|
local mode="$(iwconfig_get_mode)"
|
|
|
|
if [ "${mode}" = "master" ]; then
|
|
|
|
m="configured as"
|
|
|
|
else
|
|
|
|
mac="$(_get_ap_mac_address)"
|
|
|
|
[ -n "${mac}" ] && mac=" at ${mac}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
eindent
|
|
|
|
einfo "${IFACE} ${m} SSID \"${SSID}\"${mac}"
|
|
|
|
einfo "in ${mode} mode ${channel}${wep_status}"
|
|
|
|
eoutdent
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_get_wep_key()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local mac="$1" key=
|
|
|
|
[ -n "${mac}" ] && mac="$(echo "${mac}" | sed -e 's/://g')"
|
|
|
|
eval key=\$mac_key_${mac}
|
|
|
|
[ -z "${key}" ] && eval key=\$key_${SSIDVAR}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -z "${key}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
echo "off"
|
|
|
|
else
|
|
|
|
set -- ${key}
|
|
|
|
local x= e=false
|
2007-11-29 16:53:06 +05:30
|
|
|
for x; do
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${x}" = "enc" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
e=true
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
${e} || key="${key} enc open"
|
|
|
|
echo "${key}"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_user_config()
|
|
|
|
{
|
2007-10-29 15:15:49 +05:30
|
|
|
local conf= var=${SSIDVAR} config=
|
2007-04-05 16:48:42 +05:30
|
|
|
[ -z "${var}" ] && var=${IFVAR}
|
|
|
|
|
2007-10-29 15:15:49 +05:30
|
|
|
config="$(_get_array "iwconfig_${var}")"
|
2007-10-30 17:08:23 +05:30
|
|
|
local IFS="$__IFS"
|
2007-10-29 15:15:49 +05:30
|
|
|
for conf in ${config}; do
|
|
|
|
unset IFS
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! eval iwconfig "${IFACE}" "${conf}"; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${IFACE} does not support the following configuration commands"
|
|
|
|
ewarn " ${conf}"
|
|
|
|
fi
|
|
|
|
done
|
2007-10-29 15:15:49 +05:30
|
|
|
unset IFS
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-10-29 15:15:49 +05:30
|
|
|
config="$(_get_array "iwpriv_${var}")"
|
2007-10-30 17:08:23 +05:30
|
|
|
local IFS="$__IFS"
|
2007-10-29 15:15:49 +05:30
|
|
|
for conf in ${config}; do
|
|
|
|
unset IFS
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! eval iwpriv "${IFACE}" "${conf}"; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${IFACE} does not support the following private ioctls"
|
|
|
|
ewarn " ${conf}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_setup_specific()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local mode="$1" channel=
|
|
|
|
if [ -z "${SSID}" ]; then
|
|
|
|
eerror "${IFACE} requires an SSID to be set to operate in ${mode} mode"
|
|
|
|
eerror "adjust the ssid_${IFVAR} setting in /etc/conf.d/net"
|
|
|
|
return 1
|
|
|
|
fi
|
2008-01-02 21:08:37 +05:30
|
|
|
SSIDVAR=$(shell_var "${SSID}")
|
2007-04-05 16:48:42 +05:30
|
|
|
local key=$(iwconfig_get_wep_key)
|
|
|
|
|
|
|
|
iwconfig_set_mode "${mode}"
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
# Now set the key
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! eval iwconfig "${IFACE}" key "${key}"; then
|
2007-04-05 16:48:42 +05:30
|
|
|
if [ "${key}" != "off" ]; then
|
|
|
|
ewarn "${IFACE} does not support setting keys"
|
|
|
|
ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Then set the SSID
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! iwconfig "${IFACE}" essid "${SSID}"; then
|
2007-04-10 16:03:44 +05:30
|
|
|
eerror "${IFACE} does not support setting SSID to \"${SSID}\""
|
2007-04-05 16:48:42 +05:30
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval channel=\$channel_${SSIDVAR}
|
|
|
|
[ -z "${channel}" ] && eval channel=\$channel_${IFVAR}
|
|
|
|
# We default the channel to 3
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! iwconfig "${IFACE}" channel "${channel:-3}"; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${IFACE} does not support setting the channel to \"${channel:-3}\""
|
|
|
|
return 1
|
|
|
|
fi
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
# Finally apply the user Config
|
|
|
|
iwconfig_user_config
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig_report
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_wait_for_association()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local timeout= i=0
|
|
|
|
eval timeout=\$associate_timeout_${IFVAR}
|
|
|
|
timeout=${timeout:-10}
|
|
|
|
|
|
|
|
[ ${timeout} -eq 0 ] \
|
|
|
|
&& vewarn "WARNING: infinite timeout set for association on ${IFACE}"
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
# Use sysfs if we can
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -e /sys/class/net/"${IFACE}"/carrier ]; then
|
|
|
|
if [ "$(cat /sys/class/net/"${IFACE}"/carrier)" = "1" ]; then
|
2008-05-27 18:37:18 +05:30
|
|
|
# Double check we have an ssid and a non-zero
|
|
|
|
# mac address. This is mainly for buggy
|
|
|
|
# prism54 drivers that always set their
|
|
|
|
# carrier on or buggy madwifi drivers that
|
|
|
|
# sometimes have carrier on and ssid set
|
|
|
|
# without being associated. :/
|
|
|
|
[ -n "$(iwgetid --raw "${IFACE}")" ] && [ "$(iwgetid --ap --raw "${IFACE}")" != "00:00:00:00:00:00" ] && return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
|
|
|
else
|
|
|
|
local atest=
|
|
|
|
eval atest=\$associate_test_${IFVAR}
|
|
|
|
atest=${atest:-mac}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${atest}" = "mac" -o "${atest}" = "all" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
[ -n "$(_get_ap_mac_address)" ] && return 0
|
|
|
|
fi
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${atest}" = "quality" -o "${atest}" = "all" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
[ "$(sed -n -e 's/^.*'"${IFACE}"': *[0-9]* *\([0-9]*\).*/\1/p' \
|
|
|
|
/proc/net/wireless)" != "0" ] && return 0
|
|
|
|
fi
|
|
|
|
fi
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
sleep 1
|
|
|
|
[ ${timeout} -eq 0 ] && continue
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
[ ${i} -ge ${timeout} ] && return 1
|
|
|
|
done
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_associate()
|
|
|
|
{
|
|
|
|
local mode="${1:-managed}" mac="$2" wep_required="$3"
|
|
|
|
local freq="$4" chan="$5"
|
2007-04-05 16:48:42 +05:30
|
|
|
local w="(WEP Disabled)" key=
|
|
|
|
|
|
|
|
iwconfig_set_mode "${mode}"
|
|
|
|
|
|
|
|
if [ "${SSID}" = "any" ]; then
|
|
|
|
iwconfig "${IFACE}" ap any 2>/dev/null
|
2007-04-10 16:03:44 +05:30
|
|
|
unset SSIDVAR
|
2007-04-05 16:48:42 +05:30
|
|
|
else
|
2008-01-02 21:08:37 +05:30
|
|
|
SSIDVAR=$(shell_var "${SSID}")
|
2007-04-05 16:48:42 +05:30
|
|
|
key="$(iwconfig_get_wep_key "${mac}")"
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${wep_required}" = "on" -a "${key}" = "off" ]; then
|
2008-10-10 14:33:59 +05:30
|
|
|
ewarn "WEP key is not set for \"${SSID}\""
|
2007-04-05 16:48:42 +05:30
|
|
|
return 1
|
|
|
|
fi
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${wep_required}" = "off" -a "${key}" != "off" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
key="off"
|
2008-10-10 14:33:59 +05:30
|
|
|
ewarn "\"${SSID}\" is not WEP enabled"
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! eval iwconfig "${IFACE}" key "${key}"; then
|
|
|
|
if [ "${key}" != "off" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${IFACE} does not support setting keys"
|
|
|
|
ewarn "or the parameter \"mac_key_${SSIDVAR}\" or \"key_${SSIDVAR}\" is incorrect"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
[ "${key}" != "off" ] && w="$(iwconfig_get_wep_status "${iface}")"
|
|
|
|
fi
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! iwconfig "${IFACE}" essid "${SSID}"; then
|
|
|
|
if [ "${SSID}" != "any" ]; then
|
2007-04-10 16:03:44 +05:30
|
|
|
ewarn "${IFACE} does not support setting SSID to \"${SSID}\""
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Only use channel or frequency
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${chan}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig "${IFACE}" channel "${chan}"
|
2007-11-28 21:15:03 +05:30
|
|
|
elif [ -n "${freq}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig "${IFACE}" freq "${freq}"
|
|
|
|
fi
|
|
|
|
[ -n "${mac}" ] && iwconfig "${IFACE}" ap "${mac}"
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
# Finally apply the user Config
|
|
|
|
iwconfig_user_config
|
|
|
|
|
|
|
|
ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${SSID}" != "any" ] && type preassociate >/dev/null 2>&1; then
|
2007-04-05 16:48:42 +05:30
|
|
|
veinfo "Running preassociate function"
|
|
|
|
veindent
|
|
|
|
( preassociate )
|
|
|
|
local e=$?
|
|
|
|
veoutdent
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ ${e} -eq 0 ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
veend 1 "preassociate \"${SSID}\" on ${IFACE} failed"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! iwconfig_wait_for_association; then
|
2007-04-05 16:48:42 +05:30
|
|
|
eend 1
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
eend 0
|
|
|
|
|
|
|
|
if [ "${SSID}" = "any" ]; then
|
|
|
|
SSID="$(_get_ssid)"
|
|
|
|
iwconfig_associate
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
iwconfig_report
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if type postassociate >/dev/null 2>&1; then
|
2007-04-05 16:48:42 +05:30
|
|
|
veinfo "Running postassociate function"
|
|
|
|
veindent
|
|
|
|
( postassociate )
|
|
|
|
veoutdent
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_scan()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
local x= i=0 scan=
|
|
|
|
einfo "Scanning for access points"
|
|
|
|
eindent
|
|
|
|
|
|
|
|
# Sleep if required
|
|
|
|
eval x=\$sleep_scan_${IFVAR}
|
|
|
|
[ -n "${x}" ] && sleep "${x}"
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -lt 3 ]; do
|
2007-07-09 14:44:19 +05:30
|
|
|
local scan="${scan}${scan:+ }$(LC_ALL=C iwlist "${IFACE}" scan 2>/dev/null | sed -e "s/'/'\\\\''/g" -e "s/$/'/g" -e "s/^/'/g")"
|
2008-01-11 20:38:57 +05:30
|
|
|
# If this is the first pass and txpower as off and we have no
|
|
|
|
# results then we need to wait for at least 2 seconds whilst
|
|
|
|
# the interface does an initial scan.
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${i}" = "0" -a "${txpowerwasoff}" = "0" ]; then
|
2007-07-09 14:44:19 +05:30
|
|
|
case "${scan}" in
|
|
|
|
"'${IFACE} "*"No scan results"*)
|
|
|
|
sleep 2
|
|
|
|
txpowerwasoff=1
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -z "${scan}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${iface} does not support scanning"
|
|
|
|
eoutdent
|
2007-04-10 16:03:44 +05:30
|
|
|
eval x=\$adhoc_ssid_${IFVAR}
|
2007-04-05 16:48:42 +05:30
|
|
|
[ -n "${x}" ] && return 0
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${preferred_aps}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
[ "${associate_order}" = "forcepreferred" ] || \
|
|
|
|
[ "${associate_order}" = "forcepreferredonly" ] && return 0
|
|
|
|
fi
|
|
|
|
eerror "You either need to set a preferred_aps list in /etc/conf.d/wireless"
|
|
|
|
eerror " preferred_aps=\"SSID1 SSID2\""
|
|
|
|
eerror " and set associate_order_${IFVAR}=\"forcepreferred\""
|
|
|
|
eerror " or set associate_order_${IFVAR}=\"forcepreferredonly\""
|
|
|
|
eerror "or hardcode the SSID to \"any\" and let the driver find an Access Point"
|
|
|
|
eerror " ssid_${IFVAR}=\"any\""
|
|
|
|
eerror "or configure defaulting to Ad-Hoc when Managed fails"
|
2007-04-10 16:03:44 +05:30
|
|
|
eerror " adhoc_ssid_${IFVAR}=\"WLAN\""
|
|
|
|
eerror "or hardcode the SSID against the interface (not recommended)"
|
|
|
|
eerror " ssid_${IFVAR}=\"SSID\""
|
2007-04-05 16:48:42 +05:30
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
APS=-1
|
|
|
|
eval set -- ${scan}
|
2007-11-29 16:53:06 +05:30
|
|
|
for line; do
|
2007-11-28 21:15:03 +05:30
|
|
|
case "${line}" in
|
|
|
|
*Address:*)
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( APS += 1 ))
|
2007-11-28 21:15:03 +05:30
|
|
|
eval MAC_${APS}="\""$(echo "${line#*: }" | tr '[:lower:]' '[:upper:]')"\""
|
2007-11-29 15:08:19 +05:30
|
|
|
eval QUALITY_${APS}=0
|
2011-01-17 15:19:07 +05:30
|
|
|
;;
|
2007-11-28 21:15:03 +05:30
|
|
|
*ESSID:*)
|
|
|
|
x=${line#*\"}
|
|
|
|
x=${x%*\"}
|
|
|
|
eval SSID_${APS}=\$x
|
|
|
|
;;
|
|
|
|
*Mode:*)
|
|
|
|
x="$(echo "${line#*:}" | tr '[:upper:]' '[:lower:]')"
|
|
|
|
if [ "${x}" = "master" ]; then
|
|
|
|
eval MODE_${APS}=managed
|
|
|
|
else
|
|
|
|
eval MODE_${APS}=\$x
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
*'Encryption key:'*)
|
|
|
|
x=${line#*:}
|
|
|
|
eval ENC_${APS}=\$x
|
|
|
|
;;
|
|
|
|
#*Frequency:*)
|
|
|
|
# freq[i]="${line#*:}"
|
|
|
|
# x="${freq[i]#* }"
|
|
|
|
# freq[i]="${freq[i]%% *}${x:0:1}"
|
|
|
|
# ;;
|
|
|
|
*Channel:*)
|
|
|
|
x=${line#*:}
|
|
|
|
x=${x%% *}
|
|
|
|
eval CHAN_${APS}=\$x
|
|
|
|
;;
|
|
|
|
*Quality*)
|
|
|
|
x=${line#*:}
|
|
|
|
x=${x%/*}
|
|
|
|
x="$(echo "${x}" | sed -e 's/[^[:digit:]]//g')"
|
|
|
|
x=${x:-0}
|
|
|
|
eval QUALITY_${APS}=\$x
|
|
|
|
;;
|
|
|
|
esac
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
|
|
|
if [ -z "${MAC_0}" ]; then
|
|
|
|
ewarn "no access points found"
|
|
|
|
eoutdent
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Sort based on quality
|
|
|
|
local i=0 k=1 a= b= x= t=
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -lt ${APS} ]; do
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( k = i + 1 ))
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${k} -le ${APS} ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval a=\$QUALITY_${i}
|
|
|
|
[ -z "${a}" ] && break
|
|
|
|
eval b=\$QUALITY_${k}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${b}" -a "${a}" -lt "${b}" ]; then
|
2008-09-04 20:24:56 +05:30
|
|
|
for x in MAC SSID MODE CHAN QUALITY ENC; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval t=\$${x}_${i}
|
|
|
|
eval ${x}_${i}=\$${x}_${k}
|
|
|
|
eval ${x}_${k}=\$t
|
|
|
|
done
|
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( k += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
|
|
|
# Strip any duplicates
|
|
|
|
local i=0 k=1 a= b=
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -lt ${APS} ]; do
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( k = i + 1 ))
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${k} -le ${APS} ]; do
|
2007-07-09 14:44:19 +05:30
|
|
|
eval a=\$MAC_${i}
|
|
|
|
eval b=\$MAC_${k}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${a}" = "${b}" ]; then
|
2007-07-22 04:05:34 +05:30
|
|
|
eval a=\$QUALITY_${i}
|
|
|
|
eval b=\$QUALITY_${k}
|
2007-07-09 14:44:19 +05:30
|
|
|
local u=${k}
|
2011-01-17 15:19:07 +05:30
|
|
|
# We need to split this into two tests, otherwise bash errors
|
2007-07-22 04:05:34 +05:30
|
|
|
[ -n "${a}" -a -n "${b}" ] && [ "${a}" -lt "${b}" ] && u=${i}
|
2008-09-04 20:24:56 +05:30
|
|
|
unset MAC_${u} SSID_${u} MODE_${u} CHAN_${u} QUALITY_${u} ENC_${u}
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( k += 1 ))
|
2007-07-22 04:05:34 +05:30
|
|
|
done
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
2007-07-31 23:53:56 +05:30
|
|
|
local i=0 e= m= s=
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -le ${APS} ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval x=\$MAC_${i}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -z "${x}" ]; then
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
eval m=\$MODE_${i}
|
|
|
|
eval s=\$SSID_${i}
|
|
|
|
eval q=\$QUALITY_${i}
|
|
|
|
eval e=\$ENC_${i}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${e}" -a "${e}" != "off" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
e=", encrypted"
|
|
|
|
else
|
|
|
|
e=""
|
|
|
|
fi
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -z "${s}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
einfo "Found ${x}, ${m}${e}"
|
|
|
|
else
|
|
|
|
einfo "Found \"${s}\" at ${x}, ${m}${e}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
x="$(echo "${x}" | sed -e 's/://g')"
|
|
|
|
eval x=\$mac_ssid_${x}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${x}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
eval SSID_${i}=\$x
|
|
|
|
s=${x}
|
|
|
|
eindent
|
|
|
|
einfo "mapping to \"${x}\""
|
|
|
|
eoutdent
|
|
|
|
fi
|
|
|
|
|
2007-11-14 23:53:59 +05:30
|
|
|
eval set -- $(_flatten_array "blacklist_aps_${IFVAR}")
|
|
|
|
[ $# = 0 ] && eval set -- $(_flatten_array "blacklist_aps")
|
2007-11-29 16:53:06 +05:30
|
|
|
for x; do
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${x}" = "${s}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
ewarn "${s} has been blacklisted - not connecting"
|
2008-09-04 20:24:56 +05:30
|
|
|
unset SSID_${i} MAC_${i} ${MODE}_${i} CHAN_${i} QUALITY_${i} ENC_${i}
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
|
|
|
done
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
eoutdent
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_force_preferred()
|
|
|
|
{
|
2007-11-14 23:53:59 +05:30
|
|
|
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
|
|
|
|
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
|
|
|
|
[ $# = 0 ] && return 1
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
|
|
ewarn "Trying to force preferred in case they are hidden"
|
2007-11-29 16:53:06 +05:30
|
|
|
for ssid; do
|
2007-04-05 16:48:42 +05:30
|
|
|
local found_AP=false i=0 e=
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -le ${APS} ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval e=\$SSID_${i}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${e}" = "${ssid}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
found_AP=true
|
|
|
|
break
|
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! ${found_AP}; then
|
2008-04-20 19:54:35 +05:30
|
|
|
SSID=${ssid}
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig_associate && return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
ewarn "Failed to associate with any preferred access points on ${IFACE}"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_connect_preferred()
|
|
|
|
{
|
2007-07-09 14:44:19 +05:30
|
|
|
local ssid= i= mode= mac= enc= freq= chan=
|
2007-11-14 23:53:59 +05:30
|
|
|
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
|
|
|
|
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
|
|
|
|
|
2007-11-29 16:53:06 +05:30
|
|
|
for ssid; do
|
2007-10-29 15:15:49 +05:30
|
|
|
unset IFS
|
2007-07-09 14:44:19 +05:30
|
|
|
i=0
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -le ${APS} ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval e=\$SSID_${i}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${e}" = "${ssid}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
SSID=${e}
|
|
|
|
eval mode=\$MODE_${i}
|
|
|
|
eval mac=\$MAC_${i}
|
|
|
|
eval enc=\$ENC_${i}
|
|
|
|
eval freq=\$FREQ_${i}
|
|
|
|
eval chan=\$CHAN_${i}
|
|
|
|
iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
|
|
|
|
"${chan}" && return 0
|
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_connect_not_preferred()
|
|
|
|
{
|
2007-04-10 16:03:44 +05:30
|
|
|
local ssid= i=0 mode= mac= enc= freq= chan= pref=false
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
while [ ${i} -le ${APS} ]; do
|
2007-04-05 16:48:42 +05:30
|
|
|
eval e=\$SSID_${i}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -n "${e}" ]; then
|
2007-11-14 23:53:59 +05:30
|
|
|
eval set -- $(_flatten_array "preferred_aps_${IFVAR}")
|
|
|
|
[ $# = 0 ] && eval set -- $(_flatten_array "preferred_aps")
|
2007-11-29 16:53:06 +05:30
|
|
|
for ssid; do
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${e}" = "${ssid}" ]; then
|
2007-07-09 14:44:19 +05:30
|
|
|
pref=true
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! ${pref}; then
|
2007-07-09 14:44:19 +05:30
|
|
|
SSID=${e}
|
|
|
|
eval mode=\$MODE_${i}
|
|
|
|
eval mac=\$MAC_${i}
|
|
|
|
eval enc=\$ENC_${i}
|
|
|
|
eval freq=\$FREQ_${i}
|
|
|
|
eval chan=\$CHAN_${i}
|
|
|
|
iwconfig_associate "${mode}" "${mac}" "${enc}" "${freq}" \
|
|
|
|
"${chan}" && return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
fi
|
|
|
|
fi
|
2011-11-11 08:16:08 +05:30
|
|
|
: $(( i += 1 ))
|
2007-04-05 16:48:42 +05:30
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_defaults()
|
|
|
|
{
|
2008-07-09 23:58:45 +05:30
|
|
|
# Turn on the radio
|
|
|
|
iwconfig "${IFACE}" txpower on 2>/dev/null
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
|
|
# Release the AP forced
|
2007-04-10 16:03:44 +05:30
|
|
|
# Must do ap and then ssid otherwise scanning borks
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig "${IFACE}" ap off 2>/dev/null
|
|
|
|
iwconfig "${IFACE}" essid off 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_configure()
|
|
|
|
{
|
2008-04-20 19:54:35 +05:30
|
|
|
local x= APS=-1
|
2007-04-10 16:03:44 +05:30
|
|
|
eval SSID=\$ssid_${IFVAR}
|
|
|
|
|
|
|
|
# Support old variable
|
|
|
|
[ -z "${SSID}" ] && eval SSID=\$essid_${IFVAR}
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
|
|
# Setup ad-hoc mode?
|
|
|
|
eval x=\$mode_${IFVAR}
|
|
|
|
x=${x:-managed}
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${x}" = "ad-hoc" -o "${x}" = "master" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig_setup_specific "${x}"
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ "${x}" != "managed" -a "${x}" != "auto" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
eerror "Only managed, ad-hoc, master and auto modes are supported"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2007-04-10 16:03:44 +05:30
|
|
|
# Has an SSID been forced?
|
|
|
|
if [ -n "${SSID}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig_set_mode "${x}"
|
|
|
|
iwconfig_associate && return 0
|
2007-04-10 16:03:44 +05:30
|
|
|
[ "${SSID}" = "any" ] && iwconfig_force_preferred && return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-04-10 16:03:44 +05:30
|
|
|
eval SSID=\$adhoc_ssid_${IFVAR}
|
|
|
|
if [ -n "${SSID}" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
iwconfig_setup_specific ad-hoc
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2007-07-31 23:53:56 +05:30
|
|
|
eval x=\$preferred_aps_${IFVAR}
|
|
|
|
[ -n "${x}" ] && preferred_aps=${x}
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-07-31 23:53:56 +05:30
|
|
|
eval x=\$blacklist_aps_${IFVAR}
|
|
|
|
[ -n "${x}" ] && blacklist_aps=${x}
|
2007-04-05 16:48:42 +05:30
|
|
|
|
|
|
|
eval x=\$associate_order_${IFVAR}
|
|
|
|
[ -n "${x}" ] && associate_order=${x}
|
|
|
|
associate_order=${associate_order:-any}
|
2007-07-31 23:53:56 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
if [ "${associate_order}" = "forcepreferredonly" ]; then
|
|
|
|
iwconfig_force_preferred && return 0
|
|
|
|
else
|
|
|
|
iwconfig_scan || return 1
|
|
|
|
iwconfig_connect_preferred && return 0
|
|
|
|
[ "${associate_order}" = "forcepreferred" ] || \
|
|
|
|
[ "${associate_order}" = "forceany" ] && \
|
|
|
|
iwconfig_force_preferred && return 0
|
|
|
|
[ "${associate_order}" = "any" ] || \
|
|
|
|
[ "${associate_order}" = "forceany" ] && \
|
|
|
|
iwconfig_connect_not_preferred && return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
e="associate with"
|
|
|
|
[ -z "${MAC_0}" ] && e="find"
|
|
|
|
[ "${preferred_aps}" = "force" ] || \
|
|
|
|
[ "${preferred_aps}" = "forceonly" ] && \
|
|
|
|
e="force"
|
|
|
|
e="Couldn't ${e} any access points on ${IFACE}"
|
|
|
|
|
|
|
|
eval SSID=\$adhoc_ssid_${IFVAR}
|
|
|
|
if [ -n "${SSID}" ]; then
|
|
|
|
ewarn "${e}"
|
|
|
|
iwconfig_setup_specific ad-hoc
|
|
|
|
return $?
|
|
|
|
fi
|
|
|
|
|
|
|
|
eerror "${e}"
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_pre_start()
|
|
|
|
{
|
2007-04-05 16:48:42 +05:30
|
|
|
# We don't configure wireless if we're being called from
|
|
|
|
# the background
|
2007-11-22 18:58:14 +05:30
|
|
|
yesno ${IN_BACKGROUND} && return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
|
2007-12-19 19:58:38 +05:30
|
|
|
service_set_value "SSID" ""
|
2007-04-05 16:48:42 +05:30
|
|
|
_exists || return 0
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if ! _is_wireless; then
|
2007-04-05 16:48:42 +05:30
|
|
|
veinfo "Wireless extensions not found for ${IFACE}"
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2007-04-12 21:17:26 +05:30
|
|
|
# Warn about old file - we want to punt it really
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -e /etc/conf.d/wireless ]; then
|
2007-04-12 21:17:26 +05:30
|
|
|
ewarn "/etc/conf.d/wireless is deprecated"
|
|
|
|
ewarn "Please put all settings into /etc/conf.d/net"
|
|
|
|
. /etc/conf.d/wireless
|
|
|
|
fi
|
|
|
|
|
2007-07-09 14:44:19 +05:30
|
|
|
# Store the fact that tx-power was off so we default to a longer
|
|
|
|
# wait if our scan returns nothing
|
2007-07-16 05:09:07 +05:30
|
|
|
LC_ALL=C iwconfig "${IFACE}" | sed -e '1d' | grep -q "Tx-Power=off"
|
2007-07-09 14:44:19 +05:30
|
|
|
local txpowerwasoff=$?
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-07-09 14:44:19 +05:30
|
|
|
iwconfig_defaults
|
|
|
|
iwconfig_user_config
|
2011-01-17 15:19:07 +05:30
|
|
|
|
2007-04-05 16:48:42 +05:30
|
|
|
# Set the base metric to be 2000
|
|
|
|
metric=2000
|
|
|
|
|
|
|
|
# Check for rf_kill - only ipw supports this at present, but other
|
|
|
|
# cards may in the future.
|
2007-11-28 21:15:03 +05:30
|
|
|
if [ -e /sys/class/net/"${IFACE}"/device/rf_kill ]; then
|
|
|
|
if [ $(cat /sys/class/net/"${IFACE}"/device/rf_kill) != "0" ]; then
|
2007-04-05 16:48:42 +05:30
|
|
|
eerror "Wireless radio has been killed for interface ${IFACE}"
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
einfo "Configuring wireless network for ${IFACE}"
|
|
|
|
|
|
|
|
# Are we a proper IEEE device?
|
|
|
|
# Most devices reutrn IEEE 802.11b/g - but intel cards return IEEE
|
|
|
|
# in lower case and RA cards return RAPCI or similar
|
|
|
|
# which really sucks :(
|
|
|
|
# For the time being, we will test prism54 not loading firmware
|
|
|
|
# which reports NOT READY!
|
|
|
|
x="$(iwconfig_get_type)"
|
|
|
|
if [ "${x}" = "NOT READY!" ]; then
|
2008-07-25 00:32:28 +05:30
|
|
|
eerror "Looks like there was a problem loading the firmware for ${IFACE}"
|
2007-04-05 16:48:42 +05:30
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
2007-11-28 21:15:03 +05:30
|
|
|
if iwconfig_configure; then
|
2007-12-19 19:58:38 +05:30
|
|
|
service_set_value "SSID" "${SSID}"
|
2007-04-05 16:48:42 +05:30
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
eerror "Failed to configure wireless for ${IFACE}"
|
|
|
|
iwconfig_defaults
|
|
|
|
iwconfig "${IFACE}" txpower off 2>/dev/null
|
2007-04-10 16:03:44 +05:30
|
|
|
unset SSID SSIDVAR
|
2007-04-05 16:48:42 +05:30
|
|
|
_down
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
2008-01-11 20:38:57 +05:30
|
|
|
iwconfig_post_stop()
|
|
|
|
{
|
2007-11-22 18:58:14 +05:30
|
|
|
yesno ${IN_BACKGROUND} && return 0
|
2007-04-05 16:48:42 +05:30
|
|
|
_exists || return 0
|
|
|
|
iwconfig_defaults
|
|
|
|
iwconfig "${IFACE}" txpower off 2>/dev/null
|
|
|
|
}
|