summaryrefslogtreecommitdiff
path: root/package/base-files/src
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2010-02-13 15:06:06 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2010-02-13 15:06:06 +0100
commitfb29d8570b015c9bc0b7876db5b3a1dba732aa2a (patch)
treed85e6b46d8cf6db8d6e03983239a026301d4d98b /package/base-files/src
parent011eae436ef9c42ffeae570d10964ab1265c081d (diff)
implement WPA client mode
Diffstat (limited to 'package/base-files/src')
-rw-r--r--package/base-files/src/etc/init.d/boot2
-rwxr-xr-xpackage/base-files/src/etc/network/if-post-down.d/03-wireless6
-rwxr-xr-xpackage/base-files/src/etc/network/if-pre-up.d/04-wireless25
3 files changed, 31 insertions, 2 deletions
diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot
index f71e46240..2ef6538e0 100644
--- a/package/base-files/src/etc/init.d/boot
+++ b/package/base-files/src/etc/init.d/boot
@@ -24,4 +24,6 @@ for f in /etc/modules.d/*; do
[[ -e $f ]] && load_modules /etc/modules.d/*
break
done
+# settle down, after module load
+sleep 2
exit 0
diff --git a/package/base-files/src/etc/network/if-post-down.d/03-wireless b/package/base-files/src/etc/network/if-post-down.d/03-wireless
index 66e92639b..86e0c73e1 100755
--- a/package/base-files/src/etc/network/if-post-down.d/03-wireless
+++ b/package/base-files/src/etc/network/if-post-down.d/03-wireless
@@ -8,6 +8,12 @@ case "$IF_WIRELESS_MODE" in
logger -t hostap "Killing hostapd"
pkill hostapd
;;
+ sta)
+ [ "$IF_WIRELESS_SECURITY" != "none" ] && {
+ logger -t wireless "Killing wpa_supplicant"
+ pkill wpa_supplicant
+ }
+ ;;
*)
exit 0
;;
diff --git a/package/base-files/src/etc/network/if-pre-up.d/04-wireless b/package/base-files/src/etc/network/if-pre-up.d/04-wireless
index 54864ba78..bc498e163 100755
--- a/package/base-files/src/etc/network/if-pre-up.d/04-wireless
+++ b/package/base-files/src/etc/network/if-pre-up.d/04-wireless
@@ -2,8 +2,6 @@
#set -x
set -e
-[ -x /usr/sbin/iw ] || exit 0
-
[ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0
[ "$IF_WIRELESS_SSID" ] || exit 1
@@ -77,6 +75,29 @@ case "$IF_WIRELESS_MODE" in
logger -t hostap "Starting hostapd"
hostapd -B /tmp/hostapd.conf
;;
+ sta)
+ [ -x /usr/sbin/iw ] || {
+ logger -t wireless "No iw utility found"
+ exit 1
+ }
+ ip link set up dev ${IFACE}
+ iw dev ${IFACE} set channel $IF_WIRELESS_CHANNEL
+ iw dev ${IFACE} connect $IF_WIRELESS_SSID
+ [ $wpa2 -eq 1 ] && {
+ [ -x /usr/sbin/wpa_supplicant ] || {
+ logger -t wireless "No wpa_supplicant found"
+ exit 1
+ }
+ touch /tmp/wpa_supplicant.conf
+ chmod 600 /tmp/wpa_supplicant.conf
+ echo "network={" > /tmp/wpa_supplicant.conf
+ echo " ssid=\"$IF_WIRELESS_SSID\"" >> /tmp/wpa_supplicant.conf
+ echo " psk=\"$IF_WIRELESS_PASSPHRASE\"" >> /tmp/wpa_supplicant.conf
+ echo " priority=5" >> /tmp/wpa_supplicant.conf
+ echo "}" >> /tmp/wpa_supplicant.conf
+ wpa_supplicant -B -Dnl80211 -i${IFACE} -c/tmp/wpa_supplicant.conf
+ }
+ ;;
*)
echo "Unknown operation mode $IF_WIRELESS_MODE given!"
exit 1