routes_SSID now works, as does iwconfig.sh for BSD

This commit is contained in:
Roy Marples 2007-04-09 18:56:26 +00:00
parent 89ac4eee26
commit 5076114aa7
2 changed files with 23 additions and 10 deletions

View File

@ -97,7 +97,7 @@ iwconfig_setup_specific() {
local key=$(iwconfig_get_wep_key) local key=$(iwconfig_get_wep_key)
# Now set the key # Now set the key
ifconfig "${IFACE}" wepkey ${key} eval ifconfig "${IFACE}" wepkey "${key}"
ifconfig "${IFACE}" ssid "${ESSID}" || return 1 ifconfig "${IFACE}" ssid "${ESSID}" || return 1
@ -134,10 +134,23 @@ iwconfig_associate() {
# Set mode accordingly # Set mode accordingly
case "${caps}" in case "${caps}" in
*E*) mode="managed"; ifconfig "${IFACE}" -mediaopt adhoc ;; *E*)
*I*) mode="adhoc"; ifconfig "${IFACE}" mediaopt adhoc ;; mode="managed"
if LC_ALL=C ifconfig "${IFACE}" | \
grep -q "^[[:space:]]*media: .*adhoc" ; then
ifconfig "${IFACE}" down -mediaopt adhoc up
fi
;;
*I*)
mode="adhoc"
if ! LC_ALL=C ifconfig "${IFACE}" | \
grep -q "^[[:space:]]*media: .*adhoc" ; then
ifconfig "${IFACE}" down -mediaopt adhoc up
fi
;;
*) *)
if LC_ALL=C ifconfig "${IFACE}" | grep -q "^[[:space:]]*media: .*adhoc" ; then if LC_ALL=C ifconfig "${IFACE}" \
| grep -q "^[[:space:]]*media: .*adhoc" ; then
mode="adhoc" mode="adhoc"
else else
mode="managed" mode="managed"
@ -152,10 +165,10 @@ iwconfig_associate() {
ifconfig "${IFACE}" deftxkey 1 ifconfig "${IFACE}" deftxkey 1
w=$(iwconfig_get_wep_status) w=$(iwconfig_get_wep_status)
fi fi
ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}" ebegin "Connecting to \"${SSID}\" in ${mode} mode ${w}"
if ! ifconfig "${IFACE}" wepkey ${key} ; then if ! eval ifconfig "${IFACE}" wepkey "${key}" ; then
eerror "Invalid WEP key ${key}" eerror "Invalid WEP key ${key}"
return 1 return 1
fi fi
@ -239,10 +252,10 @@ iwconfig_scan() {
shift shift
done done
eval MAC_${APS}="$(echo "$1" | tr '[:lower:]' '[:upper:]')" eval MAC_${APS}="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
eval CHAN_${APS}=$2 eval CHAN_${APS}="$2"
quality=${4%:*} quality=${4%:*}
shift ; shift ; shift ; shift ; shift shift ; shift ; shift ; shift ; shift
eval CAPS_${APS}=$* eval CAPS_${APS}="\"$*\""
# Add 1000 for managed nodes as we prefer them to adhoc # Add 1000 for managed nodes as we prefer them to adhoc
set -- $* set -- $*

View File

@ -4,7 +4,7 @@
MODULESDIR="${RC_LIBDIR}/net" MODULESDIR="${RC_LIBDIR}/net"
MODULESLIST="${RC_SVCDIR}/nettree" MODULESLIST="${RC_SVCDIR}/nettree"
_config_vars="config" _config_vars="config routes"
[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false [ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false