diff options
author | James Rayner <james@archlinux.org> | 2009-09-27 14:39:37 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-09-27 14:39:37 +0200 |
commit | 818dacfa7f435e42fe1c81ae002a8df01ea80677 (patch) | |
tree | a5c6c16d6605cb981d93fd6ecc90852d78f8cb84 /src/8021x | |
parent | dce7afd6a8d4bcd6adb7f1d1b330c21fcb8c9957 (diff) | |
download | netctl-818dacfa7f435e42fe1c81ae002a8df01ea80677.tar.gz netctl-818dacfa7f435e42fe1c81ae002a8df01ea80677.tar.xz |
Remove wpa generation duplication, fix wep/none-old
Diffstat (limited to 'src/8021x')
-rw-r--r-- | src/8021x | 36 |
1 files changed, 33 insertions, 3 deletions
@@ -47,9 +47,10 @@ stop_wpa() fi } -# $1 is interface -make_wpa_config() { - local WPA_CONF="${TMPDIR:-/tmp}/wpa.${INTERFACE}" # substitute spaces out +# Requires already loaded profile +make_wpa_config_file() { + local interface=$1 + local WPA_CONF="${TMPDIR:-/tmp}/wpa.${interface}" # substitute spaces out # make empty tmp dir with correct permissions, rename it rm -rf "$WPA_CONF" @@ -60,5 +61,34 @@ make_wpa_config() { echo "$WPA_CONF/wpa.conf" } +# Requires already loaded profile +make_wpa_config() { + case $SECURITY in + wep) + if [[ ${KEY:0:2} == "s:" ]]; then # TODO: does wpa_supplicant handle this as expected? + echo "ssid=\"$ESSID\" \nkey_mgmt=NONE \nwep_key0=\"${KEY:2}\" \nwep_tx_keyidx=0" + else + echo "ssid=\"$ESSID\" \nkey_mgmt=NONE \nwep_key0=$KEY \nwep_tx_keyidx=0" + fi + ;; + none) + echo "ssid=\"$ESSID\" \nkey_mgmt=NONE" + ;; + wpa) + if [[ "${#KEY}" -eq 64 ]]; then + echo "ssid=\"$ESSID\" \npsk=$KEY" + else + echo "ssid=\"$ESSID\" \npsk=\"$KEY\"" + fi + ;; + wpa-configsection) + echo "$CONFIGSECTION" + ;; + *) + return 1 + ;; + esac +} + # vim: ft=sh ts=4 et sw=4: |