summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/network
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/src/etc/network')
-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
2 files changed, 29 insertions, 2 deletions
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