aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-04-09 18:56:26 +0000
committerRoy Marples <roy@marples.name>2007-04-09 18:56:26 +0000
commit5076114aa70b102ffabdb5023ccae4b299be82df (patch)
tree58dfd93d980a70a322808867850b7bee03c0e6b4
parent89ac4eee26d07f9e62dcc518d386551e8eef40ad (diff)
routes_SSID now works, as does iwconfig.sh for BSD
-rw-r--r--net.BSD/iwconfig.sh31
-rwxr-xr-xsh/net.sh2
2 files changed, 23 insertions, 10 deletions
diff --git a/net.BSD/iwconfig.sh b/net.BSD/iwconfig.sh
index aa9057b4..e7134082 100644
--- a/net.BSD/iwconfig.sh
+++ b/net.BSD/iwconfig.sh
@@ -97,7 +97,7 @@ iwconfig_setup_specific() {
local key=$(iwconfig_get_wep_key)
# Now set the key
- ifconfig "${IFACE}" wepkey ${key}
+ eval ifconfig "${IFACE}" wepkey "${key}"
ifconfig "${IFACE}" ssid "${ESSID}" || return 1
@@ -134,10 +134,23 @@ iwconfig_associate() {
# Set mode accordingly
case "${caps}" in
- *E*) mode="managed"; ifconfig "${IFACE}" -mediaopt adhoc ;;
- *I*) mode="adhoc"; ifconfig "${IFACE}" mediaopt adhoc ;;
+ *E*)
+ 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"
else
mode="managed"
@@ -152,10 +165,10 @@ iwconfig_associate() {
ifconfig "${IFACE}" deftxkey 1
w=$(iwconfig_get_wep_status)
fi
-
+
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}"
return 1
fi
@@ -239,10 +252,10 @@ iwconfig_scan() {
shift
done
eval MAC_${APS}="$(echo "$1" | tr '[:lower:]' '[:upper:]')"
- eval CHAN_${APS}=$2
+ eval CHAN_${APS}="$2"
quality=${4%:*}
shift ; shift ; shift ; shift ; shift
- eval CAPS_${APS}=$*
+ eval CAPS_${APS}="\"$*\""
# Add 1000 for managed nodes as we prefer them to adhoc
set -- $*
diff --git a/sh/net.sh b/sh/net.sh
index c839dd4c..30c68fc3 100755
--- a/sh/net.sh
+++ b/sh/net.sh
@@ -4,7 +4,7 @@
MODULESDIR="${RC_LIBDIR}/net"
MODULESLIST="${RC_SVCDIR}/nettree"
-_config_vars="config"
+_config_vars="config routes"
[ -z "${IN_BACKGROUND}" ] && IN_BACKGROUND=false